Skip to content

test base images

test base images #91

Workflow file for this run

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
- os-ubuntu
- rocky-8.7
- rocky-9.1
- os-rocky
- centos-7.9
- os-centos
- rhel-7.9
- rhel-8.4
- rhel-8.6
- rhel-8.8
- rhel-8.10
- rhel-9.4
- os-rhel
- oraclelinux-9.4
- os-oraclelinux
- flatcar-3033.3.16
- os-flatcar
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: |
DYNAMICOSLIST=$(make list-os-versions | head -c -1 | tr '\n' ',')
echo "buildmatrix=$(jq -cn --arg os_list $DYNAMICOSLIST '{os: $os_list | split(",")}')" >> $GITHUB_ENV
- name: Build OS matrix for distro (os prefix)
if: contains(fromJson('["workflow_dispatch"]'), github.event_name) && contains(github.event.inputs.os, 'os-')
id: build-os-matrix-distro
run: |
DYNAMICOSLIST=$(make list-os-versions | grep -E "^${{ github.event.inputs.os }}" | head -c -1 | tr '\n' ',')
echo "buildmatrix=$(jq -cn --arg os_list $DYNAMICOSLIST '{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' && !contains(github.event.inputs.os, 'os-')
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
if: ${{ !contains(fromJson('["workflow_dispatch"]'), github.event_name) }}
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
# if matrix os is empty, skip this job
if: ${{fromJson(needs.build_list.outputs.matrix)}}.os != []
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