Fix: Update lf-infra-sonar macro to use JDK version
[releng/global-jjb.git] / jjb / lf-macros.yaml
index 0db15aa..3ceda0d 100644 (file)
     builders:
       - shell: !include-raw: ../shell/comment-to-gerrit.sh
 
+- builder:
+    name: lf-ansible-config-file-provider
+    builders:
+      - config-file-provider:
+          files:
+            - file-id: "ansible-cfg"
+              target: "$HOME/.ansible/ansible.cfg"
+
 - builder:
     name: lf-fetch-dependent-patches
     builders:
       - shell: !include-raw-escape:
           - ../shell/license-check.sh
 
+- builder:
+    name: lf-infra-capture-instance-metadata
+    builders:
+      - shell: !include-raw:
+          - ../shell/capture-instance-metadata.sh
+
 - builder:
     name: lf-infra-create-netrc
     builders:
 - builder:
     name: lf-infra-packer-build
     builders:
+      - lf-ansible-config-file-provider
       - conditional-step:
           condition-kind: boolean-expression
           condition-expression: "{openstack}"
       - config-file-provider:
           files:
             - file-id: "{packer-cloud-settings}"
+              target: "$HOME/.config/jenkins_jobs/cloud-env.pkrvars.hcl"
               variable: CLOUDENV
       - inject:
           properties-content: |
+            PACKER_BUILDER={packer-builder}
             PACKER_PLATFORM={platform}
             PACKER_TEMPLATE={template}
             PACKER_VERSION={packer-version}
       - config-file-provider:
           files:
             - file-id: "{packer-cloud-settings}"
+              target: "$HOME/.config/jenkins_jobs/cloud-env.pkrvars.hcl"
               variable: CLOUDENV
       - inject:
           properties-content: |
           properties: "{sonar-properties}"
           java-opts: "{sonar-java-opts}"
           additional-arguments: "{sonar-additional-args}"
+          jdk: "{sonar-jdk}"
 
 - builder:
     name: lf-infra-sonar-with-prescan
           java-opts: "{sonar-java-opts}"
           additional-arguments: "{sonar-additional-args}"
 
+- builder:
+    name: lf-infra-pipeline-verify
+    builders:
+      - shell: !include-raw-escape: ../shell/pipeline-linter.sh
+
 ##############
 # PARAMETERS #
 ##############
           default: "{node-version}"
           description: Version of NodeJS to install.
 
+- parameter:
+    name: lf-infra-sonar-cli-parameters
+    parameters:
+      - string:
+          name: TOX_DIR
+          default: "{tox-dir}"
+          description: |
+            Path to directory containing tox.ini file.
+      - string:
+          name: TOX_ENVS
+          default: "{tox-envs}"
+          description: |
+            Tox environments to run build against.
+      - string:
+          name: SONAR_SCANNER_VERSION
+          default: "{sonar-scanner-version}"
+          description: |
+            Version of sonar scanner to use.
+            Example: 4.7.0.2747
+      - string:
+          name: SONAR_SCANNER_HOME
+          default: "{sonar-scanner-home}"
+          description: |
+            Sonar scanner home directory.
+            Example: $WORKSPACE/.sonar/sonar-scanner-$SONAR_SCANNER_VERSION-linux
+      - string:
+          name: SONAR_SCANNER_OPTS
+          default: "{sonar-scanner-opts}"
+          description: |
+            Sonar scanner Java options.
+            Example: -server
+
 - parameter:
     name: lf-infra-tox-parameters
     parameters:
           default: "{tox-envs}"
           description: |
             Tox environments to run build against.
-            Example: docs,py2,py3
+            Example: docs,py3
 
 - parameter:
     name: lf-build-with-parameters-maven-release
           name: LOG_DIR
           default: ""
           description: "Log dir, for example: project-maven-stage-master/17/"
+      - string:
+          name: OVERRIDE_SEMVER_REGEX
+          default: ""
+          description: "Override Semantic Version (SemVer) Regular Expression. Ex: '.*'"
       - choice:
           name: DISTRIBUTION_TYPE
           choices:
           class-pattern: "**/classes"
           source-pattern: "**/src/main/java"
           # yamllint disable-line rule:line-length
-          exclusion-pattern: "**/gen/**,**/generated-sources/**,**/yang-gen**,**/pax/**"
+          exclusion-pattern: "{exclude-pattern}"
           status-update: true
           targets:
             - branch:
               build-steps:
                 - lf-infra-sysstat
                 - lf-infra-package-listing
+                - lf-infra-capture-instance-metadata
                 - lf-infra-ship-logs
           mark-unstable-if-failed: true
       - workspace-cleanup:
             - "**/*.jenkins-trigger"
           fail-build: false
 
+- publisher:
+    name: global-jjb-email-notification
+    publishers:
+      - email-ext:
+          recipients: "{email-recipients}"
+          reply-to: ""
+          content-type: default
+          subject: "{email-prefix} $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS!"
+          body: |
+            $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS:
+
+            Please refer to the logs server URL for console logs when possible
+            and use the Jenkins Build URL as a last resort.
+
+            Jenkins Build URL:
+            $BUILD_URL
+          unstable: true
+          fixed: true
+          send-to:
+            - recipients
+
 #######
 # SCM #
 #######