Skip to content

Commit d2d3eef

Browse files
Use IRSO in e2e tests
Signed-off-by: Muhammad Adil Ghaffar <[email protected]>
1 parent 3ab0aaf commit d2d3eef

40 files changed

+671
-837
lines changed

scripts/ci-e2e.sh

Lines changed: 51 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,14 @@ export KUBERNETES_VERSION=${KUBERNETES_VERSION}
5353
export IMAGE_OS=${IMAGE_OS}
5454
export FORCE_REPO_UPDATE="false"
5555
export SKIP_NODE_IMAGE_PREPULL="true"
56-
export USE_IRSO="${USE_IRSO:-false}"
56+
export IPA_BASEURI=https://artifactory.nordix.org/artifactory/openstack-remote-cache/ironic-python-agent/dib
5757
EOF
5858

59+
# Set USE_IRSO only when IMAGE_OS is not ubuntu
60+
if [[ "${IMAGE_OS}" != "ubuntu" ]]; then
61+
echo 'export USE_IRSO="true"' >> "${M3_DEV_ENV_PATH}/config_${USER}.sh"
62+
fi
63+
5964
# Always set DATE variable for nightly builds because it is needed to form
6065
# the URL for CAPI nightly build components in e2e_conf.yaml even if not used.
6166
DATE=$(date '+%Y%m%d' -d '1 day ago')
@@ -168,44 +173,63 @@ kustomize_envsubst() {
168173
echo "envsubst applied to ${file}"
169174
}
170175

