From 34564041cc71b59cd49543735b3adddc15792203 Mon Sep 17 00:00:00 2001 From: Jessica Wagantall Date: Tue, 7 Apr 2020 12:34:14 -0700 Subject: [PATCH] Optionally skip tag during release process Make tag process optional. True by default. Example scenario: Some ONAP projects make both maven and docker releases for a single repo. Docker releases depend on maven releases. This means that the team needs to make a maven release first, then make a docker release and lastly, tag the repo. This change will allow them to hold the tagging part during maven releases to allow them to tag after the docker release is made. Issue: RELENG-2835 Signed-off-by: Jessica Wagantall Change-Id: Ibd206269b80e7fb788682a81e038aa74d9eaf97c --- docs/jjb/lf-release-jobs.rst | 8 ++++++++ jjb/lf-release-jobs.yaml | 15 +++++++++++++++ .../notes/tag-release-optional-2069cca65ed0434b.yaml | 6 ++++++ schema/release-container-schema.yaml | 2 ++ schema/release-packagecloud-schema.yaml | 2 ++ schema/release-pypi-schema.yaml | 2 ++ schema/release-schema.yaml | 2 ++ shell/release-job.sh | 15 +++++++++++++++ 8 files changed, 52 insertions(+) create mode 100644 releasenotes/notes/tag-release-optional-2069cca65ed0434b.yaml diff --git a/docs/jjb/lf-release-jobs.rst b/docs/jjb/lf-release-jobs.rst index d4af19b3..02e73129 100644 --- a/docs/jjb/lf-release-jobs.rst +++ b/docs/jjb/lf-release-jobs.rst @@ -82,6 +82,8 @@ The following parameters must appear in a maven release yaml file. :git_tag: The tag string to sign and push to the Git repository. (default: the semantic version string) + :tag_release: Tag Gerrit Repo during the release process. + (default: true) The JSON schema for a maven release file appears below. @@ -132,6 +134,8 @@ The following parameters must appear in a container release yaml file. :git_tag: The tag string to sign and push to the Git repository. (default: the semantic version string) + :tag_release: Tag Gerrit Repo during the release process. + (default: true) The JSON schema for a container release file appears below. @@ -179,6 +183,8 @@ packages. :git_tag: The tag string to sign and push to the Git repository. (default: the semantic version string) + :tag_release: Tag Gerrit Repo during the release process. + (default: true) The JSON schema for a PyPI release file appears below. @@ -232,6 +238,8 @@ packages. :git_tag: The tag string to sign and push to the Git repository. (default: the semantic version string) + :tag_release: Tag Gerrit Repo during the release process. + (default: true) The JSON schema for a PackageCloud release file appears below. diff --git a/jjb/lf-release-jobs.yaml b/jjb/lf-release-jobs.yaml index 398a53eb..3cc37e9b 100644 --- a/jjb/lf-release-jobs.yaml +++ b/jjb/lf-release-jobs.yaml @@ -173,6 +173,11 @@ stream: "$GERRIT_BRANCH" - lf-build-with-parameters-maven-release: use-release-file: "{use-release-file}" + - bool: + name: TAG_RELEASE + default: true + description: | + Tag Gerrit repo after release. - bool: name: DRY_RUN default: false @@ -330,6 +335,11 @@ name: USE_RELEASE_FILE default: true description: "Set to False (unchecked) to build with parameters" + - bool: + name: TAG_RELEASE + default: true + description: | + Tag Gerrit repo after release. - bool: name: DRY_RUN default: false @@ -530,6 +540,11 @@ name: DISTRIBUTION_TYPE default: "packagecloud" description: "The Jenkins release job distribution type." + - bool: + name: TAG_RELEASE + default: true + description: | + Tag Gerrit repo after release. - bool: name: DRY_RUN default: false diff --git a/releasenotes/notes/tag-release-optional-2069cca65ed0434b.yaml b/releasenotes/notes/tag-release-optional-2069cca65ed0434b.yaml new file mode 100644 index 00000000..1229df5c --- /dev/null +++ b/releasenotes/notes/tag-release-optional-2069cca65ed0434b.yaml @@ -0,0 +1,6 @@ +--- +features: + - | + Optionally tag repo during release process. Set to true by default. + Allow projects to skip repo tag in cases where multiple release + types happen whithin the same repo. diff --git a/schema/release-container-schema.yaml b/schema/release-container-schema.yaml index 0b1fe0a2..f2b4fd9c 100644 --- a/schema/release-container-schema.yaml +++ b/schema/release-container-schema.yaml @@ -41,3 +41,5 @@ properties: type: "string" ref: type: "string" + tag_release: + type: "bool" diff --git a/schema/release-packagecloud-schema.yaml b/schema/release-packagecloud-schema.yaml index 8432f307..f18529cc 100644 --- a/schema/release-packagecloud-schema.yaml +++ b/schema/release-packagecloud-schema.yaml @@ -32,5 +32,7 @@ properties: type: "string" log_dir: type: "string" + tag_release: + type: "bool" version: type: "string" diff --git a/schema/release-pypi-schema.yaml b/schema/release-pypi-schema.yaml index 20240ed9..14136c25 100644 --- a/schema/release-pypi-schema.yaml +++ b/schema/release-pypi-schema.yaml @@ -26,5 +26,7 @@ properties: type: "string" python_version: type: "string" + tag_release: + type: "bool" version: type: "string" diff --git a/schema/release-schema.yaml b/schema/release-schema.yaml index 1c95eb90..02b87bc3 100644 --- a/schema/release-schema.yaml +++ b/schema/release-schema.yaml @@ -26,5 +26,7 @@ properties: type: "string" project: type: "string" + tag_release: + type: "bool" version: type: "string" diff --git a/shell/release-job.sh b/shell/release-job.sh index b650c13d..6a5c43c9 100644 --- a/shell/release-job.sh +++ b/shell/release-job.sh @@ -61,6 +61,15 @@ set_variables_common(){ PATCH_DIR=$(mktemp -d) + TAG_RELEASE="${TAG_RELEASE:-None}" + if [[ $TAG_RELEASE == "None" ]]; then + if grep -q "tag_release" $release_file ; then + TAG_RELEASE=$(yq -r .tag_release "$release_file") + else + TAG_RELEASE=true + fi + fi + # Displaying Release Information (Common variables) printf "\t%-30s\n" RELEASE_ENVIRONMENT_INFO: printf "\t%-30s %s\n" RELEASE_FILE: "$release_file" @@ -70,6 +79,7 @@ set_variables_common(){ printf "\t%-30s %s\n" SILO: "$SILO" printf "\t%-30s %s\n" PROJECT: "$PROJECT" printf "\t%-30s %s\n" PROJECT-DASHED: "${PROJECT//\//-}" + printf "\t%-30s %s\n" TAG_RELEASE: "$TAG_RELEASE" printf "\t%-30s %s\n" DISTRIBUTION_TYPE: "$DISTRIBUTION_TYPE" } @@ -261,6 +271,11 @@ verify_packagecloud_match_release(){ # sigul is only available on Centos # TODO: write tag-github-repo function tag-gerrit-repo(){ + if [[ $TAG_RELEASE == false ]]; then + echo "INFO: Skipping gerrit repo tag" + return + fi + echo "INFO: tag gerrit with $GIT_TAG" # Import public signing key gpg --import "$SIGNING_PUBKEY" -- 2.16.6