X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=blobdiff_plain;f=jjb%2Flf-c-cpp-jobs.yaml;h=d59d073eb1220367f95d55c7029f028a0e314bc0;hb=35e5c8dbf87dc8657bfa1c2631d641f56d81ed07;hp=2eb394eea474e1e4bafc04a92ed13ee31dbeb6a7;hpb=7e66b111c22dec7fc341d593d33b74b4ca9d724b;p=releng%2Fglobal-jjb.git diff --git a/jjb/lf-c-cpp-jobs.yaml b/jjb/lf-c-cpp-jobs.yaml index 2eb394ee..d59d073e 100644 --- a/jjb/lf-c-cpp-jobs.yaml +++ b/jjb/lf-c-cpp-jobs.yaml @@ -1,10 +1,47 @@ --- -############### -# CMAKE Sonar # -############### +#################### +# AUTOTOOLS COMMON # +#################### -- lf_cmake_sonar: &lf_cmake_sonar - name: lf-cmake-sonar +- _lf_autotools_common: &lf_autotools_common + name: lf-autotools-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-autotools-parameters: + configure-opts: "{configure-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 + +################################ +# AUTOTOOLS PACKAGECLOUD STAGE # +################################ + +- _lf_autotools_packagecloud_stage: &lf_autotools_packagecloud_stage + name: lf-autotools-packagecloud-stage ###################### # Default parameters # @@ -12,55 +49,460 @@ branch: master build-days-to-keep: 7 - build-dir: '$WORKSPACE/target' + build-dir: "$WORKSPACE" # directory with deb/rpm files build-timeout: 15 - cmake-opts: '' - cron: '@daily' + configure-opts: "" disable-job: false - git-url: '$GIT_URL/$PROJECT' - github-url: 'https://github.com' - install-prefix: '$BUILD_DIR/output' - make-opts: '' - pre-build: '' - sonar-scanner-version: 3.3.0.1492 - sonarcloud-api-token: '' - sonarcloud-organization: '' - sonarcloud-project-key: '' + git-url: "$GIT_URL/$PROJECT" + github-url: "https://github.com" + install: false + install-prefix: $WORKSPACE/output + make-opts: "" # target that creates deb/rpm files + pre-build: | # default script to generate configure file + autoreconf --install + stream: master submodule-recursive: true submodule-timeout: 10 + submodule-disable: false + + gerrit_trigger_file_paths: + - compare-type: REG_EXP + pattern: ".*" + + # github_included_regions MUST match gerrit_trigger_file_paths + github_included_regions: + - ".*" + + parameters: + - lf-infra-parameters: + project: "{project}" + branch: "{branch}" + stream: "{stream}" + - lf-autotools-parameters: + configure-opts: "{configure-opts}" + install-prefix: "{install-prefix}" + make-opts: "{make-opts}" + - bool: + name: INSTALL + default: "{install}" + description: "Install build products to /usr/local (true/false)." + + builders: + - config-file-provider: + files: + - file-id: ".packagecloud" + target: "$HOME/.packagecloud" + - shell: "{pre-build}" + - shell: !include-raw-escape: ../shell/autotools-build.sh + - lf-packagecloud-push: + build-dir: "{build-dir}" + packagecloud-account: "{packagecloud-account}" + packagecloud-repo: "{packagecloud-repo}" + debian-distribution-versions: "{debian-distribution-versions}" + rpm-distribution-versions: "{rpm-distribution-versions}" + +- job-template: + # build with configure/make and publish to PackageCloud on command + name: "{project-name}-autotools-packagecloud-stage-{stream}" + id: gerrit-autotools-packagecloud-stage + <<: *lf_autotools_common + <<: *lf_autotools_packagecloud_stage + + ###################### + # Default parameters # + ###################### + + gerrit_stage_triggers: + - comment-added-contains-event: + comment-contains-value: '^Patch Set\s+\d+:\s+stage-release\s*$' + + ##################### + # Job Configuration # + ##################### + + scm: + - lf-infra-gerrit-scm: + jenkins-ssh-credential: "{jenkins-ssh-credential}" + git-url: "{git-url}" + refspec: "$GERRIT_REFSPEC" + branch: "$GERRIT_BRANCH" + submodule-recursive: "{submodule-recursive}" + submodule-timeout: "{submodule-timeout}" + submodule-disable: "{submodule-disable}" + # stage jobs always build from tip + choosing-strategy: default + + triggers: + - gerrit: + server-name: "{gerrit-server-name}" + trigger-on: "{obj:gerrit_stage_triggers}" + projects: + - project-compare-type: ANT + project-pattern: "{project}" + branches: + - branch-compare-type: ANT + branch-pattern: "**/{branch}" + file-paths: "{obj:gerrit_trigger_file_paths}" + +- job-template: + name: "{project-name}-autotools-packagecloud-stage-{stream}" + id: github-autotools-packagecloud-stage + concurrent: true + <<: *lf_autotools_common + <<: *lf_autotools_packagecloud_stage + + properties: + - lf-infra-properties: + build-days-to-keep: "{build-days-to-keep}" + - github: + url: "{github-url}/{github-org}/{project}" + + scm: + - lf-infra-github-scm: + url: "{git-clone-url}{github-org}/{project}" + refspec: "+refs/pull/*:refs/remotes/origin/pr/*" + branch: "$sha1" + submodule-recursive: "{submodule-recursive}" + submodule-timeout: "{submodule-timeout}" + submodule-disable: "{submodule-disable}" + choosing-strategy: default + jenkins-ssh-credential: "{jenkins-ssh-credential}" + + triggers: + - github-pull-request: + trigger-phrase: "^(stage-release)$" + only-trigger-phrase: true + status-context: "Autotools PackageCloud Stage" + permit-all: true + github-hooks: true + white-list-target-branches: + - "{branch}" + +####################### +# AUTOTOOLS SONARQUBE # +####################### + +- _lf_autotools_sonarqube: &lf_autotools_sonarqube + name: lf-autotools-sonarqube + + ###################### + # Default parameters # + ###################### + + branch: master # Sonar should always be run on master branch + build-days-to-keep: 7 + build-timeout: 15 + build-wrap-dir: $WORKSPACE/bw-output + configure-opts: CXXFLAGS="-O0 --coverage" LDFLAGS=--coverage # gcc coverage options + cron: "@weekly" + disable-job: false + git-url: "$GIT_URL/$PROJECT" + github-url: "https://github.com" + install-prefix: $WORKSPACE/output + make-opts: "" # target that tests and generates gcov files + pre-build: | # default script to generate configure file + autoreconf --install + stream: master + submodule-recursive: true + submodule-timeout: 10 + submodule-disable: false + + # Sonar properties + sonar-additional-args: "" + sonar-java-opts: "" + sonar-project-file: sonar-project.properties + sonar-properties: "" + sonar-task: "" + sonar-jdk: openjdk17 + + parameters: + - lf-infra-parameters: + project: "{project}" + branch: "{branch}" + stream: "{stream}" + - lf-autotools-parameters: + configure-opts: "{configure-opts}" + install-prefix: "{install-prefix}" + make-opts: "{make-opts}" + - string: + name: BUILD_WRAP_DIR + default: "{build-wrap-dir}" + description: SonarQube build wrapper output directory + + builders: + - shell: "{pre-build}" + - shell: !include-raw-escape: ../shell/autotools-sonarqube.sh + - lf-infra-sonar: + sonar-task: "{sonar-task}" + sonar-project-file: "{sonar-project-file}" + sonar-properties: "{sonar-properties}" + sonar-java-opts: "{sonar-java-opts}" + sonar-additional-args: "{sonar-additional-args}" + sonar-jdk: "{sonar-jdk}" + +- job-template: + name: "{project-name}-autotools-sonarqube" + id: gerrit-autotools-sonarqube + concurrent: false + <<: *lf_autotools_common + <<: *lf_autotools_sonarqube + + gerrit_sonar_triggers: + - comment-added-contains-event: + comment-contains-value: '^Patch Set\s+\d+:\s+run-sonar\s*$' + + scm: + - lf-infra-gerrit-scm: + branch: "$GERRIT_BRANCH" + jenkins-ssh-credential: "{jenkins-ssh-credential}" + git-url: "{git-url}" + refspec: "$GERRIT_REFSPEC" + submodule-recursive: "{submodule-recursive}" + submodule-timeout: "{submodule-timeout}" + submodule-disable: "{submodule-disable}" + choosing-strategy: default + + triggers: + - timed: "{obj:cron}" + - gerrit: + server-name: "{gerrit-server-name}" + trigger-on: "{obj:gerrit_sonar_triggers}" + projects: + - project-compare-type: "ANT" + project-pattern: "{project}" + branches: + - branch-compare-type: "ANT" + branch-pattern: "**/{branch}" + +- job-template: + name: "{project-name}-autotools-sonarqube" + id: github-autotools-sonarqube + concurrent: false + <<: *lf_autotools_common + <<: *lf_autotools_sonarqube + + scm: + - lf-infra-github-scm: + branch: "$sha1" + jenkins-ssh-credential: "{jenkins-ssh-credential}" + url: "{git-clone-url}{github-org}/{project}" + refspec: "+refs/pull/*:refs/remotes/origin/pr/*" + submodule-recursive: "{submodule-recursive}" + submodule-timeout: "{submodule-timeout}" + submodule-disable: "{submodule-disable}" + choosing-strategy: default + + triggers: + - github-pull-request: + trigger-phrase: "^run-sonar$" + only-trigger-phrase: false + status-context: "Autotools Sonarqube" + permit-all: true + github-hooks: true + white-list-target-branches: + - "{branch}" + +#################### +# AUTOTOOLS VERIFY # +#################### + +- _lf_autotools_verify: &lf_autotools_verify + name: lf-autotools-verify + + ###################### + # Default parameters # + ###################### + + branch: master + build-days-to-keep: 7 + build-timeout: 15 + configure-opts: "" + disable-job: false + git-url: "$GIT_URL/$PROJECT" + github-url: "https://github.com" + install: false + install-prefix: $WORKSPACE/output + make-opts: "test" # target that compiles and tests + pre-build: | # default script to generate configure file + autoreconf --install + stream: master + submodule-recursive: true + submodule-timeout: 10 + submodule-disable: false + + gerrit_verify_triggers: + - patchset-created-event: + exclude-drafts: true + exclude-trivial-rebase: false + exclude-no-code-change: false + - draft-published-event + - comment-added-contains-event: + comment-contains-value: '^Patch Set\s+\d+:\s+(recheck|reverify)\s*$' + + gerrit_trigger_file_paths: + - compare-type: REG_EXP + pattern: ".*" + + # github_included_regions MUST match gerrit_trigger_file_paths + github_included_regions: + - ".*" + + parameters: + - lf-infra-parameters: + project: "{project}" + branch: "{branch}" + stream: "{stream}" + - lf-autotools-parameters: + configure-opts: "{configure-opts}" + install-prefix: "{install-prefix}" + make-opts: "{make-opts}" + - bool: + name: INSTALL + default: "{install}" + description: "Install build products to /usr/local (true/false)." + + builders: + - shell: "{pre-build}" + - shell: !include-raw-escape: ../shell/autotools-build.sh + +- job-template: + name: "{project-name}-autotools-verify-{stream}" + id: gerrit-autotools-verify + concurrent: true + <<: *lf_autotools_common + <<: *lf_autotools_verify + + scm: + - lf-infra-gerrit-scm: + branch: "$GERRIT_BRANCH" + jenkins-ssh-credential: "{jenkins-ssh-credential}" + git-url: "{git-url}" + refspec: "$GERRIT_REFSPEC" + submodule-recursive: "{submodule-recursive}" + submodule-timeout: "{submodule-timeout}" + submodule-disable: "{submodule-disable}" + choosing-strategy: gerrit + + triggers: + - gerrit: + server-name: "{gerrit-server-name}" + trigger-on: "{obj:gerrit_verify_triggers}" + projects: + - project-compare-type: "ANT" + project-pattern: "{project}" + branches: + - branch-compare-type: "ANT" + branch-pattern: "**/{branch}" + file-paths: "{obj:gerrit_trigger_file_paths}" + +- job-template: + name: "{project-name}-autotools-verify-{stream}" + id: github-autotools-verify + concurrent: true + <<: *lf_autotools_common + <<: *lf_autotools_verify + + properties: + - lf-infra-properties: + build-days-to-keep: "{build-days-to-keep}" + - github: + url: "{github-url}/{github-org}/{project}" + + scm: + - lf-infra-github-scm: + url: "{git-clone-url}{github-org}/{project}" + refspec: "+refs/pull/*:refs/remotes/origin/pr/*" + branch: "$sha1" + submodule-recursive: "{submodule-recursive}" + submodule-timeout: "{submodule-timeout}" + submodule-disable: "{submodule-disable}" + choosing-strategy: default + jenkins-ssh-credential: "{jenkins-ssh-credential}" + + triggers: + - github-pull-request: + trigger-phrase: "^(recheck|reverify)$" + only-trigger-phrase: false + status-context: "Autotools Verify" + permit-all: true + github-hooks: true + included-regions: "{obj:github_included_regions}" + white-list-target-branches: + - "{branch}" + +################ +# CMAKE COMMON # +################ + +- _lf_cmake_common: &lf_cmake_common + name: lf-cmake-common ##################### # Job Configuration # ##################### project-type: freestyle - node: '{build-node}' - disabled: '{disable-job}' + node: "{build-node}" + disabled: "{disable-job}" properties: - lf-infra-properties: - build-days-to-keep: '{build-days-to-keep}' + build-days-to-keep: "{build-days-to-keep}" parameters: - lf-infra-parameters: - project: '{project}' - branch: '{branch}' - stream: '{stream}' - lftools-version: '{lftools-version}' + 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}' + 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}' + build-timeout: "{build-timeout}" + jenkins-ssh-credential: "{jenkins-ssh-credential}" + + publishers: + - lf-infra-publish + +############### +# CMAKE SONAR # +############### + +- _lf_cmake_sonar: &lf_cmake_sonar + name: lf-cmake-sonar + + ###################### + # Default parameters # + ###################### + + branch: master + build-days-to-keep: 7 + build-dir: "$WORKSPACE/target" + build-timeout: 15 + cmake-opts: "" + cron: "@daily" + disable-job: false + git-url: "$GIT_URL/$PROJECT" + github-url: "https://github.com" + install-prefix: "$BUILD_DIR/output" + make-opts: "" + pre-build: "" + sonar-scanner-version: 3.3.0.1492 + sonarcloud-api-token-cred-id: sonarcloud-api-token + sonarcloud-organization: "" + sonarcloud-project-key: "" + stream: master + submodule-recursive: true + submodule-timeout: 10 + submodule-disable: false builders: - lf-infra-pre-build - - shell: '{pre-build}' + - shell: "{pre-build}" - inject: # Switch this to the sonar wrapper when JJB 2.0 is available properties-content: | @@ -68,74 +510,211 @@ SONAR_SCANNER_VERSION={sonar-scanner-version} PROJECT_KEY={sonarcloud-project-key} PROJECT_ORGANIZATION={sonarcloud-organization} - API_TOKEN={sonarcloud-api-token} - shell: !include-raw-escape: ../shell/cmake-sonar.sh - lf-provide-maven-settings-cleanup - publishers: - - lf-infra-publish + wrappers: + - credentials-binding: + - text: + credential-id: "{sonarcloud-api-token-cred-id}" + variable: API_TOKEN - job-template: - name: '{project-name}-cmake-sonar' + name: "{project-name}-cmake-sonar" id: gerrit-cmake-sonar concurrent: false + <<: *lf_cmake_common <<: *lf_cmake_sonar scm: - lf-infra-gerrit-scm: - branch: '$GERRIT_BRANCH' - jenkins-ssh-credential: '{jenkins-ssh-credential}' - git-url: '{git-url}' - refspec: '$GERRIT_REFSPEC' - submodule-recursive: '{submodule-recursive}' - submodule-timeout: '{submodule-timeout}' + branch: "$GERRIT_BRANCH" + jenkins-ssh-credential: "{jenkins-ssh-credential}" + git-url: "{git-url}" + refspec: "$GERRIT_REFSPEC" + submodule-recursive: "{submodule-recursive}" + submodule-timeout: "{submodule-timeout}" + submodule-disable: "{submodule-disable}" choosing-strategy: gerrit triggers: - - timed: '{obj:cron}' + - timed: "{obj:cron}" - gerrit: - server-name: '{gerrit-server-name}' + server-name: "{gerrit-server-name}" trigger-on: - comment-added-contains-event: - comment-contains-value: '^Patch Set[ ]+[0-9]+:([ ]+|[\n]+)(stage-release)$' + comment-contains-value: '^Patch Set\s+\d+:\s+run-sonar\s*$' projects: - - project-compare-type: 'ANT' - project-pattern: '{project}' + - project-compare-type: "ANT" + project-pattern: "{project}" branches: - - branch-compare-type: 'ANT' - branch-pattern: '**/{branch}' + - branch-compare-type: "ANT" + branch-pattern: "**/{branch}" - job-template: - name: '{project-name}-cmake-sonar' + name: "{project-name}-cmake-sonar" id: github-cmake-sonar concurrent: false + <<: *lf_cmake_common <<: *lf_cmake_sonar properties: - lf-infra-properties: - build-days-to-keep: '{build-days-to-keep}' + build-days-to-keep: "{build-days-to-keep}" - github: - url: '{github-url}/{github-org}/{project}' + url: "{github-url}/{github-org}/{project}" scm: - lf-infra-github-scm: - url: '{git-clone-url}{github-org}/{project}' - refspec: '+refs/pull/*:refs/remotes/origin/pr/*' - branch: '$sha1' - submodule-recursive: '{submodule-recursive}' - submodule-timeout: '{submodule-timeout}' + url: "{git-clone-url}{github-org}/{project}" + refspec: "+refs/pull/*:refs/remotes/origin/pr/*" + branch: "$sha1" + submodule-recursive: "{submodule-recursive}" + submodule-timeout: "{submodule-timeout}" + submodule-disable: "{submodule-disable}" + choosing-strategy: default + jenkins-ssh-credential: "{jenkins-ssh-credential}" + + triggers: + - timed: "{obj:cron}" + +################### +# CMAKE SONARQUBE # +################### + +- _lf_cmake_sonarqube: &lf_cmake_sonarqube + name: lf-cmake-sonarqube + + ###################### + # Default parameters # + ###################### + + archive-artifacts: > + **/*.log + branch: master # Sonar should always be run on master branch + build-days-to-keep: 7 + build-dir: "$WORKSPACE/build" + build-timeout: 15 + build-wrap-dir: "$WORKSPACE/bw-output" + cmake-opts: "" + cron: "@weekly" + disable-job: false + git-url: "$GIT_URL/$PROJECT" + github-url: "https://github.com" + install-prefix: "$BUILD_DIR/output" + make-opts: "" + pre-build: "" + stream: master + submodule-recursive: true + submodule-timeout: 10 + submodule-disable: false + + # Sonar properties + sonar-additional-args: "" + sonar-java-opts: "" + sonar-project-file: "sonar-project.properties" + sonar-properties: "" + sonar-task: "" + sonar-jdk: openjdk17 + + 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}" + - string: + name: ARCHIVE_ARTIFACTS + default: "{archive-artifacts}" + description: Artifacts to archive to the logs server. + - string: + name: BUILD_WRAP_DIR + default: "{build-wrap-dir}" + description: SonarQube build wrapper output directory. + + builders: + - lf-infra-pre-build + - shell: "{pre-build}" + - shell: !include-raw-escape: ../shell/cmake-sonarqube.sh + - lf-infra-sonar: + sonar-task: "{sonar-task}" + sonar-project-file: "{sonar-project-file}" + sonar-properties: "{sonar-properties}" + sonar-java-opts: "{sonar-java-opts}" + sonar-additional-args: "{sonar-additional-args}" + sonar-jdk: "{sonar-jdk}" + +- job-template: + name: "{project-name}-cmake-sonarqube" + id: gerrit-cmake-sonarqube + concurrent: false + <<: *lf_cmake_common + <<: *lf_cmake_sonarqube + + gerrit_sonar_triggers: + - comment-added-contains-event: + comment-contains-value: '^Patch Set\s+\d+:\s+run-sonar\s*$' + + scm: + - lf-infra-gerrit-scm: + branch: "$GERRIT_BRANCH" + jenkins-ssh-credential: "{jenkins-ssh-credential}" + git-url: "{git-url}" + refspec: "$GERRIT_REFSPEC" + submodule-recursive: "{submodule-recursive}" + submodule-timeout: "{submodule-timeout}" + submodule-disable: "{submodule-disable}" choosing-strategy: default - jenkins-ssh-credential: '{jenkins-ssh-credential}' triggers: - - timed: '{obj:cron}' + - timed: "{obj:cron}" + - gerrit: + server-name: "{gerrit-server-name}" + trigger-on: "{obj:gerrit_sonar_triggers}" + projects: + - project-compare-type: "ANT" + project-pattern: "{project}" + branches: + - branch-compare-type: "ANT" + branch-pattern: "**/{branch}" + +- job-template: + name: "{project-name}-cmake-sonarqube" + id: github-cmake-sonarqube + concurrent: false + <<: *lf_cmake_common + <<: *lf_cmake_sonarqube + scm: + - lf-infra-github-scm: + branch: "$sha1" + jenkins-ssh-credential: "{jenkins-ssh-credential}" + url: "{git-clone-url}{github-org}/{project}" + refspec: "+refs/pull/*:refs/remotes/origin/pr/*" + submodule-recursive: "{submodule-recursive}" + submodule-timeout: "{submodule-timeout}" + submodule-disable: "{submodule-disable}" + choosing-strategy: default + + triggers: + - github-pull-request: + trigger-phrase: "^run-sonar$" + only-trigger-phrase: false + status-context: "CMake Sonarqube" + permit-all: true + github-hooks: true + white-list-target-branches: + - "{branch}" ############### # CMAKE STAGE # ############### -- lf_cmake_stage: &lf_cmake_stage +- _lf_cmake_stage: &lf_cmake_stage name: lf-cmake-stage ###################### @@ -144,166 +723,297 @@ branch: master build-days-to-keep: 7 - build-dir: '$WORKSPACE/target' + build-dir: "$WORKSPACE/target" build-timeout: 15 - cmake-opts: '' - cron: '@daily' + cmake-opts: "" + cron: "@daily" disable-job: false - git-url: '$GIT_URL/$PROJECT' - github-url: 'https://github.com' - install-prefix: '$BUILD_DIR/output' - make-opts: '' + git-url: "$GIT_URL/$PROJECT" + github-url: "https://github.com" + install: true + install-prefix: "$BUILD_DIR/output" + make-opts: "" mvn-global-settings: global-settings - pre-build: '' + pre-build: "" stream: master submodule-recursive: true submodule-timeout: 10 - version: '' - - ##################### - # Job Configuration # - ##################### - - project-type: freestyle - node: '{build-node}' - disabled: '{disable-job}' - - properties: - - lf-infra-properties: - build-days-to-keep: '{build-days-to-keep}' + submodule-disable: false + version: "" parameters: - lf-infra-parameters: - project: '{project}' - branch: '{branch}' - stream: '{stream}' + 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}' + build-dir: "{build-dir}" + cmake-opts: "{cmake-opts}" + install-prefix: "{install-prefix}" + make-opts: "{make-opts}" + - bool: + name: INSTALL + default: "{install}" + description: "Install build products to /usr/local (true/false)." - string: name: NEXUS_GROUP_ID - default: '{nexus-group-id}' - description: 'Project Group ID in Nexus to upload to.' + default: "{nexus-group-id}" + description: "Project Group ID in Nexus to upload to." - string: name: STAGING_PROFILE_ID - default: '{staging-profile-id}' - description: 'Nexus staging profile ID.' + default: "{staging-profile-id}" + description: "Nexus staging profile ID." - string: name: VERSION - default: '{version}' + default: "{version}" description: | - (default: '') + (default: '') - Project version to stage release as. There are 2 methods for - using this value: + Project version to stage release as. There are 2 methods for + using this value: - 1) Defined explicitly here. - 2) Leave this value blank and set /tmp/artifact_version + 1) Defined explicitly here. + 2) Leave this value blank and set /tmp/artifact_version - Use method 2 in conjunction with 'pre-build' configuration to - generate the artifact_version automatically from files in the - project's repository. For example with pre-build script: + Use method 2 in conjunction with 'pre-build' configuration to + generate the artifact_version automatically from files in the + project's repository. For example with pre-build script: - #!/bin/bash - MAJOR_VERSION="$(grep 'set(OCIO_VERSION_MAJOR' CMakeLists.txt \ - | awk '{{print $NF}}' | awk -F')' '{{print $1}}')" - MINOR_VERSION="$(grep 'set(OCIO_VERSION_MINOR' CMakeLists.txt \ - | awk '{{print $NF}}' | awk -F')' '{{print $1}}')" - PATCH_VERSION="$(grep 'set(OCIO_VERSION_PATCH' CMakeLists.txt \ - | 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}' + #!/bin/bash + MAJOR_VERSION="$(grep 'set(OCIO_VERSION_MAJOR' CMakeLists.txt \ + | awk '{{print $NF}}' | awk -F')' '{{print $1}}')" + MINOR_VERSION="$(grep 'set(OCIO_VERSION_MINOR' CMakeLists.txt \ + | awk '{{print $NF}}' | awk -F')' '{{print $1}}')" + PATCH_VERSION="$(grep 'set(OCIO_VERSION_PATCH' CMakeLists.txt \ + | awk '{{print $NF}}' | awk -F')' '{{print $1}}')" + echo "${{MAJOR_VERSION}}.${{MINOR_VERSION}}.${{PATCH_VERSION}}" > /tmp/artifact_version builders: - lf-infra-pre-build - lf-provide-maven-settings: - global-settings-file: '{mvn-global-settings}' - settings-file: '{mvn-settings}' + global-settings-file: "{mvn-global-settings}" + settings-file: "{mvn-settings}" - lf-infra-create-netrc: server-id: staging - - shell: '{pre-build}' + - shell: "{pre-build}" - shell: !include-raw-escape: ../shell/cmake-build.sh - 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}' + name: "{project-name}-cmake-stage-{stream}" id: gerrit-cmake-stage concurrent: true + <<: *lf_cmake_common <<: *lf_cmake_stage scm: - lf-infra-gerrit-scm: - branch: '$GERRIT_BRANCH' - jenkins-ssh-credential: '{jenkins-ssh-credential}' - git-url: '{git-url}' - refspec: '$GERRIT_REFSPEC' - submodule-recursive: '{submodule-recursive}' - submodule-timeout: '{submodule-timeout}' + branch: "$GERRIT_BRANCH" + jenkins-ssh-credential: "{jenkins-ssh-credential}" + git-url: "{git-url}" + refspec: "$GERRIT_REFSPEC" + submodule-recursive: "{submodule-recursive}" + submodule-timeout: "{submodule-timeout}" + submodule-disable: "{submodule-disable}" choosing-strategy: gerrit triggers: - - timed: '{obj:cron}' + - timed: "{obj:cron}" - gerrit: - server-name: '{gerrit-server-name}' + server-name: "{gerrit-server-name}" trigger-on: - comment-added-contains-event: - comment-contains-value: '^Patch Set[ ]+[0-9]+:([ ]+|[\n]+)(stage-release)$' + comment-contains-value: '^Patch Set\s+\d+:\s+stage-release\s*$' projects: - - project-compare-type: 'ANT' - project-pattern: '{project}' + - project-compare-type: "ANT" + project-pattern: "{project}" branches: - - branch-compare-type: 'ANT' - branch-pattern: '**/{branch}' + - branch-compare-type: "ANT" + branch-pattern: "**/{branch}" - job-template: - name: '{project-name}-cmake-stage-{stream}' + name: "{project-name}-cmake-stage-{stream}" id: github-cmake-stage concurrent: true + <<: *lf_cmake_common <<: *lf_cmake_stage properties: - lf-infra-properties: - build-days-to-keep: '{build-days-to-keep}' + build-days-to-keep: "{build-days-to-keep}" - github: - url: '{github-url}/{github-org}/{project}' + url: "{github-url}/{github-org}/{project}" scm: - lf-infra-github-scm: - url: '{git-clone-url}{github-org}/{project}' - refspec: '+refs/pull/*:refs/remotes/origin/pr/*' - branch: '$sha1' - submodule-recursive: '{submodule-recursive}' - submodule-timeout: '{submodule-timeout}' + url: "{git-clone-url}{github-org}/{project}" + refspec: "+refs/pull/*:refs/remotes/origin/pr/*" + branch: "$sha1" + submodule-recursive: "{submodule-recursive}" + submodule-timeout: "{submodule-timeout}" + submodule-disable: "{submodule-disable}" choosing-strategy: default - jenkins-ssh-credential: '{jenkins-ssh-credential}' + jenkins-ssh-credential: "{jenkins-ssh-credential}" triggers: - - timed: '{obj:cron}' + - timed: "{obj:cron}" - github-pull-request: - trigger-phrase: '^(stage-release)$' + trigger-phrase: "^(stage-release)$" only-trigger-phrase: true - status-context: 'CMake Stage' + status-context: "CMake Stage" permit-all: true github-hooks: true white-list-target-branches: - - '{branch}' + - "{branch}" +############################ +# CMAKE PACKAGECLOUD STAGE # +############################ + +- _lf_cmake_pc_stage: &lf_cmake_pc_stage + name: lf-cmake-packagecloud-stage + + ###################### + # Default parameters # + ###################### + + branch: master + build-days-to-keep: 7 + build-dir: "$WORKSPACE/build" + build-timeout: 15 + cmake-opts: "" + disable-job: false + git-url: "$GIT_URL/$PROJECT" + github-url: "https://github.com" + install: false + install-prefix: "$BUILD_DIR/output" + make-opts: "" + pre-build: "" + stream: master + submodule-recursive: true + submodule-timeout: 10 + submodule-disable: false + + gerrit_trigger_file_paths: + - compare-type: REG_EXP + pattern: ".*" + + # github_included_regions MUST match gerrit_trigger_file_paths + github_included_regions: + - ".*" + + 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}" + - bool: + name: INSTALL + default: "{install}" + description: "Install build products to /usr/local (true/false)." + + builders: + - config-file-provider: + files: + - file-id: ".packagecloud" + target: "$HOME/.packagecloud" + - shell: "{pre-build}" + - shell: !include-raw-escape: ../shell/cmake-build.sh + - lf-packagecloud-push: + build-dir: "{build-dir}" + packagecloud-account: "{packagecloud-account}" + packagecloud-repo: "{packagecloud-repo}" + debian-distribution-versions: "{debian-distribution-versions}" + rpm-distribution-versions: "{rpm-distribution-versions}" + +- job-template: + # build with cmake and publish to PackageCloud on command + name: "{project-name}-cmake-packagecloud-stage-{stream}" + id: gerrit-cmake-packagecloud-stage + <<: *lf_cmake_common + <<: *lf_cmake_pc_stage + + ###################### + # Default parameters # + ###################### + + gerrit_stage_triggers: + - comment-added-contains-event: + comment-contains-value: '^Patch Set\s+\d+:\s+stage-release\s*$' + + ##################### + # Job Configuration # + ##################### + + scm: + - lf-infra-gerrit-scm: + jenkins-ssh-credential: "{jenkins-ssh-credential}" + git-url: "{git-url}" + refspec: "$GERRIT_REFSPEC" + branch: "$GERRIT_BRANCH" + submodule-recursive: "{submodule-recursive}" + submodule-timeout: "{submodule-timeout}" + submodule-disable: "{submodule-disable}" + # stage jobs always build from tip + choosing-strategy: default + + triggers: + - gerrit: + server-name: "{gerrit-server-name}" + trigger-on: "{obj:gerrit_stage_triggers}" + projects: + - project-compare-type: ANT + project-pattern: "{project}" + branches: + - branch-compare-type: ANT + branch-pattern: "**/{branch}" + file-paths: "{obj:gerrit_trigger_file_paths}" + +- job-template: + name: "{project-name}-cmake-packagecloud-stage-{stream}" + id: github-cmake-packagecloud-stage + concurrent: true + <<: *lf_cmake_common + <<: *lf_cmake_pc_stage + + properties: + - lf-infra-properties: + build-days-to-keep: "{build-days-to-keep}" + - github: + url: "{github-url}/{github-org}/{project}" + + scm: + - lf-infra-github-scm: + url: "{git-clone-url}{github-org}/{project}" + refspec: "+refs/pull/*:refs/remotes/origin/pr/*" + branch: "$sha1" + submodule-recursive: "{submodule-recursive}" + submodule-timeout: "{submodule-timeout}" + submodule-disable: "{submodule-disable}" + choosing-strategy: default + jenkins-ssh-credential: "{jenkins-ssh-credential}" + + triggers: + - github-pull-request: + trigger-phrase: "^(stage-release)$" + only-trigger-phrase: true + status-context: "CMake PackageCloud Stage" + permit-all: true + github-hooks: true + white-list-target-branches: + - "{branch}" ################ # CMAKE VERIFY # ################ -- lf_cmake_verify: &lf_cmake_verify +- _lf_cmake_verify: &lf_cmake_verify name: lf-cmake-verify ###################### @@ -312,18 +1022,20 @@ branch: master build-days-to-keep: 7 - build-dir: '$WORKSPACE/target' + build-dir: "$WORKSPACE/target" build-timeout: 15 - cmake-opts: '' + cmake-opts: "" disable-job: false - git-url: '$GIT_URL/$PROJECT' - github-url: 'https://github.com' - install-prefix: '$BUILD_DIR/output' - make-opts: '' - pre-build: '' + git-url: "$GIT_URL/$PROJECT" + github-url: "https://github.com" + install: true + install-prefix: "$BUILD_DIR/output" + make-opts: "" + pre-build: "" stream: master submodule-recursive: true submodule-timeout: 10 + submodule-disable: false gerrit_verify_triggers: - patchset-created-event: @@ -332,108 +1044,96 @@ exclude-no-code-change: false - draft-published-event - comment-added-contains-event: - comment-contains-value: '^Patch Set[ ]+[0-9]+:([ ]+|[\n]+)(recheck|reverify)$' + comment-contains-value: '^Patch Set\s+\d+:\s+(recheck|reverify)\s*$' gerrit_trigger_file_paths: - compare-type: REG_EXP - pattern: '.*' + pattern: ".*" # github_included_regions MUST match gerrit_trigger_file_paths 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}' + 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}' + build-dir: "{build-dir}" + cmake-opts: "{cmake-opts}" + install-prefix: "{install-prefix}" + make-opts: "{make-opts}" + - bool: + name: INSTALL + default: "{install}" + description: "Install build products to /usr/local (true/false)." builders: - - shell: '{pre-build}' + - shell: "{pre-build}" - shell: !include-raw-escape: ../shell/cmake-build.sh - publishers: - - lf-infra-publish - - job-template: - name: '{project-name}-cmake-verify-{stream}' + name: "{project-name}-cmake-verify-{stream}" id: gerrit-cmake-verify concurrent: true + <<: *lf_cmake_common <<: *lf_cmake_verify scm: - lf-infra-gerrit-scm: - branch: '$GERRIT_BRANCH' - jenkins-ssh-credential: '{jenkins-ssh-credential}' - git-url: '{git-url}' - refspec: '$GERRIT_REFSPEC' - submodule-recursive: '{submodule-recursive}' - submodule-timeout: '{submodule-timeout}' + branch: "$GERRIT_BRANCH" + jenkins-ssh-credential: "{jenkins-ssh-credential}" + git-url: "{git-url}" + refspec: "$GERRIT_REFSPEC" + submodule-recursive: "{submodule-recursive}" + submodule-timeout: "{submodule-timeout}" + submodule-disable: "{submodule-disable}" choosing-strategy: gerrit triggers: - gerrit: - server-name: '{gerrit-server-name}' - trigger-on: '{obj:gerrit_verify_triggers}' + server-name: "{gerrit-server-name}" + trigger-on: "{obj:gerrit_verify_triggers}" projects: - - project-compare-type: 'ANT' - project-pattern: '{project}' + - project-compare-type: "ANT" + project-pattern: "{project}" branches: - - branch-compare-type: 'ANT' - branch-pattern: '**/{branch}' - file-paths: '{obj:gerrit_trigger_file_paths}' + - branch-compare-type: "ANT" + branch-pattern: "**/{branch}" + file-paths: "{obj:gerrit_trigger_file_paths}" - job-template: - name: '{project-name}-cmake-verify-{stream}' + name: "{project-name}-cmake-verify-{stream}" id: github-cmake-verify concurrent: true + <<: *lf_cmake_common <<: *lf_cmake_verify properties: - lf-infra-properties: - build-days-to-keep: '{build-days-to-keep}' + build-days-to-keep: "{build-days-to-keep}" - github: - url: '{github-url}/{github-org}/{project}' + url: "{github-url}/{github-org}/{project}" scm: - lf-infra-github-scm: - url: '{git-clone-url}{github-org}/{project}' - refspec: '+refs/pull/*:refs/remotes/origin/pr/*' - branch: '$sha1' - submodule-recursive: '{submodule-recursive}' - submodule-timeout: '{submodule-timeout}' + url: "{git-clone-url}{github-org}/{project}" + refspec: "+refs/pull/*:refs/remotes/origin/pr/*" + branch: "$sha1" + submodule-recursive: "{submodule-recursive}" + submodule-timeout: "{submodule-timeout}" + submodule-disable: "{submodule-disable}" choosing-strategy: default - jenkins-ssh-credential: '{jenkins-ssh-credential}' + jenkins-ssh-credential: "{jenkins-ssh-credential}" triggers: - github-pull-request: - trigger-phrase: '^(recheck|reverify)$' + trigger-phrase: "^(recheck|reverify)$" only-trigger-phrase: false - status-context: 'CMake Verify' + status-context: "CMake Verify" permit-all: true github-hooks: true - included-regions: '{obj:github_included_regions}' + included-regions: "{obj:github_included_regions}" white-list-target-branches: - - '{branch}' + - "{branch}"