Skip to content

Commit

Permalink
Add replace for OPM_IMAGE arg
Browse files Browse the repository at this point in the history
  • Loading branch information
creydr committed Oct 7, 2024
1 parent 38e6902 commit cb8cd65
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions hack/lib/catalogsource.bash
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ EOF
# Dockerfiles might specify "FROM $XYZ" which fails OpenShift on-cluster
# builds. Replace the references with real images.
function replace_images() {
local dockerfile_path tmp_dockerfile go_runtime go_builder
local dockerfile_path tmp_dockerfile go_runtime go_builder opm_image
dockerfile_path=${1:?Pass dockerfile path}
tmp_dockerfile=$(mktemp /tmp/Dockerfile.XXXXXX)
cp "${dockerfile_path}" "$tmp_dockerfile"
Expand All @@ -132,8 +132,13 @@ function replace_images() {
go_builder=$(grep "GO_BUILDER=" "$tmp_dockerfile" | cut -d"=" -f 2)
fi

if grep -q "OPM_IMAGE=" "$tmp_dockerfile"; then
opm_image=$(grep "OPM_IMAGE=" "$tmp_dockerfile" | cut -d"=" -f 2)
fi

sed -e "s|\$GO_RUNTIME|${go_runtime:-}|" \
-e "s|\$GO_BUILDER|${go_builder:-}|" -i "$tmp_dockerfile"
-e "s|\$GO_BUILDER|${go_builder:-}|" \
-e "s|\$OPM_IMAGE|${opm_image:-}|" -i "$tmp_dockerfile"

echo "$tmp_dockerfile"
}
Expand Down

0 comments on commit cb8cd65

Please sign in to comment.