-
Notifications
You must be signed in to change notification settings - Fork 88
134 lines (131 loc) · 5.88 KB
/
daily-e2e-tests-ibmcloud.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# (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:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
daily-e2e-tests:
name: e2e tests
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
include:
- type: s390x-non-secure-execution
- type: libvirt_amd64
- type: libvirt_s390x
- type: ibmse
steps:
- name: Checkout the code
uses: actions/checkout@v4
- 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=$(< "$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@v3
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
- name: Download and Push podvm oci images
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}}" == "libvirt_amd64" ]] || [[ "${{matrix.type}}" == "libvirt_s390x" ]]; then
case "${{matrix.type}}" in
libvirt_amd64)
arch_string="amd64"
;;
libvirt_s390x)
arch_string="s390x"
;;
esac
echo "Checking built out generic ubuntu ${arch_string} docker images"
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}"
manifest_url="https://quay.io/v2/confidential-containers/podvm-generic-ubuntu-${arch_string}/manifests/${caa_commit_id}"
curl -I --silent "${manifest_url}" > header.txt
if grep -q "HTTP/2 200" "header.txt"; then
echo "${podvm_docker_name} exists."
else
echo "downloading ${podvm_image_tar_name}"
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
fi
if [[ "${{matrix.type}}" == "ibmse" ]]; then
echo "Checking built out generic fedora s390x se enabled docker image"
podvm_image_tar_name="podvm-generic-fedora-s390x-se-${caa_commit_id}.tar"
echo "Checkouting commit: ${caa_commit_id}"
git checkout "${caa_commit_id}"
image_tag=$(sha256sum src/cloud-api-adaptor/versions.yaml | awk -F " " '{ print $1 }')
echo "fedora s390x se image tag: $image_tag"
podvm_docker_name="quay.io/confidential-containers/podvm-generic-fedora-s390x-se:${image_tag}"
manifest_url="https://quay.io/v2/confidential-containers/podvm-generic-fedora-s390x-se/manifests/${image_tag}"
curl -I --silent "${manifest_url}" > header.txt
if grep -q "HTTP/2 200" "header.txt"; then
echo "${podvm_docker_name} exists."
else
echo "downloading ${podvm_image_tar_name}"
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"
echo "show docker images"
docker images
echo docker push "${podvm_docker_name}"
echo "${podvm_docker_name} is pushed"
fi
fi
env:
bucket_name : "daily-e2e-test-bucket"