176+
yaml_envsubst() {
177+
local kustomize_dir="$1"
178+
179+
for file in "${kustomize_dir}"/*.yaml; do
180+
if [[ -f "${file}" ]]; then
181+
local tmp_file
182+
tmp_file=$(mktemp)
183+
envsubst < "${file}" > "${tmp_file}" && mv "${tmp_file}" "${file}"
184+
fi
185+
done
186+
}
187+
171188
# Generate credentials
172189
BMO_OVERLAYS=(
173-
"${REPO_ROOT}/test/e2e/data/bmo-deployment/overlays/release-0.9"
174190
"${REPO_ROOT}/test/e2e/data/bmo-deployment/overlays/release-0.10"
175191
"${REPO_ROOT}/test/e2e/data/bmo-deployment/overlays/release-0.11"
176192
"${REPO_ROOT}/test/e2e/data/bmo-deployment/overlays/pr-test"
177193
"${REPO_ROOT}/test/e2e/data/bmo-deployment/overlays/release-latest"
178194
)
179-
IRONIC_OVERLAYS=(
180-
"${REPO_ROOT}/test/e2e/data/ironic-deployment/overlays/release-27.0"
181-
"${REPO_ROOT}/test/e2e/data/ironic-deployment/overlays/release-29.0"
182-
"${REPO_ROOT}/test/e2e/data/ironic-deployment/overlays/release-31.0"
183-
"${REPO_ROOT}/test/e2e/data/ironic-deployment/overlays/release-32.0"
184-
"${REPO_ROOT}/test/e2e/data/ironic-deployment/overlays/pr-test"
185-
"${REPO_ROOT}/test/e2e/data/ironic-deployment/overlays/release-latest"
195+
IRSO_IRONIC_OVERLAYS=(
196+
"${REPO_ROOT}/test/e2e/data/ironic-standalone-operator/ironic/overlays/release-31.0"
197+
"${REPO_ROOT}/test/e2e/data/ironic-standalone-operator/ironic/overlays/release-32.0"
198+
"${REPO_ROOT}/test/e2e/data/ironic-standalone-operator/ironic/overlays/pr-test"
199+
"${REPO_ROOT}/test/e2e/data/ironic-standalone-operator/ironic/overlays/latest"
186200
)
187201

188202
# Update BMO and Ironic images in kustomization.yaml files to use the same image that was used before pivot in the metal3-dev-env
189203
case "${REPO_NAME:-}" in
190204
baremetal-operator)
191205
# shellcheck disable=SC2034
192-
BARE_METAL_OPERATOR_IMAGE="${REGISTRY}/localimages/tested_repo:latest"
206+
export BARE_METAL_OPERATOR_IMAGE="${REGISTRY}/localimages/tested_repo:latest"
193207
;;
194208

195209
ironic-image)
196210
# shellcheck disable=SC2034
197-
IRONIC_IMAGE="${REGISTRY}/localimages/tested_repo:latest"
211+
export IRONIC_IMAGE="${REGISTRY}/localimages/tested_repo:latest"
198212
;;
199213
esac
200214

215+
IRONIC_IMAGE="${IRONIC_IMAGE:-quay.io/metal3-io/ironic:main}"
201216
update_kustomize_image quay.io/metal3-io/baremetal-operator BARE_METAL_OPERATOR_IMAGE "${REPO_ROOT}"/test/e2e/data/bmo-deployment/overlays/pr-test
202-
update_kustomize_image quay.io/metal3-io/ironic IRONIC_IMAGE "${REPO_ROOT}"/test/e2e/data/ironic-deployment/overlays/pr-test
203217

204218
# Apply envsubst to kustomization.yaml files in BMO and Ironic overlays
205219
kustomize_envsubst "${REPO_ROOT}"/test/e2e/data/bmo-deployment/overlays/pr-test
206-
kustomize_envsubst "${REPO_ROOT}"/test/e2e/data/ironic-deployment/overlays/pr-test
220+
kustomize_envsubst "${REPO_ROOT}"/test/e2e/data/ironic-standalone-operator/ironic/base
221+
yaml_envsubst "${REPO_ROOT}"/test/e2e/data/ironic-standalone-operator/ironic/base/
222+
yaml_envsubst "${REPO_ROOT}"/test/e2e/data/ironic-standalone-operator/ironic/components/basic-auth/
223+
yaml_envsubst "${REPO_ROOT}"/test/e2e/data/ironic-standalone-operator/ironic/components/tls/
224+
yaml_envsubst "${REPO_ROOT}"/test/e2e/data/ironic-standalone-operator/operator
225+
yaml_envsubst "${REPO_ROOT}"/test/e2e/data/ironic-standalone-operator/ironic/overlays/pr-test/
226+
yaml_envsubst "${REPO_ROOT}"/test/e2e/data/ironic-standalone-operator/ironic/overlays/latest/
227+
228+
for overlay in "${IRSO_IRONIC_OVERLAYS[@]}"; do
229+
kustomize_envsubst "${overlay}"
230+
done
207231

208-
# Create usernames and passwords and other files related to ironi basic auth if they
232+
# Create usernames and passwords and other files related to ironic basic auth if they
209233
# are missing
210234
if [[ "${IRONIC_BASIC_AUTH}" == "true" ]]; then
211235
IRONIC_AUTH_DIR="${IRONIC_AUTH_DIR:-${IRONIC_DATA_DIR}/auth}"
@@ -228,13 +252,19 @@ if [[ "${IRONIC_BASIC_AUTH}" == "true" ]]; then
228252
IRONIC_PASSWORD="$(cat "${IRONIC_AUTH_DIR}/ironic-password")"
229253
fi
230254
fi
231-
IRONIC_INSPECTOR_USERNAME="${IRONIC_INSPECTOR_USERNAME:-${IRONIC_USERNAME}}"
232-
IRONIC_INSPECTOR_PASSWORD="${IRONIC_INSPECTOR_PASSWORD:-${IRONIC_PASSWORD}}"
233255

234256
export IRONIC_USERNAME
235257
export IRONIC_PASSWORD
236-
export IRONIC_INSPECTOR_USERNAME
237-
export IRONIC_INSPECTOR_PASSWORD
258+
fi
259+
260+
if [[ "${IRONIC_BASIC_AUTH}" == "true" ]]; then
261+
echo "${IRONIC_USERNAME}" > "${REPO_ROOT}"/test/e2e/data/ironic-standalone-operator/ironic/components/basic-auth/ironic-username
262+
echo "${IRONIC_PASSWORD}" > "${REPO_ROOT}"/test/e2e/data/ironic-standalone-operator/ironic/components/basic-auth/ironic-password
263+
fi
264+
265+
if [[ "${IRONIC_TLS_SETUP}" == "true" ]]; then
266+
cp "${IRONIC_KEY_FILE}" "${REPO_ROOT}"/test/e2e/data/ironic-standalone-operator/ironic/components/tls/
267+
cp "${IRONIC_CERT_FILE}" "${REPO_ROOT}"/test/e2e/data/ironic-standalone-operator/ironic/components/tls/
238268
fi
239269

240270
for overlay in "${BMO_OVERLAYS[@]}"; do
@@ -246,19 +276,6 @@ for overlay in "${BMO_OVERLAYS[@]}"; do
246276
fi
247277
done
248278

249-
for overlay in "${IRONIC_OVERLAYS[@]}"; do
250-
echo "IRONIC_HTPASSWD=$(htpasswd -n -b -B "${IRONIC_USERNAME}" "${IRONIC_PASSWORD}")" > \
251-
"${overlay}/ironic-htpasswd"
252-
envsubst < "${REPO_ROOT}/test/e2e/data/ironic-deployment/components/basic-auth/ironic-auth-config-tpl" > \
253-
"${overlay}/ironic-auth-config"
254-
IRONIC_INSPECTOR_AUTH_CONFIG_TPL="/tmp/ironic-inspector-auth-config-tpl"
255-
curl -o "${IRONIC_INSPECTOR_AUTH_CONFIG_TPL}" https://raw.githubusercontent.com/metal3-io/baremetal-operator/release-0.5/ironic-deployment/components/basic-auth/ironic-inspector-auth-config-tpl
256-
envsubst < "${IRONIC_INSPECTOR_AUTH_CONFIG_TPL}" > \
257-
"${overlay}/ironic-inspector-auth-config"
258-
echo "INSPECTOR_HTPASSWD=$(htpasswd -n -b -B "${IRONIC_INSPECTOR_USERNAME}" \
259-
"${IRONIC_INSPECTOR_PASSWORD}")" > "${overlay}/ironic-inspector-htpasswd"
260-
done
261-
262279
# run e2e tests
263280
if [[ -n "${CLUSTER_TOPOLOGY:-}" ]]; then
264281
export CLUSTER_TOPOLOGY=true
@@ -267,3 +284,6 @@ else
267284
export EXP_MACHINE_TAINT_PROPAGATION=true
268285
make e2e-tests
269286
fi
287+
288+
mkdir -p "/tmp/manifests/irso_yamls"
289+
cp -r "${REPO_ROOT}/test/e2e/data/ironic-standalone-operator/" "/tmp/manifests/irso_yamls/"

0 commit comments

Comments
 (0)