forked from redhat-cop/helm-charts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yaml
More file actions
182 lines (162 loc) · 6.44 KB
/
Copy pathaction.yaml
File metadata and controls
182 lines (162 loc) · 6.44 KB
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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
name: 'Setup Kind Cluster for Helm Chart Testing'
description: 'Setup Kind cluster for testing Helm Charts that expect to run with OLM and ingress'
inputs:
# renovate: datasource=github-releases depName=helm/helm
helm-version:
description: helm version to install
required: true
default: 'v3.16.3'
# renovate: datasource=github-tags depName=python/cpython
python-version:
description: python version to install
required: true
default: 'v3.13.0'
# renovate: datasource=github-releases depName=kubernetes-sigs/kind
kind-version:
description: kind version to install
required: true
default: 'v0.25.0'
# renovate: datasource=github-releases depName=operator-framework/operator-lifecycle-manager
olm-version:
description: olm version to install
required: true
default: 'v0.41.0'
# renovate: datasource=github-releases depName=operator-framework/operator-controller
olmv1-version:
description: olmv1 version to install
required: true
default: 'latest'
local-registry-enabled:
description: whether to enable local authenticated registry
required: true
type: boolean
default: false
local-registry-user:
description: local authenticated registry username
required: false
default: 'registryuser1'
local-registry-password:
description: local authenticated registry password
required: false
default: 'registrypassword1'
local-registry-uri:
description: local authenticated registry uri
required: false
default: 'registry.localhost'
local-registry-images:
description: space separated list of remote container images to seed into the local private registry
required: false
default: ''
runs:
using: "composite"
steps:
- name: Setup Helm 🧰
uses: azure/setup-helm@dda3372f752e03dde6b3237bc9431cdc2f7a02a2 # 5.0.0
with:
version: ${{ inputs.helm-version }}
- name: Setup Python 🐍
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: ${{ inputs.python-version }}
- name: Setup kind cluster 🧰
uses: helm/kind-action@ef37e7f390d99f746eb8b610417061a60e82a6cc # v1.14.0
with:
version: ${{ inputs.kind-version }}
config: _test/kind-config.yaml
# for helm charts we are testing that require installing operators
- name: Setup kind cluster - Install OLM 🧰
env:
OLM_VERSION: ${{ inputs.olm-version }}
shell: bash
run: |
curl -L https://github.com/operator-framework/operator-lifecycle-manager/releases/download/${OLM_VERSION}/install.sh -o install.sh
chmod +x install.sh
./install.sh ${OLM_VERSION}
# for helm charts we are testing that require installing OLMv1 Cluster Extensions
- name: Setup kind cluster - Install OLMv1 🧰
env:
OLMV1_VERSION: ${{ inputs.olmv1-version }}
shell: bash
run: |
curl -L -s https://github.com/operator-framework/operator-controller/releases/${OLMV1_VERSION}/download/install.sh | bash -s
# for helm charts we are testing that require ingress
- name: Setup kind cluster - Install ingress controller 🧰
shell: bash
run: |
helm repo add haproxy-ingress https://haproxy-ingress.github.io/charts
helm install haproxy-ingress haproxy-ingress/haproxy-ingress \
--create-namespace --namespace=ingress-controller \
--set controller.hostNetwork=true
kubectl apply -f - <<EOF
apiVersion: networking.k8s.io/v1
kind: IngressClass
metadata:
name: haproxy
annotations:
ingressclass.kubernetes.io/is-default-class: 'true'
spec:
controller: haproxy-ingress.github.io/controller
EOF
# for helm charts we are testing that require/expect certain default namespaces from Red Hat OpenShift
- name: Setup kind cluster - create expected namespaces 🧰
shell: bash
run: |
kubectl create namespace openshift-operators
# install private registry for those that need it
- name: Setup kind cluster - install private registry 🧰
env:
LOCAL_REGISTRY_USER: ${{ inputs.local-registry-user }}
LOCAL_REGISTRY_PASSWORD: ${{ inputs.local-registry-password }}
LOCAL_REGISTRY_URI: ${{ inputs.local-registry-uri }}
shell: bash
run: |
helm upgrade --install private-registry _test/private-registry \
--namespace registry \
--create-namespace \
--wait \
--set registryUser=${LOCAL_REGISTRY_USER} \
--set registryPassword=${LOCAL_REGISTRY_PASSWORD} \
--set registryIngressHost=${LOCAL_REGISTRY_URI}
if: inputs.local-registry-enabled == 'true'
# copy images needed by CT tests that use private registry to the private registry
- name: Setup kind cluster - Copy images into private registry 🔺
env:
LOCAL_REGISTRY_USER: ${{ inputs.local-registry-user }}
LOCAL_REGISTRY_PASSWORD: ${{ inputs.local-registry-password }}
LOCAL_REGISTRY_URI: ${{ inputs.local-registry-uri }}
LOCAL_REGISTRY_IMAGES: ${{ inputs.local-registry-images }}
shell: bash
run: |
for image in ${LOCAL_REGISTRY_IMAGES}; do
image_name_regex='.*\/(.*$)'
if [[ "${image}" =~ ${image_name_regex} ]]; then
image_name="${BASH_REMATCH[1]}"
remote_image="docker://${image}"
local_image="docker://${LOCAL_REGISTRY_URI}/${image_name}"
echo "Copy image (${remote_image}) to local registry (${local_image})"
skopeo copy \
--dest-creds ${LOCAL_REGISTRY_USER}:${LOCAL_REGISTRY_PASSWORD} \
--dest-tls-verify=false \
${remote_image} \
${local_image}
else
echo "ERROR: parsing image name from source image uri: ${image}"
exit 1
fi
done
if: inputs.local-registry-enabled == 'true'
# SOURCE: https://kind.sigs.k8s.io/docs/user/local-registry/
- name: Setup kind cluster - Add the registry config to the nodes 🧰
env:
LOCAL_REGISTRY_URI: ${{ inputs.local-registry-uri }}
CLUSTER_NAME: chart-testing
shell: bash
run: |
REGISTRY_DIR="/etc/containerd/certs.d/${LOCAL_REGISTRY_URI}"
for node in $(kind get nodes -n "${CLUSTER_NAME}"); do
docker exec "${node}" mkdir -p "${REGISTRY_DIR}"
cat <<EOF | docker exec -i "${node}" cp /dev/stdin "${REGISTRY_DIR}/hosts.toml"
[host."http://${LOCAL_REGISTRY_URI}"]
EOF
done
if: inputs.local-registry-enabled == 'true'