Description
Add support for local/production Jenkins deployment and distinguishing between those 2 mods using some parameter or environment variable
Investigate info from Radim Hopp:
- https://gitlab.cee.redhat.com/codeready-workspaces/crw-jenkins/-/merge_requests/271/diffs
- script run_locally.sh
The solution is:
- chnage casc.yaml (use yq and put it to new file local_casc.yaml, do not change original casc.yaml)
- Use local_casc.yaml to start local Jenkins. But here is an problem with giving the file to the script. because of that there is an hacover on lines 38-53. There is also a link to an issue, which is already resolved. The hackaround should not be needed anymore. To the JCASC_CUSTOM_DOCKER_RUN_OPTS variable you can put -e CASC_JENKINS_CONFIG=/tmp/config/local_casc.yaml
Pseudocode:
# Delete if local_casc.yaml already exists set -x PWD=$(dirname ${BASH_SOURCE[0]}) if [ -f $PWD/local_casc.yaml ]; then rm local_casc.yaml fi## DO ANYTHING YOU WANT WITH CASC.YAML HERE: cat $PWD/casc.yaml | \ yq -y '.jenkins.clouds[]?.openstack.templates[]?.slaveOptions.instancesMin |= if (. != null) then 0 else empty end' | \ yq -y '.jenkins.clouds[]?.openstack.templates[]?.slaveOptions.retentionTime |= if (. != null) then 0 else empty end' \ > $PWD/local_casc.yaml## export JCASC_CUSTOM_DOCKER_RUN_OPTS export JCASC_CUSTOM_DOCKER_RUN_OPTS="-e CASC_JENKINS_CONFIG=${PWD}/local_casc.yaml"## Start jenkins $JENKINS_CSB_REPO/cci-jd/setup.sh $PWD