fix: use if-then syntax instead of || for crane check #8
Workflow file for this run
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
| # Copyright (c) 2025, NVIDIA CORPORATION. All rights reserved. | |
| # | |
| # Licensed under the Apache License, Version 2.0 (the "License"); | |
| # you may not use this file except in compliance with the License. | |
| # You may obtain a copy of the License at | |
| # | |
| # http://www.apache.org/licenses/LICENSE-2.0 | |
| # | |
| # Unless required by applicable law or agreed to in writing, software | |
| # distributed under the License is distributed on an "AS IS" BASIS, | |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| # See the License for the specific language governing permissions and | |
| # limitations under the License. | |
| name: Integration Tests - GCP | |
| on: | |
| workflow_dispatch: {} # allow manual runs for testing | |
| push: | |
| branches: | |
| - main | |
| - feature/oidc-gcp | |
| permissions: | |
| contents: read | |
| actions: read | |
| id-token: write | |
| jobs: | |
| copy-images: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| env: | |
| IMAGE_TAG: main-ddc3fc4 | |
| TARGET_REG: us-docker.pkg.dev | |
| TARGET_REPO: nvsentinel | |
| CRANE_VERSION: "0.20.6" | |
| IDENTITY_PROVIDER: "projects/868575635057/locations/global/workloadIdentityPools/github-pool/providers/github-provider" | |
| SERVICE_ACCOUNT: "[email protected]" | |
| PROJECT_ID: "proj-dgxc-nvsentinel" | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| - name: Get AuthN Token | |
| id: auth | |
| uses: google-github-actions/auth@7c6bc770dae815cd3e89ee6cdf493a5fab2cc093 # v3 | |
| with: | |
| token_format: access_token | |
| workload_identity_provider: ${{ env.IDENTITY_PROVIDER }} | |
| service_account: ${{ env.SERVICE_ACCOUNT }} | |
| - name: Authenticate to GCP Artifact Registry | |
| uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0 | |
| with: | |
| registry: ${{ env.TARGET_REG }} | |
| username: oauth2accesstoken | |
| password: ${{ steps.auth.outputs.access_token }} | |
| - name: Setup gcloud CLI | |
| uses: google-github-actions/setup-gcloud@aa5489c8933f4cc7a4f7d45035b3b1440c9c10db # v3.0.1 | |
| with: | |
| version: '>= 543.0.0' | |
| - name: Show gcloud CLI Info | |
| run: | | |
| gcloud info | |
| - name: Install crane | |
| shell: bash | |
| env: | |
| CRANE_VERSION: ${{ env.CRANE_VERSION }} | |
| REPO_URL: "https://github.com/google/go-containerregistry" | |
| run: | | |
| set -euo pipefail | |
| URL="$REPO_URL/releases/download/v${CRANE_VERSION}/go-containerregistry_Linux_x86_64.tar.gz" | |
| curl -sSL "$URL" | sudo tar -xz -C /usr/local/bin crane | |
| crane version | |
| - name: Auth crane Source | |
| run: | | |
| echo "${{ secrets.GITHUB_TOKEN }}" | crane auth login ghcr.io --username=${{ github.actor }} --password-stdin | |
| - name: Auth crane Target | |
| run: | | |
| echo "${{ steps.auth.outputs.access_token }}" | crane auth login ${{ env.TARGET_REG }} --username=oauth2accesstoken --password-stdin | |
| - name: Build Image List | |
| shell: bash | |
| env: | |
| CI_COMMIT_REF_NAME: ${{ env.IMAGE_TAG }} | |
| run: | | |
| ./scripts/build-image-list.sh | |
| cat versions.txt | |
| - name: Copy Images to GCP Artifact Registry | |
| shell: bash | |
| env: | |
| TARGET_REG: "${{ env.TARGET_REG }}/${{ env.PROJECT_ID }}/${{ env.TARGET_REPO }}" | |
| run: | | |
| ./scripts/copy-images.sh "$TARGET_REG" versions.txt |