Refactor lf-c-cpp-jobs for common anchor 70/63370/6
authorLott, Christopher (cl778h) <cl778h@att.com>
Thu, 5 Mar 2020 19:22:47 +0000 (14:22 -0500)
committerLott, Christopher (cl778h) <cl778h@att.com>
Wed, 11 Mar 2020 14:47:39 +0000 (10:47 -0400)
Refactor templates in lf-c-cpp-jobs.yaml with common anchor/alias
lf_cmake_common to reduce redundant configuration.  This includes
gerrit-cmake-sonar, github-cmake-sonar, gerrit-cmake-sonarqube,
github-cmake-sonarqube, gerrit-cmake-stage, github-cmake-stage,
gerrit-cmake-verify and github-cmake-verify. No functional change.

Document maven settings parameters in g*t-cmake-stage templates.

Change-Id: I6477ad41da2b46adac2f76658dbf334db949b313
Signed-off-by: Lott, Christopher (cl778h) <cl778h@att.com>
docs/jjb/lf-c-cpp-jobs.rst
jjb/lf-c-cpp-jobs.yaml
releasenotes/notes/refactor-c-cpp-jobs-c8a79489fcb6b4f3.yaml [new file with mode: 0644]

index 4ced094..98c14bf 100644 (file)
@@ -202,6 +202,7 @@ project into a tar.xz tarball to produce a release candidate.
     :build-node: The node to run build on.
     :jenkins-ssh-credential: Credential to use for SSH.
         (Configure in defaults.yaml)
+    :mvn-settings: The name of settings file containing credentials for the project.
     :nexus-group-id: The Maven style Group ID for the namespace of the project
         in Nexus.
     :staging-profile-id: The unique Nexus Staging Profile ID for the project.
@@ -218,6 +219,8 @@ project into a tar.xz tarball to produce a release candidate.
     :install-prefix: CMAKE_INSTALL_PREFIX to use for install.
         (default: $BUILD_DIR/output)
     :make-opts: Parameters to pass to make. (default: '')
+    :mvn-global-settings: The name of the Maven global settings to use for
+        Maven configuration. (default: global-settings)
     :pre-build: Shell script to run before performing build. Useful for
         setting up dependencies. (default: '')
     :stream: Keyword that to represent a release code-name.
@@ -250,7 +253,7 @@ project into a tar.xz tarball to produce a release candidate.
 CMake Verify
 ------------
 
-Verify job which runs cmake && make && make install to test a project build..
+Verify job which runs cmake && make && make install to test a project build.
 
 :Template Names:
 
index 6f4db49..d82a9bc 100644 (file)
@@ -1,4 +1,42 @@
 ---
+####################
+# COMMON FUNCTIONS #
+####################
+
+- lf_cmake_common: &lf_cmake_common
+    name: lf-cmake-common
+
+    #####################
+    # Job Configuration #
+    #####################
+
+    project-type: freestyle
+    node: "{build-node}"
+    disabled: "{disable-job}"
+
+    properties:
+      - lf-infra-properties:
+          build-days-to-keep: "{build-days-to-keep}"
+
+    parameters:
+      - lf-infra-parameters:
+          project: "{project}"
+          branch: "{branch}"
+          stream: "{stream}"
+      - lf-cmake-parameters:
+          build-dir: "{build-dir}"
+          cmake-opts: "{cmake-opts}"
+          install-prefix: "{install-prefix}"
+          make-opts: "{make-opts}"
+
+    wrappers:
+      - lf-infra-wrappers:
+          build-timeout: "{build-timeout}"
+          jenkins-ssh-credential: "{jenkins-ssh-credential}"
+
+    publishers:
+      - lf-infra-publish
+
 ###############
 # CMAKE SONAR #
 ###############
     submodule-timeout: 10
     submodule-disable: false
 
-    #####################
-    # Job Configuration #
-    #####################
-
-    project-type: freestyle
-    node: "{build-node}"
-    disabled: "{disable-job}"
-
-    properties:
-      - lf-infra-properties:
-          build-days-to-keep: "{build-days-to-keep}"
-
-    parameters:
-      - lf-infra-parameters:
-          project: "{project}"
-          branch: "{branch}"
-          stream: "{stream}"
-          lftools-version: "{lftools-version}"
-      - lf-cmake-parameters:
-          build-dir: "{build-dir}"
-          cmake-opts: "{cmake-opts}"
-          install-prefix: "{install-prefix}"
-          make-opts: "{make-opts}"
-
-    wrappers:
-      - lf-infra-wrappers:
-          build-timeout: "{build-timeout}"
-          jenkins-ssh-credential: "{jenkins-ssh-credential}"
-
     builders:
       - lf-infra-pre-build
       - shell: "{pre-build}"
       - shell: !include-raw-escape: ../shell/cmake-sonar.sh
       - lf-provide-maven-settings-cleanup
 
-    publishers:
-      - lf-infra-publish
-
 - job-template:
     name: "{project-name}-cmake-sonar"
     id: gerrit-cmake-sonar
     concurrent: false
+    <<: *lf_cmake_common
     <<: *lf_cmake_sonar
 
     scm:
     name: "{project-name}-cmake-sonar"
     id: github-cmake-sonar
     concurrent: false
