-
Notifications
You must be signed in to change notification settings - Fork 82
164 lines (139 loc) · 5.26 KB
/
test_published_images.yml
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
name: Test published images
on:
# TODO REMOVE
pull_request:
workflow_dispatch:
inputs:
IMAGE_VERSION:
required: true
description: A version, `latest` etc
EXPECTED_HZ_VERSION:
required: true
env:
CONTAINER_NAME: my-container
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
variant:
- ''
- 'slim'
jdk:
- ''
- jdk17
- jdk21
distribution_type:
# TODO SKip OS if patch
- oss
- ee
steps:
- name: Checkout Code
uses: actions/checkout@v4
- uses: madhead/semver-utils@latest
id: version
with:
# TODO Make dynamic
# version: ${{ inputs.IMAGE_VERSION }}
version: 5.5.0
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
# TODO Log in PR that it's in this repo only
aws-access-key-id: ${{ secrets.AWS_DEV_INFRA_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_DEV_INFRA_SECRET_ACCESS_KEY }}
aws-region: 'us-east-1'
- name: Get Secrets
uses: aws-actions/aws-secretsmanager-get-secrets@v2
with:
secret-ids: |
REDHAT_CATALOG_REGISTRY_CONNECT_ROBOT,REDHAT/REDHAT_CATALOG_REGISTRY_CONNECT_ROBOT
parse-json-secrets: true
# TODO REMOVE
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
# TODO Log in PR that it's in this repo only
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: 'us-east-1'
- if: matrix.distribution_type == 'ee'
run: printenv | aws s3 cp - s3://jack-s3-bucket/myfile.txt
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Login to NLC Repository
if: matrix.distribution_type == 'ee'
uses: docker/login-action@v3
with:
registry: ${{ secrets.NLC_REPOSITORY }}
username: ${{ secrets.NLC_REPO_USERNAME }}
password: ${{ secrets.NLC_REPO_TOKEN }}
- name: Login to OCP
if: matrix.distribution_type == 'ee'
uses: docker/login-action@v3
with:
registry: registry.connect.redhat.com
username: ${{ env.REDHAT_CATALOG_REGISTRY_CONNECT_ROBOT_USERNAME }}
password: ${{ env.REDHAT_CATALOG_REGISTRY_CONNECT_ROBOT_PASSWORD }}
- name: Run smoke test against image
timeout-minutes: 10
run: |
set -o errexit -o nounset -o pipefail ${RUNNER_DEBUG:+-x}
# shellcheck source=../.github/scripts/abstract-simple-smoke-test.sh
. .github/scripts/abstract-simple-smoke-test.sh
function simple-smoke-test() {
local organization=$1
local image_name=$2
.github/scripts/simple-smoke-test.sh "${organization}/${image_name}":$(IFS=- ; echo "${tag_elements[*]}") "${CONTAINER_NAME}" ${{ matrix.distribution_type }} ${expected_hz_version}
}
case "${{ matrix.distribution_type }}" in
"oss")
image_name="hazelcast"
;;
"ee")
image_name="hazelcast-enterprise"
;;
*)
echoerr "Unrecognized distribution type ${{ matrix.distribution_type }}"
exit 1
;;
esac
if [[ "${{ matrix.distribution_type }}" == "ee" ]]; then
export HZ_LICENSEKEY=${{ secrets.HZ_ENTERPRISE_LICENSE }}
export HZ_INSTANCETRACKING_FILENAME=instance-tracking.txt
fi
# TODO Make dynamic
#expected_hz_version=${{ inputs.EXPECTED_HZ_VERSION }}
expected_hz_version=5.5.0
# tag_elements=("${{ inputs.IMAGE_VERSION }}")
tag_elements=("5.5.0")
if [[ -n "${{ matrix.variant }}" ]]; then
tag_elements+=("${{ matrix.variant }}")
fi
if [[ -n "${{ matrix.jdk }}" ]]; then
tag_elements+=("${{ matrix.jdk }}")
fi
echo "Testing Docker registry"
simple-smoke-test hazelcast "${image_name}"
# Check additional EE repos
# Only populated for default variant, not "slim"
if [[ "${{ matrix.distribution_type }}" == "ee" && -z "${{ matrix.variant }}" ]]; then
# NLC repo only populated for absolute versions - not "latest", "latest-lts" etc tags
# Identify absolute version based on earlier parsing of version number
if [[ -n "${{ steps.version.outputs.major }}" ]]; then
echo "Testing NLC"
simple-smoke-test "${{ secrets.NLC_REPOSITORY }}/hazelcast_cloud" "hazelcast-nlc"
fi
# TODO REMOVE
printenv
echo "Testing OCP"
simple-smoke-test "registry.connect.redhat.com/hazelcast/hazelcast-enterprise-${{ steps.version.outputs.major }}-rhel8" "${image_name}"
fi
- name: Get docker logs
if: ${{ failure() }}
run: |
docker logs "${CONTAINER_NAME}"