Refactor lf-c-cpp-jobs for common anchor
[releng/global-jjb.git] / jjb / lf-c-cpp-jobs.yaml
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: