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