Inject the operand version as env var (#11511)

This commit is contained in:
Andrea Peruffo 2022-04-20 10:09:08 +01:00 committed by GitHub
parent cf420e89c2
commit 7986872ae0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 10 additions and 6 deletions

View file

@ -131,7 +131,8 @@ jobs:
mvn clean verify \
-Dquarkus.container-image.build=true \
-Dquarkus.kubernetes.deployment-target=kubernetes \
-Dquarkus.jib.jvm-arguments="-Djava.util.logging.manager=org.jboss.logmanager.LogManager","-Doperator.keycloak.image=keycloak:${{ steps.vars.outputs.version }}",-Doperator.keycloak.image-pull-policy=Never \
-Doperator.keycloak.image=keycloak:${{ steps.vars.outputs.version }} \
-Dquarkus.jib.jvm-arguments="-Djava.util.logging.manager=org.jboss.logmanager.LogManager","-Doperator.keycloak.image-pull-policy=Never" \
-Dtest.operator.custom.image=custom-keycloak:${{ steps.vars.outputs.version }} \
--no-transfer-progress -Dtest.operator.deployment=remote \
-Dtest.operator.kubernetes.ip=$(minikube ip)

View file

@ -24,6 +24,8 @@ yq ea -i ".metadata.annotations.containerImage = \"$OPERATOR_DOCKER_IMAGE:$VERSI
yq ea -i ".metadata.annotations.createdAt = \"$CREATED_AT\"" $SCRIPT_DIR/../olm/$VERSION/manifests/clusterserviceversion.yaml && \
yq ea -i ".metadata.name = \"keycloak-operator.v$VERSION\"" $SCRIPT_DIR/../olm/$VERSION/manifests/clusterserviceversion.yaml && \
yq ea -i ".spec.install.spec.deployments[0].spec.template.spec.containers[0].image = \"$OPERATOR_DOCKER_IMAGE:$VERSION\"" $SCRIPT_DIR/../olm/$VERSION/manifests/clusterserviceversion.yaml && \
yq ea 'select(.spec.template.spec.containers[0].env) | .spec.template.spec.containers[0].env[-1]' $SCRIPT_DIR/../target/kubernetes/kubernetes.yml | \
yq ea -i 'select(fileIndex==0).spec.install.spec.deployments[0].spec.template.spec.containers[0].env += select(fileIndex==1) | select(fileIndex==0)' $SCRIPT_DIR/../olm/$VERSION/manifests/clusterserviceversion.yaml - && \
yq ea -i ".spec.version = \"$VERSION\"" $SCRIPT_DIR/../olm/$VERSION/manifests/clusterserviceversion.yaml
if [[ $REPLACES_VERSION = "NONE" ]]

View file

@ -50,8 +50,4 @@ spec:
source: test-catalog
sourceNamespace: default
startingCSV: keycloak-operator.v$VERSION
config:
env:
- name: "OPERATOR_KEYCLOAK_IMAGE"
value: "$DOCKER_REGISTRY/${UUID}keycloak:$VERSION"
EOF

View file

@ -22,6 +22,7 @@ VERSION="86400000.0.0"
mvn clean package \
-Dquarkus.container-image.build=true \
-Dquarkus.container-image.image="ttl.sh/${UUID}keycloak-operator:${VERSION}" \
-Doperator.keycloak.image="ttl.sh/${UUID}keycloak:${VERSION}" \
-DskipTests
# JIB patching on images doesn't work reliably with ttl.sh
docker push "ttl.sh/${UUID}keycloak-operator:${VERSION}"

View file

@ -5,5 +5,9 @@ quarkus.container-image.builder=jib
quarkus.operator-sdk.crd.validate=false
# Operator config
operator.keycloak.image=quay.io/keycloak/keycloak:latest
operator.keycloak.image=quay.io/keycloak/keycloak:nightly
operator.keycloak.image-pull-policy=Always
# https://quarkus.io/guides/deploying-to-kubernetes#environment-variables-from-keyvalue-pairs
quarkus.kubernetes.env.vars.operator-keycloak-image=${operator.keycloak.image}
quarkus.openshift.env.vars.operator-keycloak-image=${operator.keycloak.image}