Skip to content

Commit 25f1b89

Browse files
committed
run-operator.sh tags operator with git commit sha
This gives us more assurance that we aren't running something pulled from quay.io, it will be more obvious when inspecting the pod that it isn't a release artifact. Signed-off-by: Robert Young <robeyoun@redhat.com>
1 parent f53ce07 commit 25f1b89

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

scripts/run-operator.sh

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,14 @@ then
1515
minikube start
1616
fi
1717

18-
echo "building operator image in minikube"
18+
GIT_HASH="$(git rev-parse HEAD)"
19+
TMP_INSTALL_DIR="$(mktemp -d)"
20+
trap 'rm -rf -- "$TMP_INSTALL_DIR"' EXIT
21+
22+
echo "building operator image in minikube for commit ${GIT_HASH}"
23+
IMAGE_TAG="dev-git-${GIT_HASH}"
1924
KROXYLICIOUS_VERSION=${KROXYLICIOUS_VERSION:-$(mvn org.apache.maven.plugins:maven-help-plugin:3.4.0:evaluate -Dexpression=project.version -q -DforceStdout)}
20-
minikube image build . -f Dockerfile.operator -t quay.io/kroxylicious/operator:latest --build-opt=build-arg=KROXYLICIOUS_VERSION="${KROXYLICIOUS_VERSION}"
25+
minikube image build . -f Dockerfile.operator -t quay.io/kroxylicious/operator:${IMAGE_TAG} --build-opt=build-arg=KROXYLICIOUS_VERSION="${KROXYLICIOUS_VERSION}"
2126

2227
cd kroxylicious-operator || exit
2328
echo "installing kafka (no-op if already installed)"
@@ -47,7 +52,9 @@ done
4752
echo "installing crds"
4853
kubectl apply -f src/main/resources/META-INF/fabric8
4954
echo "installing kroxylicious-operator"
50-
kubectl apply -f install
55+
cp install/* ${TMP_INSTALL_DIR}
56+
sed -i "s|quay.io/kroxylicious/operator:latest|quay.io/kroxylicious/operator:${IMAGE_TAG}|g" ${TMP_INSTALL_DIR}/03.Deployment.kroxylicious-operator.yaml
57+
kubectl apply -f ${TMP_INSTALL_DIR}
5158
echo "installing simple proxy"
5259
kubectl apply -f examples/simple/
5360

0 commit comments

Comments
 (0)