Skip to content

ROX-27073: github action for multicluster test #15

ROX-27073: github action for multicluster test

ROX-27073: github action for multicluster test #15

name: Multicluster E2E tests
on:
push:
branches:
- main
paths-ignore:
- 'fleetshard/pkg/runtime/**'
- 'fleetshard/pkg/reconciler/**'
- '.github/workflows/multicluster-e2e.yaml'
- 'scripts/ci/**'
- 'scripts/lib/**'
- 'internal/pkg/handlers/admin_dinosaur.go'
- 'internal/dinosaur/pkg/services/dinosaur.go'
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
paths:
- 'fleetshard/pkg/runtime/**'
- 'fleetshard/pkg/reconciler/**'
- '.github/workflows/multicluster-e2e.yaml'
- 'scripts/ci/**'
- 'scripts/lib/**'
- 'internal/pkg/handlers/admin_dinosaur.go'
- 'internal/dinosaur/pkg/services/dinosaur.go'
jobs:
# create-cluster:
# name: "Create Test Infra Clusters"
# runs-on: ubuntu-latest
# if: ${{ !github.event.pull_request.head.repo.fork && !github.event.pull_request.draft }} # do not run for PRs from forks and drafts
# environment: development
# strategy:
# matrix:
# name: [mctest1, mctest2]
# steps:
# - name: Set commit short ref
# id: commit-ref
# # did not use git rev-parse here because it requires a checkout before
# run: echo "GIT_SHORT_REF=$(echo ${{ github.sha }} | cut -c 1-7)" >> "$GITHUB_OUTPUT"
# - name: Create cluster
# uses: stackrox/actions/infra/create-cluster@v1
# with:
# token: ${{ secrets.INFRA_TOKEN }}
# flavor: osd-on-aws
# name: acscs-${{ matrix.name }}-${{ steps.commit-ref.outputs.GIT_SHORT_REF }}
# lifespan: 3h
# args: nodes=3,machine-type=m5.2xlarge
# wait: true
e2e-test:
name: "Multicluster e2e tests"
runs-on: ubuntu-latest
if: ${{ !github.event.pull_request.head.repo.fork && !github.event.pull_request.draft }} # do not run for PRs from forks and drafts
# needs: [create-cluster]
environment: development
permissions:
id-token: write
contents: read
steps:
- name: Install infractl
uses: stackrox/actions/infra/install-infractl@v1
- name: Check out code
uses: actions/checkout@v4
- name: Set commit short ref
# did not use git rev-parse here because it requires a checkout before
# run: echo "GIT_SHORT_REF=$(echo ${{ github.sha }} | cut -c 1-7)" >> "$GITHUB_ENV"
run: echo "GIT_SHORT_REF=a2431d5" >> "$GITHUB_ENV"
- name: Set cluster credentials
env:
INFRA_TOKEN: ${{ secrets.INFRA_TOKEN }}
run: |
set -eo pipefail
mkdir kube
cluster1Conf="$(pwd)/kube/cluster1"
url=$(infractl artifacts "acscs-mctest1-$GIT_SHORT_REF" --json | jq '.Artifacts[] | select(.Name=="kubeconfig") | .URL' -r)
wget -O "$cluster1Conf" "$url"
cluster2Conf="$(pwd)/kube/cluster2"
url=$(infractl artifacts "acscs-mctest2-$GIT_SHORT_REF" --json | jq '.Artifacts[] | select(.Name=="kubeconfig") | .URL' -r)
wget -O "$cluster2Conf" "$url"
echo "CLUSTER_1_KUBECONFIG=$cluster1Conf" >> "$GITHUB_ENV"
echo "CLUSTER_2_KUBECONFIG=$cluster2Conf" >> "$GITHUB_ENV"
- name: Configure AWS credentials
uses: aws-actions/[email protected]
with:
aws-region: ${{ secrets.AWS_REGION }}
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/github
- name: "Run"
run: "scripts/ci/multicluster_tests/entrypoint.sh"
# cleanup-clusters:
# name: "Cleanup Test Infra Clusters"
# runs-on: ubuntu-latest
# needs: [create-cluster]
# if: ${{ !github.event.pull_request.head.repo.fork && !github.event.pull_request.draft && always() }} # do not run for PRs from forks
# environment: development
# env:
# INFRA_TOKEN: ${{ secrets.INFRA_TOKEN }}
# steps:
# - name: Install infractl
# uses: stackrox/actions/infra/install-infractl@v1
# - name: Set commit short ref
# # did not use git rev-parse here because it requires a checkout before
# run: echo "GIT_SHORT_REF=$(echo ${{ github.sha }} | cut -c 1-7)" >> "$GITHUB_ENV"
# - name: Delete test clusters
# run: |
# set -o pipefail
# infractl delete "acscs-mctest1-$GIT_SHORT_REF"
# infractl delete "acscs-mctest2-$GIT_SHORT_REF"