Skip to content

Commit

Permalink
ci: create composite workflow for aws e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
supershal committed Nov 7, 2023
1 parent 37ac8de commit 1e43528
Show file tree
Hide file tree
Showing 2 changed files with 180 additions and 134 deletions.
75 changes: 75 additions & 0 deletions .github/composite/aws-e2e/action.yaml
Original file line number Diff line number Diff line change
@@ -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
239 changes: 105 additions & 134 deletions .github/workflows/aws-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
name: E2E Tests - Build AWS AMI
on:
workflow_dispatch:

workflow_call:

permissions:
Expand All @@ -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
Expand All @@ -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 }}

0 comments on commit 1e43528

Please sign in to comment.