Skip to content

Commit d6b8a03

Browse files
committed
Change integration tests
1 parent da0f4a4 commit d6b8a03

File tree

1 file changed

+40
-62
lines changed

1 file changed

+40
-62
lines changed

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

Lines changed: 40 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -13,91 +13,69 @@ permissions:
1313
id-token: write
1414
contents: read
1515

16+
env:
17+
JFROG_CLI_LOG_LEVEL: DEBUG
18+
1619
jobs:
17-
setup-artifactory:
18-
runs-on: ubuntu-latest
19-
outputs:
20-
jf_url: http://localhost:8081/
21-
oidc_provider_name: ${{ steps.generate-oidc-name.outputs.oidc_provider_name }}
20+
oidc-test:
21+
if: contains(github.event.pull_request.labels.*.name, 'safe to test') || github.event_name == 'push'
22+
strategy:
23+
fail-fast: true
24+
matrix:
25+
os: [ubuntu, macos, windows]
26+
cli-version: ['2.74.1', '2.75.0']
27+
runs-on: ${{ matrix.os }}-latest
28+
name: OIDC Test - ${{ matrix.cli-version }} on ${{ matrix.os }}
2229

2330
steps:
2431
- name: Checkout Repository
2532
uses: actions/checkout@v4
26-
27-
- name: Setup Go with cache
28-
uses: jfrog/.github/actions/install-go-with-cache@main
29-
30-
- name: Install local Artifactory
31-
uses: jfrog/.github/actions/install-local-artifactory@main
3233
with:
33-
RTLIC: ${{ secrets.RTLIC }}
34-
35-
- name: Wait for Artifactory to be ready
36-
shell: bash
37-
run: |
38-
until curl -sSf http://localhost:8081/artifactory/api/system/ping; do sleep 5; done
34+
ref: ${{ github.event.pull_request.head.sha }}
3935

4036
- name: Generate unique OIDC provider name
41-
id: generate-oidc-name
37+
id: gen-oidc
4238
shell: bash
43-
run: echo "oidc_provider_name=oidc-integration-$(date +%s)" >> "$GITHUB_OUTPUT"
39+
run: echo "oidc_provider_name=oidc-integration-${{ matrix.cli-version }}-${{ matrix.os }}-$(date +%s)" >> "$GITHUB_OUTPUT"
4440

4541
- name: Create OpenID Connect integration
4642
shell: bash
4743
run: |
48-
curl -X POST "${{ secrets.JFROG_PLATFORM_URL }}/access/api/v1/oidc" \
49-
-H "Content-Type: application/json" \
50-
-H "Authorization: Bearer ${{ secrets.JFROG_PLATFORM_RT_TOKEN }}" \
51-
-d '{
52-
"name": "${{ steps.generate-oidc-name.outputs.oidc_provider_name }}",
53-
"issuer_url": "https://token.actions.githubusercontent.com",
54-
"provider_type": "GitHub",
55-
"enable_permissive_configuration": "true",
56-
"description": "Test configuration for OIDC integration"
57-
}'
44+
curl -X POST "${{ secrets.JFROG_PLATFORM_URL }}/access/api/v1/oidc" -H "Content-Type: application/json" -H "Authorization: Bearer ${{ secrets.JFROG_PLATFORM_RT_TOKEN }}" -d '{
45+
"name": "${{ steps.gen-oidc.outputs.oidc_provider_name }}",
46+
"issuer_url": "https://token.actions.githubusercontent.com",
47+
"provider_type": "GitHub",
48+
"enable_permissive_configuration": "true",
49+
"description": "Test configuration for CLI version ${{ matrix.cli-version }}"
50+
}'
5851
5952
- name: Create OIDC Identity Mapping
6053
shell: bash
6154
run: |
62-
curl -X POST "${{ secrets.JFROG_PLATFORM_URL }}/access/api/v1/oidc/${{ steps.generate-oidc-name.outputs.oidc_provider_name }}/identity_mappings" \
63-
-H 'Content-Type: application/json' \
64-
-H "Authorization: Bearer ${{ secrets.JFROG_PLATFORM_RT_TOKEN }}" \
65-
-d '{
66-
"name": "oidc-test-mapping",
67-
"priority": "1",
68-
"claims": {
69-
"repository": "${{ github.repository_owner }}/setup-jfrog-cli"
70-
},
71-
"token_spec": {
72-
"scope": "applied-permissions/groups:readers",
73-
"expires_in": 30
74-
}
75-
}'
55+
curl -X POST "${{ secrets.JFROG_PLATFORM_URL }}/access/api/v1/oidc/${{ steps.gen-oidc.outputs.oidc_provider_name }}/identity_mappings" \
56+
-H 'Content-Type: application/json' \
57+
-H 'Authorization: Bearer ${{ secrets.JFROG_PLATFORM_RT_TOKEN }}' \
58+
-d '{
59+
"name": "oidc-test-mapping",
60+
"priority": "1",
61+
"claims": {
62+
"repository": "${{ github.repository_owner }}/setup-jfrog-cli"
63+
},
64+
"token_spec": {
65+
"scope": "applied-permissions/groups:readers",
66+
"expires_in": 30
67+
}
68+
}'
7669
77-
oidc-test:
78-
needs: setup-artifactory
79-
strategy:
80-
fail-fast: false
81-
matrix:
82-
os: [ubuntu, macos, windows]
83-
cli-version: ['2.74.1', '2.75.0', 'latest']
84-
runs-on: ${{ matrix.os }}-latest
85-
name: OIDC Test - ${{ matrix.cli-version }} on ${{ matrix.os }}
86-
87-
steps:
88-
- name: Checkout Repository
89-
uses: actions/checkout@v4
90-
with:
91-
ref: ${{ github.event.pull_request.head.sha }}
9270
9371
- name: Setup JFrog CLI
9472
id: setup-jfrog-cli
9573
uses: ./
9674
env:
97-
JF_URL: ${{ needs.setup-artifactory.outputs.jf_url }}
75+
JF_URL: ${{ secrets.JFROG_PLATFORM_URL }}
9876
with:
9977
version: ${{ matrix.cli-version }}
100-
oidc-provider-name: ${{ needs.setup-artifactory.outputs.oidc_provider_name }}
78+
oidc-provider-name: ${{ steps.gen-oidc.outputs.oidc_provider_name }}
10179

10280
- name: Test JFrog CLI connectivity
10381
run: jf rt ping
@@ -114,5 +92,5 @@ jobs:
11492
shell: bash
11593
if: always()
11694
run: |
117-
curl -X DELETE "${{ secrets.JFROG_PLATFORM_URL }}/access/api/v1/oidc/${{ needs.setup-artifactory.outputs.oidc_provider_name }}" \
118-
-H "Authorization: Bearer ${{ secrets.JFROG_PLATFORM_RT_TOKEN }}"
95+
curl -X DELETE "${{ secrets.JFROG_PLATFORM_URL }}/access/api/v1/oidc/${{ steps.gen-oidc.outputs.oidc_provider_name }}" \
96+
-H "Authorization: Bearer ${{ secrets.JFROG_PLATFORM_RT_TOKEN }}"

0 commit comments

Comments
 (0)