chore: map gh user to a role #4
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 - AWS | |
| on: | |
| workflow_dispatch: {} # allow manual runs for testing | |
| schedule: | |
| - cron: '45 14 * * *' # daily at 14:45 UTC, runs on default branch only | |
| push: | |
| branches: | |
| - main | |
| - feature/uat-aws | |
| permissions: | |
| contents: read | |
| actions: read | |
| id-token: write | |
| jobs: | |
| integration-test-aws: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 60 | |
| env: | |
| CSP: "aws" | |
| PREFIX: "nvs" | |
| AWS_ACCOUNT_ID: "528757803597" # Replace with actual account ID | |
| AWS_REGION: "us-west-2" | |
| GITHUB_ACTIONS_ROLE_NAME: "github-actions-role" | |
| GITHUB_ACTIONS_ROLE_ARN: "arn:aws:iam::528757803597:role/github-actions-role" # Replace with actual role ARN | |
| OIDC_PROVIDER_ARN: "arn:aws:iam::528757803597:oidc-provider/token.actions.githubusercontent.com" | |
| CLUSTER_NAME: "nvs-d${{ github.run_id }}" | |
| K8S_VERSION: "1.34" | |
| GPU_NODE_COUNT: "1" | |
| GPU_AVAILABILITY_ZONE: "us-west-2e" | |
| # Debug | |
| SKIP_DELETE: "false" # skip cluster deletion | |
| TEST_TAG: "main-33c1d03" | |
| steps: | |
| # Checkout | |
| - name: Checkout | |
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| # Terraform | |
| - name: Terraform | |
| uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2 | |
| with: | |
| terraform_version: "1.13.5" | |
| # Auth | |
| - name: Configure AWS credentials | |
| id: auth | |
| uses: aws-actions/configure-aws-credentials@00943011d9042930efac3dcd3a170e4273319bc8 # v5.1.0 | |
| with: | |
| role-to-assume: ${{ env.GITHUB_ACTIONS_ROLE_ARN }} | |
| aws-region: ${{ env.AWS_REGION }} | |
| role-session-name: GitHubActions-NVSentinel-Integration | |
| # Cluster | |
| - name: Create Cluster | |
| id: cluster | |
| shell: bash | |
| continue-on-error: true | |
| run: | | |
| set -euo pipefail | |
| tests/uat/aws/create-eks-cluster.sh | |
| # Connect | |
| - name: Connect to Cluster | |
| id: client | |
| if: steps.cluster.outcome == 'success' | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| echo "Installing kubectl..." | |
| curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" | |
| chmod +x kubectl | |
| sudo mv kubectl /usr/local/bin/ | |
| echo "Updating kubeconfig..." | |
| aws eks update-kubeconfig --region ${{ env.AWS_REGION }} --name ${{ env.CLUSTER_NAME }} | |
| echo "Verifying cluster connection..." | |
| kubectl get nodes | |
| # Image Tag | |
| - name: Compute ref name with short SHA | |
| id: ref-name | |
| run: | | |
| if [[ "${{ github.ref_type }}" == "tag" ]]; then | |
| SAFE_REF="${{ github.ref_name }}" | |
| elif [[ "${{ github.ref_name }}" == "main" ]]; then | |
| SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-7) | |
| SAFE_REF="${{ github.ref_name }}-${SHORT_SHA}" | |
| else | |
| SAFE_REF="${{ env.TEST_TAG }}" | |
| fi | |
| # Sanitize ref name: replace slashes with hyphens for Docker tag compatibility | |
| SAFE_REF=$(echo "$SAFE_REF" | sed 's/\//-/g') | |
| echo "value=$SAFE_REF" >> $GITHUB_OUTPUT | |
| # Apps | |
| - name: Install NVS | |
| id: apps | |
| if: steps.client.outcome == 'success' | |
| shell: bash | |
| env: | |
| NVSENTINEL_VERSION: "${{ steps.ref-name.outputs.value }}" | |
| run: | | |
| set -euxo pipefail | |
| tests/uat/install-apps.sh | |
| # Test | |
| - name: Run UAT Tests | |
| id: tests | |
| if: steps.apps.outcome == 'success' | |
| shell: bash | |
| run: | | |
| set -euxo pipefail | |
| tests/uat/tests.sh | |
| # Teardown | |
| - name: Destroy Cluster | |
| if: always() && steps.cluster.outcome != 'skipped' && env.SKIP_DELETE != 'true' | |
| shell: bash | |
| run: | | |
| set -euxo pipefail | |
| tests/uat/aws/delete-eks-cluster.sh | |
| # Summary | |
| - name: Test Summary | |
| if: always() | |
| run: | | |
| echo "## Test Results" >> $GITHUB_STEP_SUMMARY | |
| echo "- Cluster: ${{ steps.cluster.outcome }}" >> $GITHUB_STEP_SUMMARY | |
| echo "- Connection: ${{ steps.client.outcome }}" >> $GITHUB_STEP_SUMMARY | |
| echo "- Apps: ${{ steps.apps.outcome }}" >> $GITHUB_STEP_SUMMARY | |
| echo "- Tests: ${{ steps.tests.outcome }}" >> $GITHUB_STEP_SUMMARY |