Skip to content

daily e2e tests for ibmcloud #41

daily e2e tests for ibmcloud

daily e2e tests for ibmcloud #41

# (C) Copyright Confidential Containers Contributors 2023.
# SPDX-License-Identifier: Apache-2.0
#
# Build and push container images for each cloud provider.
---
name: daily e2e tests for ibmcloud
on:
schedule:
# Runs "at 05:00(UTC time) every day" (see https://crontab.guru)
# will base on default branch `main`
- cron: '0 5 * * *'
workflow_dispatch:
jobs:
daily-e2e-tests:
name: e2e tests
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- type: amd64
- type: s390x-non-secure-execution
- type: s390x-secure-execution
- type: csi_wrapper_x86_64
steps:
- name: Checkout the code
uses: actions/checkout@v3
- name: Install dependencies
run: |
sudo apt-get update -y
sudo apt-get install -y curl
sudo curl -fsSL https://clis.cloud.ibm.com/install/linux | sh
echo "Install IBM Cloud CLI"
curl -fsSL https://clis.cloud.ibm.com/install/linux | sh
echo "Install COS Plugin"
ibmcloud plugin install cloud-object-storage -f
- name: Config IBM COS
run: |
ibmcloud cos config crn --crn $crn --force | grep -v ^FAILED$ || exit 1
ibmcloud cos config auth --method HMAC | grep -v ^FAILED$ || exit 1
echo -e $access_key_id "\n" $secret_access_key | ibmcloud cos config hmac
ibmcloud cos config endpoint-url --url $endpoint | grep -v ^FAILED$ || exit 1
ibmcloud cos config list
env:
crn: ${{ secrets.IBM_E2E_COS_CRN }}
endpoint: "https://s3.jp-tok.cloud-object-storage.appdomain.cloud"
access_key_id: ${{ secrets.IBM_E2E_COS_ACCESS_KEY_ID }}
secret_access_key: ${{ secrets.IBM_E2E_COS_SECRET_ACCESS_KEY }}
- name: Check e2e test result
run: |
date_name=$(date +"%y%m%d")
echo $date_name
log_name=$(ibmcloud cos objects --bucket $bucket_name |grep $date_name |grep ${{matrix.type}} | awk 'END { print $1 }')
echo $log_name
ibmcloud cos object-get --bucket daily-e2e-test-bucket --key=$log_name $log_name
cat $log_name
last_line=$(awk 'END {print}' $log_name)
if [[ $last_line = "Finished: SUCCESS" ]]; then
echo "ibmcloud e2e test (${{matrix.type}}) is passed."
else
echo "ibmcloud e2e test (${{matrix.type}}) is failed."
exit 2
fi
caa_commitid=$(cat $log_name | grep -oP 'CAA commit_id: \K\S+')
echo "The CAA commit_id: ${caa_commitid}"
echo ${caa_commitid} > caa_commitid
env:
bucket_name : "daily-e2e-test-bucket"
- name: Login to Quay container Registry
uses: docker/login-action@v2
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
- name: Download and Push podvm ubuntu oci image
run: |
caa_commit_id=$(cat caa_commitid)
echo "The built podvm image is based on CAA commit_id: ${caa_commit_id}"
arch_string=""
podvm_docker_name=""
if [[ "${{matrix.type}}" != "csi_wrapper_x86_64" ]]; then
case "${{matrix.type}}" in
amd64)
arch_string="amd64"
;;
s390x-non-secure-execution)
arch_string="s390x"
;;
s390x-secure-execution)
arch_string="s390x-se"
;;
esac
podvm_image_tar_name="podvm-generic-ubuntu-${arch_string}-${caa_commit_id}.tar"
podvm_docker_name="quay.io/confidential-containers/podvm-generic-ubuntu-${arch_string}:${caa_commit_id}"
ibmcloud cos object-get --bucket daily-e2e-test-bucket --key=$podvm_image_tar_name $podvm_image_tar_name
docker load -i $podvm_image_tar_name
docker push ${podvm_docker_name}
echo "${podvm_docker_name} is pushed"
fi
env:
bucket_name : "daily-e2e-test-bucket"