+    <<: *lf_cmake_common
     <<: *lf_cmake_sonar
 
     properties:
     sonar-properties: ""
     sonar-task: ""
 
-    #####################
-    # Job Configuration #
-    #####################
-
-    project-type: freestyle
-    node: "{build-node}"
-    disabled: "{disable-job}"
-
-    properties:
-      - lf-infra-properties:
-          build-days-to-keep: "{build-days-to-keep}"
-
-    wrappers:
-      - lf-infra-wrappers:
-          build-timeout: "{build-timeout}"
-          jenkins-ssh-credential: "{jenkins-ssh-credential}"
-
     parameters:
       - lf-infra-parameters:
           project: "{project}"
           sonar-java-opts: "{sonar-java-opts}"
           sonar-additional-args: "{sonar-additional-args}"
 
-    publishers:
-      - lf-infra-publish
-
 - job-template:
     name: "{project-name}-cmake-sonarqube"
     id: gerrit-cmake-sonarqube
     concurrent: false
+    <<: *lf_cmake_common
     <<: *lf_cmake_sonarqube
 
-    ######################
-    # Default parameters #
-    ######################
-
     gerrit_sonar_triggers:
       - comment-added-contains-event:
           comment-contains-value: '^Patch Set\s+\d+:\s+run-sonar\s*$'
     name: "{project-name}-cmake-sonarqube"
     id: github-cmake-sonarqube
     concurrent: false
+    <<: *lf_cmake_common
     <<: *lf_cmake_sonarqube
 
     scm:
     submodule-disable: false
     version: ""
 
-    #####################
-    # Job Configuration #
-    #####################
-
-    project-type: freestyle
-    node: "{build-node}"
-    disabled: "{disable-job}"
-
-    properties:
-      - lf-infra-properties:
-          build-days-to-keep: "{build-days-to-keep}"
-
     parameters:
       - lf-infra-parameters:
           project: "{project}"
                 | awk '{{print $NF}}' | awk -F')' '{{print $1}}')"
             echo "${{MAJOR_VERSION}}.${{MINOR_VERSION}}.${{PATCH_VERSION}}" > /tmp/artifact_version
 
-    wrappers:
-      - lf-infra-wrappers:
-          build-timeout: "{build-timeout}"
-          jenkins-ssh-credential: "{jenkins-ssh-credential}"
-
     builders:
       - lf-infra-pre-build
       - lf-provide-maven-settings:
       - shell: !include-raw-escape: ../shell/cmake-stage.sh
       - lf-provide-maven-settings-cleanup
 
-    publishers:
-      - lf-infra-publish
-
 - job-template:
     name: "{project-name}-cmake-stage-{stream}"
     id: gerrit-cmake-stage
     concurrent: true
+    <<: *lf_cmake_common
     <<: *lf_cmake_stage
 
     scm:
     name: "{project-name}-cmake-stage-{stream}"
     id: github-cmake-stage
     concurrent: true
+    <<: *lf_cmake_common
     <<: *lf_cmake_stage
 
     properties:
     github_included_regions:
       - ".*"
 
-    #####################
-    # Job Configuration #
-    #####################
-
-    project-type: freestyle
-    node: "{build-node}"
-    disabled: "{disable-job}"
-
-    properties:
-      - lf-infra-properties:
-          build-days-to-keep: "{build-days-to-keep}"
-
-    parameters:
-      - lf-infra-parameters:
-          project: "{project}"
-          branch: "{branch}"
-          stream: "{stream}"
-      - lf-cmake-parameters:
-          build-dir: "{build-dir}"
-          cmake-opts: "{cmake-opts}"
-          install-prefix: "{install-prefix}"
-          make-opts: "{make-opts}"
-
-    wrappers:
-      - lf-infra-wrappers:
-          build-timeout: "{build-timeout}"
-          jenkins-ssh-credential: "{jenkins-ssh-credential}"
-
     builders:
       - shell: "{pre-build}"
       - shell: !include-raw-escape: ../shell/cmake-build.sh
 
-    publishers:
-      - lf-infra-publish
-
 - job-template:
     name: "{project-name}-cmake-verify-{stream}"
     id: gerrit-cmake-verify
     concurrent: true
+    <<: *lf_cmake_common
     <<: *lf_cmake_verify
 
     scm:
     name: "{project-name}-cmake-verify-{stream}"
     id: github-cmake-verify
     concurrent: true
+    <<: *lf_cmake_common
     <<: *lf_cmake_verify
 
     properties:
diff --git a/releasenotes/notes/refactor-c-cpp-jobs-c8a79489fcb6b4f3.yaml b/releasenotes/notes/refactor-c-cpp-jobs-c8a79489fcb6b4f3.yaml
new file mode 100644 (file)
index 0000000..9725b4f
--- /dev/null
@@ -0,0 +1,10 @@
+---
+fixes:
+  - |
+    Refactor templates in lf-c-cpp-jobs.yaml with common anchor/alias
+    lf_cmake_common to reduce redundant configuration.  This includes
+    gerrit-cmake-sonar, github-cmake-sonar, gerrit-cmake-sonarqube,
+    github-cmake-sonarqube, gerrit-cmake-stage, github-cmake-stage,
+    gerrit-cmake-verify and github-cmake-verify. No functional change.
+
+    Document maven settings parameters in g*t-cmake-stage templates.