test base images #86
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: test base images | |
on: | |
pull_request_target: | |
types: | |
- labeled | |
- opened | |
- synchronize | |
# Enable manual invocation of this workflow GitHub Actions GUI | |
workflow_dispatch: | |
inputs: | |
os: | |
description: "The OS to run the integration test with" | |
type: choice | |
required: true | |
options: | |
- all | |
- ubuntu-20 | |
- ubuntu-22 | |
- rocky-8.7 | |
- rocky-9.1 | |
- centos-7.9 | |
- rhel-7.9 | |
- rhel-8.4 | |
- rhel-8.6 | |
- rhel-8.8 | |
- rhel-8.10 | |
- rhel-9.4 | |
- oraclelinux-9.4 | |
- flatcar-3033.3.16 | |
env: | |
VSPHERE_USERNAME: ${{ secrets.VSPHERE_NKP_SRE_USERNAME }} | |
VSPHERE_PASSWORD: ${{ secrets.VSPHERE_SRE_PASSWORD }} | |
VSPHERE_SERVER: ${{ secrets.VSPHERE_NKP_SERVER }} | |
GOVC_URL: ${{ secrets.VSPHERE_NKP_SRE_USERNAME }}:${{ secrets.VSPHERE_SRE_PASSWORD }}@${{ secrets.VSPHERE_NKP_SERVER }} | |
PKR_VAR_vsphere_cluster: ${{ secrets.VSPHERE_CLUSTER }} | |
PKR_VAR_vsphere_datacenter: ${{ secrets.VSPHERE_DATACENTER }} | |
PKR_VAR_vsphere_datastore: ${{ secrets.VSPHERE_NKP_DATASTORE }} | |
PKR_VAR_vsphere_network: ${{ secrets.VSPHERE_NKP_NETWORK }} | |
PKR_VAR_vsphere_resource_pool: ${{ secrets.VSPHERE_RESOURCE_POOL }} | |
RHN_SUBSCRIPTION_ORG: ${{ secrets.RHN_SUBSCRIPTION_ORG }} | |
RHN_SUBSCRIPTION_KEY: ${{ secrets.RHN_SUBSCRIPTION_KEY }} | |
jobs: | |
# Build matrix to test when label integration_test is added to PR or manually invoked. | |
build_list: | |
runs-on: | |
- self-hosted-nutanix-medium | |
strategy: | |
fail-fast: false | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
steps: | |
- name: Build OS matrix for all OS | |
if: contains(github.event.pull_request.labels.*.name, 'integration_test') || contains(fromJson('["workflow_dispatch"]'), github.event_name) && github.event.inputs.os == 'all' | |
id: build-os-matrix | |
run: | | |
echo "buildmatrix=$(jq -cn --arg os_list 'ubuntu-20,ubuntu-22,rocky-8.7,rocky-9.1,centos-7.9,rhel-7.9,rhel-8.4,rhel-8.6,rhel-8.8,rhel-8.10,rhel-9.4,oraclelinux-9.4,flatcar-3033.3.16' '{os: $os_list | split(",")}')" >> $GITHUB_ENV | |
- name: Build OS matrix for single OS | |
if: contains(fromJson('["workflow_dispatch"]'), github.event_name) && github.event.inputs.os != 'all' | |
id: build-os-matrix-single | |
run: | | |
echo "buildmatrix=$(jq -cn --arg os_list '${{ github.event.inputs.os }}' '{os: $os_list | split(",")}')" >> $GITHUB_ENV | |
- name: Empty OS matrix | |
id: empty-os-matrix | |
run: | | |
echo "buildmatrix=$(jq -cn --arg os_list '' '{os: $os_list | split(",")}')" >> $GITHUB_ENV | |
- name: Set matrix output | |
id: set-matrix | |
run: | | |
echo 'matrix=${{ env.buildmatrix }}' >> $GITHUB_OUTPUT | |
base_image_tests: | |
runs-on: | |
- self-hosted-nutanix-medium | |
needs: build_list | |
strategy: | |
fail-fast: false | |
matrix: ${{fromJson(needs.build_list.outputs.matrix)}} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
ref: "${{ github.event.pull_request.head.sha }}" | |
- name: Setup requirements | |
run: | | |
sudo apt-get update && sudo apt-get -y install xorriso | |
curl -L -o - "https://github.com/vmware/govmomi/releases/latest/download/govc_$(uname -s)_$(uname -m).tar.gz" | sudo tar -C /usr/local/bin -xvzf - govc | |
- name: Run integration tests for ${{ matrix.os }} | |
run: make ${{ matrix.os }}-test |