Skip to content

Instantly share code, notes, and snippets.



Last active Jan 20, 2020
What would you like to do?
Rebuild local che server and push the image into internal registry of CRC
# This should run a level above the Eclipse Che server checkout which is assumed in a subdir called "che".
# CRC is assumed to be running.
# Che is assumed to be installed by chectl using operator.
# It uses podman for the images and assumes docker is aliased to podman.
CUR_USER=`oc whoami`
if [[ "$CUR_USER" == "kube:admin" ]]; then
REGISTRY=`oc registry info`
INTERNAL_REGISTRY=`oc registry info --internal=true`
TOKEN=`oc whoami -t`
oc get project $NS > /dev/null || {
echo Project $NS doesn\'t exist. Did you install Che using chectl?
echo Run chectl as follows:
echo chectl server:start -a operator -p crc -n $NS
exit 1
# build the che server assembly
cd che/assembly
mvn clean install -Dskiptests
# rebuild the docker image
cd ../dockerfiles/che
./ --dockerfile:Dockerfile
# push the docker image to the openshift registry
podman login -u $CUR_USER -p $TOKEN $REGISTRY --tls-verify=false
podman tag localhost/eclipse/che-server:nightly $IMAGE
podman push $IMAGE docker://$REGISTRY/$IMAGE --tls-verify=false
# deploy the self-signed-cert to make TLS work if needed without much effort
oc get secret router-ca -n openshift-ingress-operator -o jsonpath="{.data.tls\.crt}" | base64 -d > ca.crt
oc create secret generic self-signed-certificate --from-file=ca.crt -n=$NS
rm ca.crt
# update the Che CR
oc patch checluster/eclipse-che --patch "{\"spec\":{\"server\":{\"cheImage\": \"$INTERNAL_REGISTRY/$IMAGE_NAME\", \"cheImageTag\":\"$TAG\" }}}" --type=merge -n $NS
# force the operator to redeploy the server
oc delete deployment/che -n $NS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.