Change integration tests #4
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: | |
| oidc-test: | |
| strategy: | |
| fail-fast: true | |
| matrix: | |
| os: [ubuntu, macos, windows] | |
| cli-version: ['2.74.1', '2.75.0'] | |
| runs-on: ${{ matrix.os }}-latest | |
| name: OIDC Test - ${{ matrix.cli-version }} on ${{ matrix.os }} | |
| env: | |
| JFROG_CLI_LOG_LEVEL: DEBUG | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.event.pull_request.head.sha }} | |
| - name: Generate unique OIDC provider name | |
| id: gen-oidc | |
| shell: bash | |
| run: echo "oidc_provider_name=oidc-integration-${{ matrix.cli-version }}-${{ matrix.os }}-$(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.gen-oidc.outputs.oidc_provider_name }}", | |
| "issuer_url": "https://token.actions.githubusercontent.com", | |
| "provider_type": "GitHub", | |
| "enable_permissive_configuration": "true", | |
| "description": "Test configuration for CLI version ${{ matrix.cli-version }}" | |
| }' | |
| - name: Create OIDC Identity Mapping | |
| shell: bash | |
| run: | | |
| curl -X POST "${{ secrets.JFROG_PLATFORM_URL }}/access/api/v1/oidc/${{ steps.gen-oidc.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 | |
| } | |
| }' | |
| - name: Setup JFrog CLI | |
| id: setup-jfrog-cli | |
| uses: ./ | |
| env: | |
| JF_URL: ${{ secrets.JFROG_PLATFORM_URL }} | |
| with: | |
| version: ${{ matrix.cli-version }} | |
| oidc-provider-name: ${{ steps.gen-oidc.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/${{ steps.gen-oidc.outputs.oidc_provider_name }}" \ | |
| -H "Authorization: Bearer ${{ secrets.JFROG_PLATFORM_RT_TOKEN }}" |