Change integration tests #2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: OIDC Integration Test | |
| on: | |
| push: | |
| branches: | |
| - '**' | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| id-token: write | |
| contents: read | |
| jobs: | |
| setup-artifactory: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| jf_url: http://localhost:8081/ | |
| oidc_provider_name: ${{ steps.generate-oidc-name.outputs.oidc_provider_name }} | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Go with cache | |
| uses: jfrog/.github/actions/install-go-with-cache@main | |
| - name: Install local Artifactory | |
| uses: jfrog/.github/actions/install-local-artifactory@main | |
| with: | |
| RTLIC: ${{ secrets.RTLIC }} | |
| - name: Wait for Artifactory to be ready | |
| shell: bash | |
| run: | | |
| until curl -sSf http://localhost:8081/artifactory/api/system/ping; do sleep 5; done | |
| - name: Generate unique OIDC provider name | |
| id: generate-oidc-name | |
| shell: bash | |
| run: echo "oidc_provider_name=oidc-integration-$(date +%s)" >> "$GITHUB_OUTPUT" | |
| - name: Create OpenID Connect integration | |
| shell: bash | |
| run: | | |
| 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 '{ | |
| "name": "${{ steps.generate-oidc-name.outputs.oidc_provider_name }}", | |
| "issuer_url": "https://token.actions.githubusercontent.com", | |
| "provider_type": "GitHub", | |
| "enable_permissive_configuration": "true", | |
| "description": "Test configuration for OIDC integration" | |
| }' | |
| - name: Create OIDC Identity Mapping | |
| shell: bash | |
| run: | | |
| curl -X POST "${{ secrets.JFROG_PLATFORM_URL }}/access/api/v1/oidc/${{ steps.generate-oidc-name.outputs.oidc_provider_name }}/identity_mappings" \ | |
| -H 'Content-Type: application/json' \ | |
| -H "Authorization: Bearer ${{ secrets.JFROG_PLATFORM_RT_TOKEN }}" \ | |
| -d '{ | |
| "name": "oidc-test-mapping", | |
| "priority": "1", | |
| "claims": { | |
| "repository": "${{ github.repository_owner }}/setup-jfrog-cli" | |
| }, | |
| "token_spec": { | |
| "scope": "applied-permissions/groups:readers", | |
| "expires_in": 30 | |
| } | |
| }' | |
| oidc-test: | |
| needs: setup-artifactory | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu, macos, windows] | |
| cli-version: ['2.74.1', '2.75.0', 'latest'] | |
| runs-on: ${{ matrix.os }}-latest | |
| name: OIDC Test - ${{ matrix.cli-version }} on ${{ matrix.os }} | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.event.pull_request.head.sha }} | |
| - name: Setup JFrog CLI | |
| id: setup-jfrog-cli | |
| uses: ./ | |
| env: | |
| JF_URL: ${{ needs.setup-artifactory.outputs.jf_url }} | |
| with: | |
| version: ${{ matrix.cli-version }} | |
| oidc-provider-name: ${{ needs.setup-artifactory.outputs.oidc_provider_name }} | |
| - name: Test JFrog CLI connectivity | |
| run: jf rt ping | |
| - name: Validate user output | |
| shell: bash | |
| run: test -n "${{ steps.setup-jfrog-cli.outputs.oidc-user }}" | |
| - name: Validate token output | |
| shell: bash | |
| run: test -n "${{ steps.setup-jfrog-cli.outputs.oidc-token }}" | |
| - name: Delete OIDC integration | |
| shell: bash | |
| if: always() | |
| run: | | |
| curl -X DELETE "${{ secrets.JFROG_PLATFORM_URL }}/access/api/v1/oidc/${{ needs.setup-artifactory.outputs.oidc_provider_name }}" \ | |
| -H "Authorization: Bearer ${{ secrets.JFROG_PLATFORM_RT_TOKEN }}" |