Optionally skip tag during release process 25/63625/12
authorJessica Wagantall <jwagantall@linuxfoundation.org>
Tue, 7 Apr 2020 19:34:14 +0000 (12:34 -0700)
committerJessica Wagantall <jwagantall@linuxfoundation.org>
Wed, 15 Apr 2020 18:48:42 +0000 (11:48 -0700)
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 <jwagantall@linuxfoundation.org>
Change-Id: Ibd206269b80e7fb788682a81e038aa74d9eaf97c

docs/jjb/lf-release-jobs.rst
jjb/lf-release-jobs.yaml
releasenotes/notes/tag-release-optional-2069cca65ed0434b.yaml [new file with mode: 0644]
schema/release-container-schema.yaml
schema/release-packagecloud-schema.yaml
schema/release-pypi-schema.yaml
schema/release-schema.yaml
shell/release-job.sh

index d4af19b..02e7312 100644 (file)
@@ -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.
 
index 398a53e..3cc37e9 100644 (file)
           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
           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
           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 (file)
index 0000000..1229df5
--- /dev/null
@@ -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.
index 0b1fe0a..f2b4fd9 100644 (file)
@@ -41,3 +41,5 @@ properties:
     type: "string"
   ref:
     type: "string"
+  tag_release:
+    type: "bool"
index 8432f30..f18529c 100644 (file)
@@ -32,5 +32,7 @@ properties:
     type: "string"
   log_dir:
     type: "string"
+  tag_release:
+    type: "bool"
   version:
     type: "string"
index 20240ed..14136c2 100644 (file)
@@ -26,5 +26,7 @@ properties:
     type: "string"
   python_version:
     type: "string"
+  tag_release:
+    type: "bool"
   version:
     type: "string"
index 1c95eb9..02b87bc 100644 (file)
@@ -26,5 +26,7 @@ properties:
     type: "string"
   project:
     type: "string"
+  tag_release:
+    type: "bool"
   version:
     type: "string"
index b650c13..6a5c43c 100644 (file)
@@ -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"