Merge "Revise docker-get-container-tag-script macro"
authorEric Ball <eball@linuxfoundation.org>
Wed, 11 Dec 2019 02:16:16 +0000 (02:16 +0000)
committerGerrit Code Review <gerrit@linuxfoundation.org>
Wed, 11 Dec 2019 02:16:16 +0000 (02:16 +0000)
.jjb-test/lf-ci-jobs.yaml
docs/jjb/lf-ci-jobs.rst
jjb/lf-ci-job-groups.yaml
jjb/lf-ci-jobs.yaml
releasenotes/notes/branch-lock-any-80d1391da7431c02.yaml [new file with mode: 0644]
releasenotes/notes/fix-config-tarball-a4bee31a90375126.yaml [new file with mode: 0644]
shell/gerrit-branch-lock.sh
shell/jjb-verify-job.sh

index baeced5..65a4fab 100644 (file)
@@ -3,7 +3,6 @@
     name: gerrit-ci-jobs
     jobs:
       - "{project-name}-ci-jobs"
-      - gerrit-branch-lock
 
     project-name: gerrit-ciman
 
index 3cd6e72..0fa7081 100644 (file)
@@ -107,10 +107,13 @@ Job Templates
 Gerrit Branch Lock
 ------------------
 
-Job submits a patch to lock or unlock a project's branch.
+Job submits a patch to lock or unlock a project's branch. This should only be
+loaded once, as "ci-management-gerrit-branch-lock" (or "ci-management"
+equivalent). That job will process lock/unlock requests for all projects and
+all branches.
 
 :Template Names:
-    - {project-name}-gerrit-branch-lock-{stream}
+    - {project-name}-gerrit-branch-lock
     - gerrit-branch-lock
 
 :Comment Trigger:
@@ -126,14 +129,9 @@ Job submits a patch to lock or unlock a project's branch.
 
 :Optional parameters:
 
-    :branch: Git branch to build against. (default: master)
     :git-url: URL to clone project from. (default: $GIT_URL/$GERRIT_PROJECT)
-    :stream: Keyword that can be used to represent a release code-name.
-        Often the same as the branch. (default: master)
     :submodule-timeout: Timeout (in minutes) for checkout operation.
         (default: 10)
-    :submodule-disable: Disable submodule checkout operation.
-        (default: false)
     :gerrit_merge_triggers: Override Gerrit Triggers.
 
 .. _lf-global-jjb-jenkins-cfg-merge:
index 81e6b0b..945079c 100644 (file)
@@ -9,6 +9,7 @@
       - gerrit-jjb-deploy-job
       - gerrit-jjb-merge
       - gerrit-jjb-verify
+      - gerrit-branch-lock
 
 - job-group:
     name: "{project-name}-github-ci-jobs"
index 1d99d69..701898c 100644 (file)
 ######################
 
 - job-template:
-    name: "{project-name}-gerrit-branch-lock-{stream}"
+    name: "{project-name}-gerrit-branch-lock"
     id: gerrit-branch-lock
 
     ######################
     # Default parameters #
     ######################
 
-    branch: master
+    branch: "**"
     disable-job: false
     git-url: "$GIT_URL/$GERRIT_PROJECT"
-    stream: master
     submodule-timeout: 10
-    submodule-disable: false
+    submodule-disable: true
     gerrit_merge_triggers:
       - comment-added-contains-event:
           comment-contains-value: (un)?lock branch$
     parameters:
       - lf-infra-parameters:
           project: "{project}"
-          stream: "{stream}"
+          stream: ""
           branch: "{branch}"
 
     wrappers:
       - lf-infra-gerrit-scm:
           git-url: "{git-url}"
           refspec: ""
-          branch: "{branch}"
+          branch: "$GERRIT_BRANCH"
           submodule-recursive: false
           submodule-timeout: "{submodule-timeout}"
           submodule-disable: "{submodule-disable}"
           trigger-on: "{obj:gerrit_merge_triggers}"
           projects:
             - project-compare-type: ANT
-              project-pattern: "{project}"
+              project-pattern: "**"
               branches:
                 - branch-compare-type: ANT
                   branch-pattern: "**/{branch}"
diff --git a/releasenotes/notes/branch-lock-any-80d1391da7431c02.yaml b/releasenotes/notes/branch-lock-any-80d1391da7431c02.yaml
new file mode 100644 (file)
index 0000000..daee4e7
--- /dev/null
@@ -0,0 +1,5 @@
+---
+features:
+  - |
+    Add gerrit-branch-lock to gerrit ci-jobs, and make it so that it can be
+    triggered from any change, for any branch.
diff --git a/releasenotes/notes/fix-config-tarball-a4bee31a90375126.yaml b/releasenotes/notes/fix-config-tarball-a4bee31a90375126.yaml
new file mode 100644 (file)
index 0000000..6992fc3
--- /dev/null
@@ -0,0 +1,10 @@
+---
+fixes:
+  - |
+    Currently a Job Config Tarball is added to the archive.  The directory
+    layout created by 'jenkins-jobs test' has changed and as a result the code
+    that sorted/reformated the directory and generated the tarball was broken.
+
+    The prefix path of the tarball is now 'job-configs'. The number of log
+    messages has been improved and greatly reduced. The tarball generated
+    contains directory names with spaces and upper-case characters.
index 8cfbe4a..60f28fe 100644 (file)
@@ -39,6 +39,7 @@ install_gerrit_hook
 # Groups must be mapped in the groups file before they can be used
 if ! grep 'Registered Users'; then
     echo -e "global:Registered-Users\tRegistered Users" >> groups
+    git add groups
 fi
 
 mode=$(echo "$GERRIT_EVENT_COMMENT_TEXT" | grep branch | awk '{print $1}')
index d7a9e31..5ed12e2 100644 (file)
@@ -10,8 +10,7 @@
 ##############################################################################
 echo "---> jjb-verify-job.sh"
 
-# Ensure we fail the job if any steps fail.
-set -eu -o pipefail
+set -eufo pipefail
 
 # shellcheck disable=SC1090
 source ~/lf-env.sh
@@ -21,23 +20,25 @@ lf-jjb-check-ascii
 
 lf-activate-venv jenkins-job-builder
 
-jenkins-jobs -l DEBUG test --recursive -o archives/job-configs --config-xml jjb/
+jenkins-jobs test --recursive -o archives/job-configs --config-xml jjb/
 
-# Sort job output into sub-directories. On large Jenkins systems that have
-# many jobs archiving so many files into the same directory makes NGINX return
-# the directory list slow.
-pushd archives/job-configs
-for letter in {a..z}
-do
-    if [[ $(ls "$letter"* > /dev/null 2>&1) -eq 0 ]]
-    then
-        mkdir "$letter"
-        find . -maxdepth 1 -type f -name "$letter*" -exec mv {} "$letter" \;
-    fi
-done
-popd
+# Enable 'globbing'
+set +f
+# NGINX is very sluggish with directories containing large numbers of objects
+# Add another directory level named {a..z} and move directories to them.
+# Directories beginning with {0..9} or {A..Z} are left at the top level.
+(   cd archives/job-configs
+    for letter in {a..z}; do
+        if ls -d $letter* > /dev/null 2>&1; then
+            mkdir .tmp
+            mv $letter* .tmp
+            mv .tmp $letter
+        fi
+    done
+)
 
-if [ -n "$(ls -A archives/job-configs)" ]; then
-    tar cJvf archives/job-configs.tar.xz archives/job-configs
-    rm -rf archives/job-configs
-fi
+(   cd archives
+    echo "INFO: Archiving $(find job-configs -name \*.xml | wc -l) job configurations"
+    tar -cJf job-configs.tar.xz job-configs
+    rm -rf job-configs
+)