From 050cdffb159645926fdce4194acc180e9ff8a108 Mon Sep 17 00:00:00 2001 From: Jessica Wagantall Date: Mon, 26 Aug 2019 13:59:33 -0700 Subject: [PATCH] Fix use-release-file varaible Rename "RELEASE_FILE" parameter to "USE_RELEASE_FILE" in release-jobs. This will match the actual varaible default value better and will not collide with the local "release_file" in the script. Fix "USE_RELEASE_FILE" if statement. We are now using a bool instead of a string. Changing the if statements to evaluate bools. Change-Id: I9909a16487fabacc0261f6489ac81a00cbf0f965 Signed-off-by: Jessica Wagantall Signed-off-by: Anil Belur --- docs/jjb/lf-release-jobs.rst | 4 ++-- jjb/lf-macros.yaml | 2 +- .../notes/fix-use-release-file-var-a5f3ea05b58ec194.yaml | 9 +++++++++ shell/release-job.sh | 7 +++---- 4 files changed, 15 insertions(+), 7 deletions(-) create mode 100644 releasenotes/notes/fix-use-release-file-var-a5f3ea05b58ec194.yaml diff --git a/docs/jjb/lf-release-jobs.rst b/docs/jjb/lf-release-jobs.rst index f07c4e55..a2cfd955 100644 --- a/docs/jjb/lf-release-jobs.rst +++ b/docs/jjb/lf-release-jobs.rst @@ -9,14 +9,14 @@ Jenkins will pick this up and sign the ref extrapolated by log_dir and promote t Maven release jobs can also trigger via "Build with parameters" negating the need for a release file. The parameters will need to be filled out in the same was as a release file's would, excepting the speacial -RELEASE_FILE parameter which will need to be set to False to inform the job that it should not expect a release file. +USE_RELEASE_FILE parameter which will need to be set to False to inform the job that it should not expect a release file. The Special Parameters are as follows: GERRIT_BRANCH = master VERSION = 1.0.0 LOG_DIR = example-project-maven-stage-master/17/ DISTRIBUTION_TYPE = maven -RELEASE_FILE = False +USE_RELEASE_FILE = false .. note:: diff --git a/jjb/lf-macros.yaml b/jjb/lf-macros.yaml index b01887c7..15f008a5 100644 --- a/jjb/lf-macros.yaml +++ b/jjb/lf-macros.yaml @@ -504,7 +504,7 @@ default: "" description: "Set to maven for build with parametes" - bool: - name: RELEASE_FILE + name: USE_RELEASE_FILE default: "{use-release-file}" description: "Set to False for job built with parameters" diff --git a/releasenotes/notes/fix-use-release-file-var-a5f3ea05b58ec194.yaml b/releasenotes/notes/fix-use-release-file-var-a5f3ea05b58ec194.yaml new file mode 100644 index 00000000..6303cedf --- /dev/null +++ b/releasenotes/notes/fix-use-release-file-var-a5f3ea05b58ec194.yaml @@ -0,0 +1,9 @@ +--- +fixes: + - | + Rename "RELEASE_FILE" parameter to "USE_RELEASE_FILE" in release-jobs. + This will match the actual varaible default value better and will not + collide with the local "release_file" in the script. + - | + Fix "USE_RELEASE_FILE" if statement. We are now using a bool instead of + a string. Changing the if statements to evaluate bools. diff --git a/shell/release-job.sh b/shell/release-job.sh index 0ada4617..6510ce5b 100644 --- a/shell/release-job.sh +++ b/shell/release-job.sh @@ -151,8 +151,7 @@ if [ "${LOGS_SERVER}" == 'None' ]; then exit 1 fi -RELEASE_FILE="${RELEASE_FILE:-True}" -if [[ "$RELEASE_FILE" == "True" ]]; then +if $USE_RELEASE_FILE ; then release_files=$(git diff-tree --no-commit-id -r "$GERRIT_PATCHSET_REVISION" --name-only -- "releases/" ".releases/") if (( $(grep -c . <<<"$release_files") > 1 )); then @@ -165,7 +164,7 @@ if [[ "$RELEASE_FILE" == "True" ]]; then fi else - echo "This is job is built with parameters, no release file needed" + echo "This job is built with parameters, no release file needed. Continuing..." release_file="None" fi @@ -211,7 +210,7 @@ echo "DISTRIBUTION_TYPE: $DISTRIBUTION_TYPE" if [[ "$DISTRIBUTION_TYPE" == "maven" ]]; then wget -q https://raw.githubusercontent.com/lfit/releng-global-jjb/master/schema/release-schema.yaml RELEASE_SCHEMA="release-schema.yaml" - if [[ "$RELEASE_FILE" == "True" ]]; then + if $USE_RELEASE_FILE ; then verify_schema fi maven_release_file -- 2.16.6