Skip to content

Commit

Permalink
Move call to create_jenkins_location_configuration_xml after image_co…
Browse files Browse the repository at this point in the history
…nfig_dir init
  • Loading branch information
akram committed Jun 18, 2021
1 parent 75942ff commit 330b37a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 31 deletions.
14 changes: 1 addition & 13 deletions 2/contrib/openshift/base-plugins.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,9 @@ openshift-login:1.0.26
openshift-sync:1.0.46
pam-auth:1.6
parameterized-trigger:2.36
pipeline-build-step:2.12
pipeline-github-lib:1.0
pipeline-input-step:2.11
pipeline-model-api:1.7.2
pipeline-model-definition:1.6.0
pipeline-utility-steps:2.5.0
prometheus:2.0.0
script-security:1.75
snakeyaml-api:1.27.0
script-security:1.77
ssh-credentials:1.18.1
subversion:2.13.2
token-macro:2.13
workflow-aggregator:2.6
workflow-cps-global-lib:2.15
workflow-cps:2.87
workflow-multibranch:2.22
workflow-remote-loader:1.5
workflow-support:3.6
35 changes: 17 additions & 18 deletions 2/contrib/s2i/run
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,6 @@
default_version=$(cat /tmp/release.version)
JENKINS_SLAVE_IMAGE_TAG=${JENKINS_SLAVE_IMAGE_TAG:-${default_version}}

create_jenkins_location_configuration_xml() {
# Gets the jenkins URL only from the *first* route available in namespace service the service named $JENKINS_SERVICE_NAME
JENKINS_SCHEME="https://"
if [ $( oc get routes -o json | jq -c -r '.items[0].spec.tls') == "null" ]; then
JENKINS_SCHEME="http://"
fi
JENKINS_URL="$JENKINS_SCHEME$(oc get routes -o json | jq -c -r '.items[0].spec | select (.to.name == env.JENKINS_SERVICE_NAME ) | .host ')"
echo "Using JENKINS_SERVICE_NAME=$JENKINS_SERVICE_NAME"
echo "Generating jenkins.model.JenkinsLocationConfiguration.xml using (${JENKINS_HOME}/jenkins.model.JenkinsLocationConfiguration.xml.tpl) ..."
export JENKINS_URL
echo "Jenkins URL set to: $JENKINS_URL in file: ${JENKINS_HOME}/jenkins.model.JenkinsLocationConfiguration.xml"
envsubst < "${image_config_dir}/jenkins.model.JenkinsLocationConfiguration.xml.tpl" > "${JENKINS_HOME}/jenkins.model.JenkinsLocationConfiguration.xml"
}

create_jenkins_location_configuration_xml

source /usr/local/bin/jenkins-common.sh
source /usr/local/bin/kube-slave-common.sh

Expand Down Expand Up @@ -559,8 +543,23 @@ shopt -u nocasematch
## Since the pod name changes everytime there is a deployment, any trending data is lost over
## re-deployments. We force the application name to allow for historical data collection.
##
JENKINS_SERVICE_NAME=${JENKINS_SERVICE_NAME:-JENKINS}
JENKINS_SERVICE_NAME=`echo ${JENKINS_SERVICE_NAME} | tr '[a-z]' '[A-Z]' | tr '-' '_'`
JENKINS_SERVICE_NAME=${JENKINS_SERVICE_NAME:-jenkins}
JENKINS_SERVICE_NAME=`echo ${JENKINS_SERVICE_NAME} | tr '[A-Z]' '[a-z]' | tr '_' '-'`
create_jenkins_location_configuration_xml() {
# Gets the jenkins URL only from the *first* route available in namespace service the service named $JENKINS_SERVICE_NAME
JENKINS_SCHEME="https://"
if [ $( oc get routes -o json | jq -c -r '.items[0].spec.tls') == "null" ]; then
JENKINS_SCHEME="http://"
fi
JENKINS_URL="$JENKINS_SCHEME$(oc get routes -o json | jq -c -r '.items[0].spec | select (.to.name == env.JENKINS_SERVICE_NAME ) | .host ')"
echo "Using JENKINS_SERVICE_NAME=$JENKINS_SERVICE_NAME"
echo "Generating jenkins.model.JenkinsLocationConfiguration.xml using (${JENKINS_HOME}/jenkins.model.JenkinsLocationConfiguration.xml.tpl) ..."
export JENKINS_URL
echo "Jenkins URL set to: $JENKINS_URL in file: ${JENKINS_HOME}/jenkins.model.JenkinsLocationConfiguration.xml"
envsubst < "${image_config_dir}/jenkins.model.JenkinsLocationConfiguration.xml.tpl" > "${JENKINS_HOME}/jenkins.model.JenkinsLocationConfiguration.xml"
}

create_jenkins_location_configuration_xml

FATAL_ERROR_OPTION=""

Expand Down

0 comments on commit 330b37a

Please sign in to comment.