Skip to content

Commit

Permalink
SecureComms: Add testing facility for e2e tests
Browse files Browse the repository at this point in the history
Modify the .github/workflow files to enable addting e2e tests for secure
comms.

Signed-off-by: David Hadas <david.hadas@gmail.com>
  • Loading branch information
davidhIBM committed Oct 22, 2024
1 parent b5542aa commit 9480971
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 2 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/e2e_libvirt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ on:
description: Git ref to checkout the cloud-api-adaptor repository. Defaults to main.
required: false
type: string

secure_comms:
default: 'none'
description: SecureComms configuration. Defaults to none.
required: false
type: string
env:
CLOUD_PROVIDER: libvirt
DEBIAN_FRONTEND: noninteractive
Expand Down Expand Up @@ -84,7 +88,8 @@ jobs:

- name: Config Libvirt
run: |
./libvirt/config_libvirt.sh
echo "secure_comms=\"${{ inputs.secure_comms }}\""
./libvirt/config_libvirt.sh ${{ inputs.secure_comms }}
echo "CAA_IMAGE=\"${{ inputs.caa_image }}\"" >> libvirt.properties
# For debugging
cat libvirt.properties
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/e2e_run_all.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ jobs:
prep_install:
needs: [image]
runs-on: ubuntu-latest
outputs:
securecomms: ${{ steps.securecomms.outputs.securecomms }}
env:
PROVIDERS: "libvirt"
steps:
Expand Down Expand Up @@ -148,6 +150,11 @@ jobs:
path: src/cloud-api-adaptor/install/
retention-days: 7

- name: Define Secure Comms Test Configs
id: securecomms
run: |
./src/cloud-api-adaptor/libvirt/config_libvirt.sh >> "$GITHUB_OUTPUT"
# Run libvirt e2e tests if pull request labeled 'test_e2e_libvirt'
libvirt:
name: libvirt
Expand All @@ -165,10 +172,12 @@ jobs:
- generic
arch:
- amd64
secure_comms: ${{ fromJSON(needs.prep_install.outputs.securecomms) }}
uses: ./.github/workflows/e2e_libvirt.yaml
with:
caa_image: ${{ inputs.registry }}/cloud-api-adaptor:${{ inputs.caa_image_tag }}-dev
podvm_image: ${{ inputs.registry }}/podvm-${{ matrix.provider }}-${{ matrix.os }}-${{ matrix.arch }}:${{ inputs.podvm_image_tag }}
install_directory_artifact: install_directory
git_ref: ${{ inputs.git_ref }}
secure_comms: ${{ matrix.secure_comms }}
secrets: inherit
20 changes: 20 additions & 0 deletions src/cloud-api-adaptor/libvirt/config_libvirt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,18 @@ installK8sclis() {
fi
}

if [ $# -lt 1 ]
then
# If no param provided spell out the list of e2e options for testing securecomms and exit
# github workflow will use this as a matrix for testing
echo 'securecomms=["none"]'
exit 0
else
SECURE_COMMS=$1
fi

echo "SECURE_COMMS is ${SECURE_COMMS}"

echo "Installing Go..."
installGolang
echo "Installing Libvirt..."
Expand All @@ -118,3 +130,11 @@ rm -f libvirt.properties
echo "libvirt_uri=\"qemu+ssh://${USER}@${IP}/system?no_verify=1\"" >> libvirt.properties
echo "libvirt_ssh_key_file=\"id_rsa\"" >> libvirt.properties
echo "CLUSTER_NAME=\"peer-pods\"" >> libvirt.properties

# switch to the appropriate e2e test and add configs to libvirt.properties as needed
case $SECURE_COMMS in

*)
echo "processing none"
;;
esac

0 comments on commit 9480971

Please sign in to comment.