Add macro section headers and new macros
[releng/global-jjb.git] / jjb / lf-macros.yaml
index 0c0e69b..f90625e 100644 (file)
@@ -1,6 +1,7 @@
 ---
+# BUILDERS
 - builder:
-    name: create-netrc
+    name: lf-infra-create-netrc
     # Macro to create a ~/.netrc file from a Maven settings.xml
     # Parameters:
     #     {server-id} The id of a server as defined in settings.xml
@@ -10,7 +11,7 @@
       - shell: !include-raw-escape: ../shell/create-netrc.sh
 
 - builder:
-    name: gpg-verify-git-signature
+    name: lf-infra-gpg-verify-git-signature
     # Verify gpg signature of the latest commit message in $WORKSPACE
     #
     # This command assumes that $WORKSPACE is a git repo.
@@ -29,7 +30,7 @@
           files:
             - file-id: 'jenkins-log-archives-settings'
               variable: 'SETTINGS_FILE'
-      - create-netrc:
+      - lf-infra-create-netrc:
           server-id: logs
       - shell: !include-raw:
           - ../shell/lftools-install.sh
       - description-setter:
           regexp: '^Build logs: .*'
 
+- builder:
+    name: lf-jacoco-nojava-workaround
+    builders:
+      - shell: 'mkdir -p $WORKSPACE/target/classes $WORKSPACE/jacoco/classes'
+
+# call maven-target builder with a goal of --version to force Jenkins to
+# install the needed maven version
+- builder:
+    name: lf-maven-install
+    builders:
+      - maven-target:
+          maven-version: '{maven-version}'
+          goals: '--version'
+
+# Push a global settings and user settings maven files
+- builder:
+    name: lf-provide-maven-settings
+    builders:
+      - config-file-provider:
+          files:
+            - file-id: '{global-settings-file}'
+              variable: 'GLOBAL_SETTINGS_FILE'
+            - file-id: '{settings-file}'
+              variable: 'SETTINGS_FILE'
+
+
+# PARAMETERS
+# Standard parameters used in the LF CI environments. Gerrit variables are not
+# used by GitHub projects, but defining them isn't harmful
 - parameter:
     name: lf-infra-parameters
     parameters:
               Note that Gerrit will override this parameter automatically if a
               job is triggered by Gerrit.
 
+# Set an env var for shell scripts to be able to call the dynamically installed
+# maven without having to calculate the path themselves
+- parameter:
+    name: lf-maven-exec
+    parameters:
+      - string:
+          name: MVN
+          # yamllint disable-line rule:line-length
+          default: '/w/tools/hudson.tasks.Maven_MavenInstallation/{maven-version}/bin/mvn'
+          description: 'Maven selector to be used by shell scripts'
+
+
+# PROPERTIES
 - property:
     name: lf-infra-properties
     properties:
           # Do not allow artifacts to be stored in Jenkins.
           artifact-num-to-keep: 0
 
+# PUBLISHERS
 - publisher:
     name: lf-infra-publish
     # lf-infra macro to finish up a build.
             - '**/*.jenkins-trigger'
           fail-build: false
 
+# SCM
 - scm:
     name: lf-infra-gerrit-scm
     scm:
             recursive: '{submodule-recursive}'
           choosing-strategy: '{choosing-strategy}'
 
+- scm:
+    name: lf-infra-github-scm
+    scm:
+      - git:
+          credentials-id: '{jenkins-ssh-credential}'
+          url: '{url}'
+          refspec: '{refspec}'
+          skip-tag: true
+          wipe-workspace: true
+          submodule:
+            recursive: '{submodule-recursive}'
+          choosing-strategy: '{choosing-strategy}'
+
+# WRAPPERS
 - wrapper:
     name: lf-infra-wrappers
     wrappers: