CHANGE_NUMBER (String)
These properties would be provided to DSL script as default config values
JOB_UI_DIR=Playground/mao
DEFAULT_EMAIL=noone@example.com
REPLY_TO=noone@example.com
SHOULD_SEND_EMAIL=
DEFAULT_BRANCH=ci-debug/001
DEFAULT_TAG=ci-debug/v1.10.1
DEFAULT_HASH=cdac769efe0566e13946d0ed5b8bb50c3c39b3e8 assert CHANGE_NUMBER
String branchPrefix = {
String last2Digits = (" " + CHANGE_NUMBER)[-2..-1].trim()
"changes/${last2Digits}/${CHANGE_NUMBER}"
} ()
def config = [
development: [
REFSPEC: "+refs/${branchPrefix}/*:refs/remotes/origin/${branchPrefix}/*",
BRANCH: "${branchPrefix}/1",
],
production: [
REFSPEC: '+refs/heads/*:refs/remotes/origin/*',
BRANCH: 'develop',
],
].get(ENVIRONMENT)
return configGit
${REFSPEC}
${BRANCH}
if [ "${ENVIRONMENT}" = development ]
then
PATCHSET_NUMBER="$(
git branch -a \
| grep -o "/${CHANGE_NUMBER}/.*" \
| cut -d/ -f3 \
| sort -nr \
| head -1
)"
BRANCH="${BRANCH%%/1}/${PATCHSET_NUMBER}"
git checkout ${BRANCH}
fi
cat <<EOF >build.properties
BRANCH=${BRANCH}
PATCHSET_NUMBER=${PATCHSET_NUMBER}
EOFbuild.properties
Path to your script(s) in Source control