@@ -5,7 +5,6 @@ name: OIDC Integration Test
55# - 2.74.1: Does not support `jf eot` command, validates manual fallback logic.
66# - 2.75.0: Introduced native OIDC token exchange.
77# - Latest: Ensures ongoing compatibility with the most recent CLI build.
8-
98on :
109 push :
1110 branches :
@@ -23,54 +22,51 @@ permissions:
2322 contents : read
2423
2524jobs :
26- oidc-test :
25+ generate-platform- oidc-integration :
2726 strategy :
28- fail-fast : false
27+ # Using "include" instead of a matrix of arrays gives us fine-grained control over test combinations.
28+ # This is needed because some audience values (e.g., URLs) contain characters not valid in matrix keys or job names.
29+ #
30+ # Each scenario represents a real-world case:
31+ # - "default": No audience is set in the action or the platform integration.
32+ # - "test": A custom audience is explicitly set in both the action and the platform integration.
33+ # - "github-implicit-default": The platform integration is explicitly configured with GitHub's default audience,
34+ # but the action does not pass any audience.
35+ # This tests CLI behavior in case of mismatches — see https://github.com/jfrog/setup-jfrog-cli/issues/270
2936 matrix :
30- os : [ ubuntu, macos, windows ]
31- cli-version : [ '2.74.1', '2.75.0','latest' ]
32- runs-on : ${{ matrix.os }}-latest
33- name : OIDC Test - ${{ matrix.cli-version }} on ${{ matrix.os }}
34- env :
35- JFROG_CLI_LOG_LEVEL : DEBUG
36-
37+ include :
38+ - audience_id : default
39+ audience_value : ' '
40+ - audience_id : test
41+ audience_value : ' audience-value'
42+ - audience_id : github-implicit-default
43+ audience_value : ' https://github.com/jfrog'
44+ runs-on : ubuntu-latest
3745 steps :
38- - name : Checkout Repository
39- uses : actions/checkout@v4
40- with :
41- ref : ${{ github.event.pull_request.head.sha }}
42-
43- # Setup OIDC platform integration
44- - name : Generate unique OIDC provider name
45- id : gen-oidc
46- shell : bash
47- run : |
48- cli_version="${{ matrix.cli-version }}" && cli_version="${cli_version//./-}"
49- echo "oidc_provider_name=oidc-integration-${cli_version}-${{ matrix.os }}-$(date +%s)" >> "$GITHUB_OUTPUT"
50-
5146 - name : Create OpenID Connect integration
5247 shell : bash
5348 run : |
5449 curl -X POST "${{ secrets.JFROG_PLATFORM_URL }}/access/api/v1/oidc" \
5550 -H "Content-Type: application/json" \
5651 -H "Authorization: Bearer ${{ secrets.JFROG_PLATFORM_RT_TOKEN }}" \
5752 -d '{
58- "name": "${{ steps.gen-oidc.outputs.oidc_provider_name }}",
53+ "name": "oidc-integration- ${{ matrix.audience_id }}-${{ github.run_id }}",
5954 "issuer_url": "https://token.actions.githubusercontent.com",
6055 "provider_type": "GitHub",
61- "enable_permissive_configuration": "true",
62- "description": "Test configuration for CLI version ${{ matrix.cli-version }}"
56+ "audience": "${{ matrix.audience_value }}",
57+ "enable_permissive_configuration": true,
58+ "description": "Temp integration for testing OIDC with audience value: ${{ matrix.audience_value }}"
6359 }'
6460
6561 - name : Create OIDC Identity Mapping
6662 shell : bash
6763 run : |
68- curl -X POST "${{ secrets.JFROG_PLATFORM_URL }}/access/api/v1/oidc/${{ steps.gen-oidc.outputs.oidc_provider_name }}/identity_mappings" \
69- -H ' Content-Type: application/json' \
64+ curl -X POST "${{ secrets.JFROG_PLATFORM_URL }}/access/api/v1/oidc/oidc-integration- ${{ matrix.audience_id }}-${{ github.run_id }}/identity_mappings" \
65+ -H " Content-Type: application/json" \
7066 -H "Authorization: Bearer ${{ secrets.JFROG_PLATFORM_RT_TOKEN }}" \
7167 -d '{
7268 "name": "oidc-test-mapping",
73- "priority": "1" ,
69+ "priority": 1 ,
7470 "claims": {
7571 "repository": "${{ github.repository_owner }}/setup-jfrog-cli"
7672 },
@@ -80,21 +76,65 @@ jobs:
8076 }
8177 }'
8278
83- # Setup
79+ oidc-test :
80+ needs : generate-platform-oidc-integration
81+ strategy :
82+ fail-fast : false
83+ # Using include allows exact combinations of CLI version and audience ID to ensure coverage of edge cases.
84+ # This avoids invalid audience strings in identifiers and ensures fallback logic is tested selectively.
85+ matrix :
86+ include :
87+ - cli-version : ' 2.74.1'
88+ audience_id : default
89+ audience_value : ' '
90+ - cli-version : ' 2.75.0'
91+ audience_id : default
92+ audience_value : ' '
93+ - cli-version : latest
94+ audience_id : default
95+ audience_value : ' '
96+ - cli-version : ' 2.74.1'
97+ audience_id : test
98+ audience_value : ' audience-value'
99+ - cli-version : ' 2.75.0'
100+ audience_id : test
101+ audience_value : ' audience-value'
102+ - cli-version : latest
103+ audience_id : test
104+ audience_value : ' audience-value'
105+ # GitHub default audience value is resolved implicitly when omitted.
106+ # These tests verify that the CLI handles an empty value correctly while GitHub sets the expected audience on its backend.
107+ - cli-version : ' 2.74.1'
108+ audience_id : github-implicit-default
109+ audience_value : ' '
110+ - cli-version : ' 2.75.0'
111+ audience_id : github-implicit-default
112+ audience_value : ' '
113+ - cli-version : latest
114+ audience_id : github-implicit-default
115+ audience_value : ' '
116+ runs-on : ubuntu-latest
117+ env :
118+ JFROG_CLI_LOG_LEVEL : DEBUG
119+ steps :
120+ - name : Checkout Repository
121+ uses : actions/checkout@v4
122+ with :
123+ ref : ${{ github.event.pull_request.head.sha }}
124+
84125 - name : Setup JFrog CLI
85126 id : setup-jfrog-cli
86127 uses : ./
87128 env :
88129 JF_URL : ${{ secrets.JFROG_PLATFORM_URL }}
89130 with :
90131 version : ${{ matrix.cli-version }}
91- oidc-provider-name : ${{ steps.gen-oidc.outputs.oidc_provider_name }}
132+ oidc-provider-name : oidc-integration-${{ matrix.audience_id }}-${{ github.run_id }}
133+ oidc-audience : ${{ matrix.audience_value }}
92134
93- # validate successful OIDC configuration
94135 - name : Test JFrog CLI connectivity
95136 run : jf rt ping
96137
97- # Validate step outputs
98138 - name : Validate user output
99139 shell : bash
100140 run : test -n "${{ steps.setup-jfrog-cli.outputs.oidc-user }}"
@@ -103,10 +143,19 @@ jobs:
103143 shell : bash
104144 run : test -n "${{ steps.setup-jfrog-cli.outputs.oidc-token }}"
105145
106- # Cleanup
146+ cleanup-oidc-integration :
147+ needs : oidc-test
148+ if : always()
149+ strategy :
150+ matrix :
151+ include :
152+ - audience_id : default
153+ - audience_id : test
154+ - audience_id : github-implicit-default
155+ runs-on : ubuntu-latest
156+ steps :
107157 - name : Delete OIDC integration
108158 shell : bash
109- if : always()
110159 run : |
111- curl -X DELETE "${{ secrets.JFROG_PLATFORM_URL }}/access/api/v1/oidc/${{ steps.gen-oidc.outputs.oidc_provider_name }}" \
160+ curl -X DELETE "${{ secrets.JFROG_PLATFORM_URL }}/access/api/v1/oidc/oidc-integration- ${{ matrix.audience_id }}-${{ github.run_id }}" \
112161 -H "Authorization: Bearer ${{ secrets.JFROG_PLATFORM_RT_TOKEN }}"
0 commit comments