Skip to content

Commit

Permalink
add support for locally built ironic in e2e test
Browse files Browse the repository at this point in the history
this commit:
  - adds support for running the e2e tests with locally built ironic image
  - adds environment variable to enable the feature on demand

Reason:
There are scenarios outside the CI pipelines when developers need to run
the e2e tests and run it with a custom ironic build e.g. to test new features.

Signed-off-by: Adam Rozman <[email protected]>
  • Loading branch information
Rozzii committed Jan 8, 2025
1 parent 5999d3e commit cc72eb5
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 0 deletions.
9 changes: 9 additions & 0 deletions hack/ci-e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ echo "BMO_E2E_EMULATOR=${BMO_E2E_EMULATOR}"
export E2E_CONF_FILE="${REPO_ROOT}/test/e2e/config/ironic.yaml"
export E2E_BMCS_CONF_FILE="${REPO_ROOT}/test/e2e/config/bmcs-${BMC_PROTOCOL}.yaml"

LOAD_LOCAL_IRONIC="${LOAD_LOCAL_IRONIC:-false}"

case "${GINKGO_FOCUS:-}" in
*upgrade*)
export DEPLOY_IRONIC="false"
Expand Down Expand Up @@ -80,6 +82,13 @@ while ! minikube start; do sleep 30; done
docker image save -o /tmp/bmo-e2e.tar quay.io/metal3-io/baremetal-operator:e2e
minikube image load /tmp/bmo-e2e.tar
rm /tmp/bmo-e2e.tar
if [[ "${LOAD_LOCAL_IRONIC}" == "true" ]]; then
echo "Saving local ironic image!"
docker image save -o \
"/tmp/ironic-e2e.tar" "quay.io/metal3-io/ironic:local"
minikube image load /tmp/ironic-e2e.tar
rm /tmp/ironic-e2e.tar
fi

# This IP is defined by the network we created above.
IP_ADDRESS="192.168.222.1"
Expand Down
10 changes: 10 additions & 0 deletions ironic-deployment/overlays/e2e-local-ironic/ironic-patch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: ironic
spec:
template:
spec:
containers:
- name: ironic-dnsmasq
$patch: delete
27 changes: 27 additions & 0 deletions ironic-deployment/overlays/e2e-local-ironic/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: baremetal-operator-system
resources:
- ../e2e

patches:
- path: ironic-patch.yaml
- patch: |
# Don't try to pull again the pre-loaded image
- op: replace
path: /spec/template/spec/containers/0/imagePullPolicy
value: IfNotPresent
- op: replace
path: /spec/template/spec/containers/1/imagePullPolicy
value: IfNotPresent
- op: replace
path: /spec/template/spec/containers/2/imagePullPolicy
value: IfNotPresent
target:
kind: Deployment
name: ironic

images:
- name: quay.io/metal3-io/ironic
newTag: local

0 comments on commit cc72eb5

Please sign in to comment.