From 1e43528741a976427d6ef56a15a86c116cec79fb Mon Sep 17 00:00:00 2001 From: supershal Date: Mon, 6 Nov 2023 16:09:04 -0800 Subject: [PATCH] ci: create composite workflow for aws e2e tests --- .github/composite/aws-e2e/action.yaml | 75 ++++++++ .github/workflows/aws-e2e.yaml | 239 +++++++++++--------------- 2 files changed, 180 insertions(+), 134 deletions(-) create mode 100644 .github/composite/aws-e2e/action.yaml diff --git a/.github/composite/aws-e2e/action.yaml b/.github/composite/aws-e2e/action.yaml new file mode 100644 index 000000000..cb83c3a0a --- /dev/null +++ b/.github/composite/aws-e2e/action.yaml @@ -0,0 +1,75 @@ +# Runs AWS tests when pull request opened, repopened or synchronized +name: Build AWS AMI +description: "Common setup steps to create aws AMI" +inputs: + os: + description: "Name of the operating system" + required: true + buildConfig: + description: "Build configuation options" + required: true + registry_mirror_url: + description: "Registry Mirror URL" + required: true + docker_username: + description: "DockerHub username" + required: true + docker_password: + description: "DockerHub password" + required: true + aws_runner_role_arn: + description: "AWS role for runners to assume" + required: true + redhat_user: + description: "RedHat username" + redhat_password: + description: "RedHat password" + github_token: + description: "Github token to use with workflow" + required: true + +runs: + using: "composite" + steps: + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version-file: 'go.mod' + cache: true + + - name: Setup buildkit + uses: docker/setup-buildx-action@v2 + + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v4 + with: + role-to-assume: ${{ inputs.aws_runner_role_arn }} + aws-region: us-west-2 + + - name: Login to dockerhub Registry + uses: docker/login-action@v3 + with: + username: ${{ inputs.docker_username }} + password: ${{ inputs.docker_password }} + + - name: Login to D2iQ's Mirror Registry + uses: docker/login-action@v3 + with: + registry: ${{ inputs.registry_mirror_url }} + username: ${{ inputs.docker_username }} + password: ${{ inputs.docker_password }} + + - name: Run E2E test for ${{ inputs.os }} with ${{ inputs.buildConfig }} configuration + uses: magefile/mage-action@v3 + with: + version: latest + args: runE2e "${{ inputs.os }}" "${{ inputs.buildConfig }}" aws true + env: + GITHUB_TOKEN: ${{ inputs.github_token}} + RHSM_USER: ${{ inputs.redhat_user }} + RHSM_PASS: ${{ inputs.redhat_password }} + + - name: Run make destroy to clean up failed tests + if: ${{ always() }} + run: make infra.aws.destroy || true + shell: bash diff --git a/.github/workflows/aws-e2e.yaml b/.github/workflows/aws-e2e.yaml index 4c79dd645..4bf0bbd2a 100644 --- a/.github/workflows/aws-e2e.yaml +++ b/.github/workflows/aws-e2e.yaml @@ -2,6 +2,7 @@ name: E2E Tests - Build AWS AMI on: workflow_dispatch: + workflow_call: permissions: @@ -16,100 +17,100 @@ jobs: matrix: include: # CentoOS 7.9 + # - os: "centos 7.9" + # buildConfig: "basic" + # - os: "centos 7.9" + # buildConfig: "fips" + # - os: "centos 7.9" + # buildConfig: "nvidia" - os: "centos 7.9" - buildConfig: "basic" - - os: "centos 7.9" - buildConfig: "fips" - - os: "centos 7.9" - buildConfig: "nvidia" - - os: "centos 7.9" - buildConfig: "offline" - - os: "centos 7.9" - buildConfig: "offline-fips" - - os: "centos 7.9" - buildConfig: "offline-nvidia" - # RHEL 7.9 - - os: "redhat 7.9" - buildConfig: "basic" - - os: "redhat 7.9" - buildConfig: "fips" - - os: "redhat 7.9" - buildConfig: "nvidia" - - os: "redhat 7.9" - buildConfig: "offline" - - os: "redhat 7.9" - buildConfig: "offline-fips" - - os: "redhat 7.9" - buildConfig: "offline-nvidia" - # RHEL 8.4 - - os: "redhat 8.4" - buildConfig: "basic" - - os: "redhat 8.4" - buildConfig: "fips" - - os: "redhat 8.4" - buildConfig: "nvidia" - - os: "redhat 8.4" - buildConfig: "offline" - - os: "redhat 8.4" - buildConfig: "offline-fips" - - os: "redhat 8.4" - buildConfig: "offline-nvidia" - # RHEL 8.6 - - os: "redhat 8.6" - buildConfig: "basic" - - os: "redhat 8.6" - buildConfig: "fips" - - os: "redhat 8.6" - buildConfig: "nvidia" - - os: "redhat 8.6" - buildConfig: "offline" - - os: "redhat 8.6" - buildConfig: "offline-fips" - - os: "redhat 8.6" - buildConfig: "offline-nvidia" - # RHEL 8.8 - - os: "redhat 8.8" - buildConfig: "basic" - - os: "redhat 8.8" - buildConfig: "fips" - - os: "redhat 8.8" - buildConfig: "fips-kernel" - - os: "redhat 8.8" - buildConfig: "nvidia" - - os: "redhat 8.8" - buildConfig: "offline" - - os: "redhat 8.8" - buildConfig: "offline-fips" - - os: "redhat 8.8" - buildConfig: "offline-nvidia" - # SLES 15 - - os: "sles 15" - buildConfig: "basic" - - os: "sles 15" - buildConfig: "nvidia" - # Oracle 7.9 - - os: "oracle 7.9" - buildConfig: "basic" - - os: "oracle 7.9" - buildConfig: "fips" - - os: "oracle 7.9" - buildConfig: "rhck" - # Flatcar - - os: "flatcar" - buildConfig: "basic" - # Ubuntu 18.04 - - os: "ubuntu 18.04" - buildConfig: "basic" - # Ubuntu 20.04 - - os: "ubuntu 20.04" - buildConfig: "basic" - - os: "ubuntu 20.04" - buildConfig: "nvidia" - # Rocky 9.1 - - os: "rocky 9.1" - buildConfig: "basic" - - os: "rocky 9.1" buildConfig: "offline" + # - os: "centos 7.9" + # buildConfig: "offline-fips" + # - os: "centos 7.9" + # buildConfig: "offline-nvidia" + # # RHEL 7.9 + # - os: "redhat 7.9" + # buildConfig: "basic" + # - os: "redhat 7.9" + # buildConfig: "fips" + # - os: "redhat 7.9" + # buildConfig: "nvidia" + # - os: "redhat 7.9" + # buildConfig: "offline" + # - os: "redhat 7.9" + # buildConfig: "offline-fips" + # - os: "redhat 7.9" + # buildConfig: "offline-nvidia" + # # RHEL 8.4 + # - os: "redhat 8.4" + # buildConfig: "basic" + # - os: "redhat 8.4" + # buildConfig: "fips" + # - os: "redhat 8.4" + # buildConfig: "nvidia" + # - os: "redhat 8.4" + # buildConfig: "offline" + # - os: "redhat 8.4" + # buildConfig: "offline-fips" + # - os: "redhat 8.4" + # buildConfig: "offline-nvidia" + # # RHEL 8.6 + # - os: "redhat 8.6" + # buildConfig: "basic" + # - os: "redhat 8.6" + # buildConfig: "fips" + # - os: "redhat 8.6" + # buildConfig: "nvidia" + # - os: "redhat 8.6" + # buildConfig: "offline" + # - os: "redhat 8.6" + # buildConfig: "offline-fips" + # - os: "redhat 8.6" + # buildConfig: "offline-nvidia" + # # RHEL 8.8 + # - os: "redhat 8.8" + # buildConfig: "basic" + # - os: "redhat 8.8" + # buildConfig: "fips" + # - os: "redhat 8.8" + # buildConfig: "fips-kernel" + # - os: "redhat 8.8" + # buildConfig: "nvidia" + # - os: "redhat 8.8" + # buildConfig: "offline" + # - os: "redhat 8.8" + # buildConfig: "offline-fips" + # - os: "redhat 8.8" + # buildConfig: "offline-nvidia" + # # SLES 15 + # - os: "sles 15" + # buildConfig: "basic" + # - os: "sles 15" + # buildConfig: "nvidia" + # # Oracle 7.9 + # - os: "oracle 7.9" + # buildConfig: "basic" + # - os: "oracle 7.9" + # buildConfig: "fips" + # - os: "oracle 7.9" + # buildConfig: "rhck" + # # Flatcar + # - os: "flatcar" + # buildConfig: "basic" + # # Ubuntu 18.04 + # - os: "ubuntu 18.04" + # buildConfig: "basic" + # # Ubuntu 20.04 + # - os: "ubuntu 20.04" + # buildConfig: "basic" + # - os: "ubuntu 20.04" + # buildConfig: "nvidia" + # # Rocky 9.1 + # - os: "rocky 9.1" + # buildConfig: "basic" + # - os: "rocky 9.1" + # buildConfig: "offline" runs-on: - self-hosted - small @@ -119,46 +120,16 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 - ref: ${{ github.ref }} - - - name: Set up Go - uses: actions/setup-go@v4 + + - name: Build AWS AMI for ${{ matrix.os }} with ${{ matrix.buildConfig }} configuration + uses: ./.github/composite/aws-e2e/ with: - go-version-file: 'go.mod' - cache: true - - - name: Login to dockerhub Registry - uses: docker/login-action@v3 - with: - username: ${{ secrets.NEXUS_USERNAME }} - password: ${{ secrets.NEXUS_PASSWORD }} - - - name: Login to D2iQ's Mirror Registry - uses: docker/login-action@v3 - with: - registry: ${{ secrets.D2IQ_DOCKER_MIRROR_REGISTRY}} - username: ${{ secrets.NEXUS_USERNAME }} - password: ${{ secrets.NEXUS_PASSWORD }} - - - name: Setup buildkit - uses: docker/setup-buildx-action@v2 - - - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v4 - with: - role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/konvoy-image-builder - aws-region: us-west-2 - - - name: Run E2E test for ${{ matrix.os }} with ${{ matrix.buildConfig }} configuration - uses: magefile/mage-action@v3 - with: - version: latest - args: runE2e "${{ matrix.os }}" "${{ matrix.buildConfig }}" aws true - env: - GITHUB_TOKEN: ${{ secrets.MESOSPHERECI_USER_TOKEN }} - RHSM_USER: ${{ secrets.RHSM_USER }} - RHSM_PASS: ${{ secrets.RHSM_PASS }} - - - name: Run make destroy to clean up failed tests - if: ${{ always() }} - run: make infra.aws.destroy || true + os: ${{ matrix.os }} + buildConfig: ${{ matrix.buildConfig}} + registry_mirror_url: ${{ secrets.D2IQ_DOCKER_MIRROR_REGISTRY}} + docker_username: ${{ secrets.NEXUS_USERNAME }} + docker_password: ${{ secrets.NEXUS_PASSWORD }} + aws_runner_role_arn: "arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/konvoy-image-builder" + redhat_user: ${{ secrets.RHSM_USER }} + redhat_password: ${{ secrets.RHSM_PASS }} + github_token: ${{ secrets.MESOSPHERECI_USER_TOKEN }}