-
Notifications
You must be signed in to change notification settings - Fork 284
74 lines (67 loc) · 2.34 KB
/
oidcTests.yml
File metadata and controls
74 lines (67 loc) · 2.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# These Tests validate successful OIDC server configuration in the CLI.
# After the server has been configured the CLI will ping the server to make sure we have access
name: "Config OIDC test"
on:
push:
branches:
- '**'
tags-ignore:
- '**'
# Triggers the workflow on labeled PRs only.
pull_request_target:
types: [ labeled ]
# Ensures that only the latest commit is running for each PR at a time.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.ref }}
cancel-in-progress: true
env:
JFROG_CLI_LOG_LEVEL: DEBUG
# Needed for OIDC
permissions:
id-token: write
contents: read
jobs:
config-oidc:
if: contains(github.event.pull_request.labels.*.name, 'safe to test') || github.event_name == 'push'
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
runs-on: ${{ matrix.os }}
steps:
- name: Setup Go with cache
uses: jfrog/.github/actions/install-go-with-cache@main
- name: Checkout the repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Build CLI
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
./build/build.bat
else
./build/build.sh
fi
shell: bash
- name: Get ID Token from GitHub
shell: bash
run: |
ID_TOKEN=$(curl -sLS -H "User-Agent: actions/oidc-client" -H "Authorization: Bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" \
"${ACTIONS_ID_TOKEN_REQUEST_URL}&audience=jfrog-github" | jq .value | tr -d '"')
echo "JFROG_CLI_OIDC_EXCHANGE_TOKEN_ID=${ID_TOKEN}" >> $GITHUB_ENV
- name: Run config command
shell: bash
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
./jfrog.exe c add --url=https://ecosysjfrog.jfrog.io --oidc-provider-name=setup-jfrog-cli-test --interactive=false
else
./jf c add --url=https://ecosysjfrog.jfrog.io --oidc-provider-name=setup-jfrog-cli-test --interactive=false
fi
- name: Ping the server to validate successful OIDC configuration
shell: bash
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
./jfrog.exe rt ping
else
./jf rt ping
fi