Skip to content

Commit 87f1be3

Browse files
committed
test
1 parent 45d6045 commit 87f1be3

File tree

1 file changed

+41
-28
lines changed

1 file changed

+41
-28
lines changed

.github/workflows/oidc-integration-test.yml

Lines changed: 41 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ name: OIDC Integration Test
99
on:
1010
push:
1111
branches:
12-
- master
12+
- "**"
1313
# Triggers the workflow on labeled PRs only.
1414
pull_request_target:
1515
types: [ labeled ]
@@ -23,30 +23,20 @@ permissions:
2323
contents: read
2424

2525
jobs:
26-
oidc-test:
26+
generate-oidc-integration:
2727
strategy:
28-
fail-fast: false
2928
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-
29+
# This has to match the second audience value in the workflow
30+
audience_value: [ '' ,'test-audience','github-jfrog' ]
31+
runs-on: ubuntu-latest
32+
outputs:
33+
oidc_provider_name: ${{ steps.gen-oidc.outputs.oidc_provider_name }}
3734
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
4435
- name: Generate unique OIDC provider name
4536
id: gen-oidc
4637
shell: bash
4738
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"
39+
echo "oidc_provider_name=oidc-integration-${{ matrix.audience_value }}-${{ github.run_id }}" >> "$GITHUB_OUTPUT"
5040
5141
- name: Create OpenID Connect integration
5242
shell: bash
@@ -58,8 +48,9 @@ jobs:
5848
"name": "${{ steps.gen-oidc.outputs.oidc_provider_name }}",
5949
"issuer_url": "https://token.actions.githubusercontent.com",
6050
"provider_type": "GitHub",
51+
"audience": "${{ matrix.audience_value }}",
6152
"enable_permissive_configuration": "true",
62-
"description": "Test configuration for CLI version ${{ matrix.cli-version }}"
53+
"description": "Test configuration for audience ${{ matrix.audience_value }}"
6354
}'
6455
6556
- name: Create OIDC Identity Mapping
@@ -76,25 +67,45 @@ jobs:
7667
},
7768
"token_spec": {
7869
"scope": "applied-permissions/groups:readers",
79-
"expires_in": 30
70+
"expires_in": 10
8071
}
8172
}'
8273
83-
# Setup
74+
- name: Save OIDC provider name
75+
shell: bash
76+
run: echo "oidc_provider_name=${{ steps.gen-oidc.outputs.oidc_provider_name }}" >> "$GITHUB_ENV"
77+
78+
oidc-test:
79+
needs: generate-oidc-integration
80+
strategy:
81+
fail-fast: false
82+
matrix:
83+
os: [ ubuntu, macos, windows ]
84+
cli-version: [ '2.74.1', '2.75.0','latest' ]
85+
# This has to match the second audience value in the workflow
86+
audience_value: [ '' ,'test-audience','github-jfrog' ]
87+
runs-on: ${{ matrix.os }}-latest
88+
env:
89+
JFROG_CLI_LOG_LEVEL: DEBUG
90+
steps:
91+
- name: Checkout Repository
92+
uses: actions/checkout@v4
93+
with:
94+
ref: ${{ github.event.pull_request.head.sha }}
95+
8496
- name: Setup JFrog CLI
8597
id: setup-jfrog-cli
8698
uses: ./
8799
env:
88100
JF_URL: ${{ secrets.JFROG_PLATFORM_URL }}
89101
with:
90102
version: ${{ matrix.cli-version }}
91-
oidc-provider-name: ${{ steps.gen-oidc.outputs.oidc_provider_name }}
103+
oidc-provider-name: ${{ needs.generate-oidc-integration.outputs.oidc_provider_name }}
104+
oidc-audience: ${{ matrix.audience_value }}
92105

93-
# validate successful OIDC configuration
94106
- name: Test JFrog CLI connectivity
95107
run: jf rt ping
96108

97-
# Validate step outputs
98109
- name: Validate user output
99110
shell: bash
100111
run: test -n "${{ steps.setup-jfrog-cli.outputs.oidc-user }}"
@@ -103,10 +114,12 @@ jobs:
103114
shell: bash
104115
run: test -n "${{ steps.setup-jfrog-cli.outputs.oidc-token }}"
105116

106-
# Cleanup
117+
cleanup-oidc-integration:
118+
needs: oidc-test
119+
runs-on: ubuntu-latest
120+
steps:
107121
- name: Delete OIDC integration
108122
shell: bash
109-
if: always()
110123
run: |
111-
curl -X DELETE "${{ secrets.JFROG_PLATFORM_URL }}/access/api/v1/oidc/${{ steps.gen-oidc.outputs.oidc_provider_name }}" \
112-
-H "Authorization: Bearer ${{ secrets.JFROG_PLATFORM_RT_TOKEN }}"
124+
curl -X DELETE "${{ secrets.JFROG_PLATFORM_URL }}/access/api/v1/oidc/${{ needs.generate-oidc-integration.outputs.oidc_provider_name }}" \
125+
-H "Authorization: Bearer ${{ secrets.JFROG_PLATFORM_RT_TOKEN }}"

0 commit comments

Comments
 (0)