From: Jessica Wagantall Date: Thu, 15 Jun 2023 20:06:27 +0000 (-0700) Subject: CI: Add initial gradle jobs file X-Git-Tag: v0.87.0^0 X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=commitdiff_plain;h=1afbd8edc78c9d6f5f1337791d31881fee49a376;p=releng%2Fglobal-jjb.git CI: Add initial gradle jobs file Issue: RELENG-4763 Signed-off-by: Jessica Wagantall Change-Id: I2d3d8627c0b9fa1e76b3d83ce5755c25fae79f8a --- diff --git a/.jjb-test/lf-gradle-jobs.yaml b/.jjb-test/lf-gradle-jobs.yaml new file mode 100644 index 00000000..cba15901 --- /dev/null +++ b/.jjb-test/lf-gradle-jobs.yaml @@ -0,0 +1,22 @@ +--- +- project: + name: gerrit-gradle-jobs + jobs: + - gerrit-gradle-build + + project-name: gerrit-gradle + +- project: + name: github-gradle-jobs + jobs: + - github-gradle-build + + github-org: fake-org + project-name: github-gradle + +- project: + name: gradle-jobs-view + views: + - project-view + + project-name: gradle diff --git a/docs/jjb/lf-gradle-jobs.rst b/docs/jjb/lf-gradle-jobs.rst new file mode 100644 index 00000000..98841d1e --- /dev/null +++ b/docs/jjb/lf-gradle-jobs.rst @@ -0,0 +1,39 @@ +########### +Gradle Jobs +########### + +Job Templates +============= + +Gradle Build +------------ + +Runs a gradle build command to perform the verification. + +:Template Names: + + - {project-name}-gradle-build-{stream} + +:Comment Trigger: recheck|reverify + +:Required parameters: + :build-node: The node to run build on. + :jenkins-ssh-credential: Credential to use for SSH. (Generally configured in defaults.yaml) + +:Optional parameters: + + :branch: The branch to build against. (default: master) + :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7) + :build-timeout: Timeout in minutes before aborting build. (default: 60) + :deploy-path: The path in Nexus to deploy javadoc to. (default: $PROJECT/$STREAM) + :git-url: URL clone project from. (default: $GIT_URL/$PROJECT) + :stream: Keyword that represents a release code-name. + Often the same as the branch. (default: master) + :submodule-recursive: Whether to checkout submodules recursively. + (default: true) + :submodule-timeout: Timeout (in minutes) for checkout operation. + (default: 10) + :submodule-disable: Disable submodule checkout operation. + (default: false) + + :gerrit_verify_triggers: Override Gerrit Triggers. diff --git a/jjb/lf-gradle-jobs.yaml b/jjb/lf-gradle-jobs.yaml new file mode 100644 index 00000000..424d83e4 --- /dev/null +++ b/jjb/lf-gradle-jobs.yaml @@ -0,0 +1,135 @@ +#################### +# COMMON FUNCTIONS # +#################### + +- _lf_gradle_common: &lf_gradle_common + name: lf-gradle-common + + ###################### + # Default parameters # + ###################### + + branch: master + build-days-to-keep: 7 + build-timeout: 60 + disable-job: false + git-url: "$GIT_URL/$PROJECT" + github-url: https://github.com + java-version: openjdk17 + stream: master + submodule-recursive: true + submodule-timeout: 10 + submodule-disable: false + cron: "@daily" + + archive-artifacts: > + **/*.log + **/hs_err_*.log + **/target/**/feature.xml + **/target/failsafe-reports/failsafe-summary.xml + **/target/surefire-reports/*-output.txt + + ##################### + # Job Configuration # + ##################### + + project-type: freestyle + node: "{build-node}" + + properties: + - lf-infra-properties: + build-days-to-keep: "{build-days-to-keep}" + + parameters: + - lf-infra-parameters: + project: "{project}" + branch: "{branch}" + stream: "{stream}" + - string: + name: ARCHIVE_ARTIFACTS + default: "{archive-artifacts}" + description: Artifacts to archive to the logs server. + + wrappers: + - lf-infra-wrappers: + build-timeout: "{build-timeout}" + jenkins-ssh-credential: "{jenkins-ssh-credential}" + + publishers: + - lf-infra-publish + + gerrit_gradle_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: ".*" + +- job-template: + name: "{project-name}-gradle-build-{stream}" + id: gerrit-gradle-build + <<: *lf_gradle_common + + builders: + - shell: | + ./gradlew build + + 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}" + choosing-strategy: default + + triggers: + - timed: "{obj:cron}" + - gerrit: + server-name: "{gerrit-server-name}" + trigger-on: "{obj:gerrit_gradle_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}-gradle-build-{stream}" + id: github-gradle-build + <<: *lf_gradle_common + + builders: + - shell: | + ./gradlew build + + 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: "Gradle Verify" + permit-all: true + github-hooks: true + white-list-target-branches: + - "{branch}" diff --git a/releasenotes/notes/add-lf-gradle-84bc0bb7bd66756b.yaml b/releasenotes/notes/add-lf-gradle-84bc0bb7bd66756b.yaml new file mode 100644 index 00000000..4f448b66 --- /dev/null +++ b/releasenotes/notes/add-lf-gradle-84bc0bb7bd66756b.yaml @@ -0,0 +1,4 @@ +--- +features: + - | + Add initial lf-gradle file for gradle based builds.