integration-gcp #520
This file contains 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: integration-gcp | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 12 * * *" | |
# push: | |
# branches: | |
# - main | |
permissions: | |
contents: read | |
jobs: | |
oci-test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
enable-workload-id: ["true", "false"] | |
fail-fast: false | |
defaults: | |
run: | |
working-directory: ./oci/tests/integration | |
steps: | |
- name: Checkout | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
- name: Setup Go | |
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 | |
with: | |
go-version: 1.23.x | |
cache-dependency-path: oci/tests/integration/go.sum | |
- name: Authenticate to Google Cloud | |
uses: google-github-actions/auth@62cf5bd3e4211a0a0b51f2c6d6a37129d828611d # v2.1.5 | |
id: 'auth' | |
with: | |
credentials_json: '${{ secrets.OCI_E2E_GOOGLE_CREDENTIALS }}' | |
token_format: 'access_token' | |
- name: Setup gcloud | |
uses: google-github-actions/setup-gcloud@f0990588f1e5b5af6827153b93673613abdc6ec7 # v2.1.1 | |
- name: Setup QEMU | |
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0 | |
- name: Setup Docker Buildx | |
uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3.6.1 | |
- name: Log into gcr.io | |
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0 | |
with: | |
registry: gcr.io | |
username: oauth2accesstoken | |
password: ${{ steps.auth.outputs.access_token }} | |
- name: Log into us-central1-docker.pkg.dev | |
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0 | |
with: | |
registry: us-central1-docker.pkg.dev | |
username: oauth2accesstoken | |
password: ${{ steps.auth.outputs.access_token }} | |
- name: Set dynamic variables in .env | |
run: | | |
cat > .env <<EOF | |
export TF_VAR_tags='{"environment"="github", "ci"="true", "repo"="pkg", "createdat"="$(date -u +x%Y-%m-%d_%Hh%Mm%Ss)"}' | |
EOF | |
- name: Print .env for dynamic tag value reference | |
run: cat .env | |
- name: Build test app | |
run: make docker-build | |
- name: Run tests | |
run: . .env && make test-gcp | |
env: | |
TF_VAR_gcp_project_id: ${{ vars.TF_VAR_gcp_project_id }} | |
TF_VAR_gcp_region: ${{ vars.TF_VAR_gcp_region }} | |
TF_VAR_gcp_zone: ${{ vars.TF_VAR_gcp_zone }} | |
TF_VAR_enable_wi: ${{ matrix.enable-workload-id }} | |
TF_VAR_wi_k8s_sa_name: test-workload-id | |
TF_VAR_wi_k8s_sa_ns: default | |
- name: Ensure resource cleanup | |
if: ${{ always() }} | |
run: . .env && make destroy-gcp | |
env: | |
TF_VAR_gcp_project_id: ${{ vars.TF_VAR_gcp_project_id }} | |
TF_VAR_gcp_region: ${{ vars.TF_VAR_gcp_region }} | |
TF_VAR_gcp_zone: ${{ vars.TF_VAR_gcp_zone }} | |
TF_VAR_enable_wi: ${{ matrix.enable-workload-id }} | |
TF_VAR_wi_k8s_sa_name: test-workload-id | |
TF_VAR_wi_k8s_sa_ns: default |