Skip to content

Commit

Permalink
chore(KFLUXMIG-13): build mtv downstream bundle
Browse files Browse the repository at this point in the history
Signed-off-by: Ernesto González <[email protected]>
  • Loading branch information
ernesgonzalez33 committed Dec 8, 2024
1 parent 0d0b6cf commit 18c7570
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 7 deletions.
2 changes: 2 additions & 0 deletions .tekton/forklift-operator-bundle-pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ spec:
value: build/forklift-operator-bundle/Containerfile
- name: path-context
value: .
- name: build-args-file
value: build/forklift-operator-bundle/downstream-args
pipelineSpec:
description: |
This pipeline is ideal for building container images from a Containerfile while maintaining trust after pipeline customization.
Expand Down
2 changes: 2 additions & 0 deletions .tekton/forklift-operator-bundle-push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ spec:
value: build/forklift-operator-bundle/Containerfile
- name: path-context
value: .
- name: build-args-file
value: build/forklift-operator-bundle/downstream-args
pipelineSpec:
description: |
This pipeline is ideal for building container images from a Containerfile while maintaining trust after pipeline customization.
Expand Down
4 changes: 3 additions & 1 deletion build/forklift-operator-bundle/Containerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
FROM quay.io/konflux-ci/operator-sdk-builder@sha256:73fa40301aebf0c62903a5840918251f444212319f95a4e467eeaf0cd8c4349e as builder

ARG STREAM=downstream

COPY ./. /repo
WORKDIR /repo/operator
RUN source ./export-vars.sh && \
RUN source ./export-vars.sh ${STREAM} && \
kustomize build config/manifests/ \
| envsubst \
| operator-sdk generate bundle \
Expand Down
1 change: 1 addition & 0 deletions build/forklift-operator-bundle/downstream-args
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
STREAM=downstream
1 change: 1 addition & 0 deletions build/forklift-operator-bundle/upstream-args
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
STREAM=upstream
49 changes: 43 additions & 6 deletions operator/export-vars.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
#!/bin/bash -e
#!/bin/bash -ex

# Check if the script has exactly one parameter
if [ "$#" -ne 1 ]; then
echo "Error: Exactly one parameter is required."
echo "Usage: $0 <upstream|downstream>"
exit 1
fi

stream=$1

declare -A images

Expand Down Expand Up @@ -26,13 +35,41 @@ images[VALIDATION_IMAGE]=quay.io/redhat-user-workloads/rh-mtv-1-tenant/forklift-

images[VIRT_V2V_IMAGE]=quay.io/redhat-user-workloads/rh-mtv-1-tenant/forklift-operator/virt-v2v@sha256:9a8548cf4439121ceaa7a8d626d6c6f1f9280f63b2daf471d24fd62c8185a3f4

# For downstream, the names of the images change

declare -A replacements

replacements[API_IMAGE]=mtv-api-rhel9
replacements[CONTROLLER_IMAGE]=mtv-controller-rhel8
replacements[MUST_GATHER_IMAGE]=mtv-must-gather-rhel8
replacements[OPENSTACK_POPULATOR_IMAGE]=mtv-openstack-populator-rhel9
replacements[OPERATOR_IMAGE]=mtv-rhel8-operator
replacements[OVA_PROVIDER_SERVER_IMAGE]=mtv-ova-provider-server-rhel9
replacements[OVIRT_POPULATOR_IMAGE]=mtv-rhv-populator-rhel8
replacements[POPULATOR_CONTROLLER_IMAGE]=mtv-populator-controller-rhel9
replacements[UI_PLUGIN_IMAGE]=mtv-console-plugin-rhel9
replacements[VALIDATION_IMAGE]=mtv-validation-rhel8
replacements[VIRT_V2V_IMAGE]=mtv-virt-v2v-rhel8

# Chage the repository of the images to match the repository they would be pushed
# to during a release.

for k in "${!images[@]}"; do
image="${images[$k]}"
new_image="${image/redhat-user-workloads\/rh-mtv-1-tenant/kubev2v}"
export "$k=$new_image"
done
if [ $stream == "upstream" ]; then
for k in "${!images[@]}"; do
image="${images[$k]}"
new_image="${image/quay.io\/redhat-user-workloads\/rh-mtv-1-tenant\/forklift-operator/kubev2v}"
export "$k=$new_image"
done
elif [ $stream == "downstream" ]; then
for k in "${!images[@]}"; do
image="${images[$k]}"
new_image="${image/forklift-operator\/[^@]*@/forklift-operator\/${replacements[$k]}@}"
new_image="${new_image/quay.io\/redhat-user-workloads\/rh-mtv-1-tenant\/forklift-operator/registry.redhat.io\/migration-toolkit-virtualization}"
export "$k=$new_image"
done
else
echo "Stream not valid. Expected 'upstream' or 'downstream'."
exit 1
fi

export VERSION="v2.7.0"

0 comments on commit 18c7570

Please sign in to comment.