diff --git a/ci/pipeline.yml b/ci/pipeline.yml index e77e3b3990..1e6b71bc2a 100644 --- a/ci/pipeline.yml +++ b/ci/pipeline.yml @@ -54,6 +54,11 @@ resource_types: source: repository: dpb587/github-status-resource tag: master +- name: pull-request + type: registry-image + source: + repository: teliaoss/github-pr-resource + tag: v0.23.0 - name: slack-notification type: registry-image source: @@ -93,6 +98,14 @@ resources: username: ((artifactory-username)) password: ((artifactory-password)) build_name: ((build-name)) +- name: git-pull-request + type: pull-request + icon: source-pull + source: + access_token: ((github-ci-pull-request-token)) + repository: ((github-repo-name)) + base_branch: ((branch)) + ignore_paths: ["ci/*"] - name: repo-status-build type: github-status-resource icon: eye-check-outline @@ -257,6 +270,34 @@ jobs: <<: *slack-fail-params - put: repo-status-jdk15-build params: { state: "success", commit: "git-repo" } +- name: build-pull-requests + serial: true + public: true + plan: + - get: ci-image + - get: git-repo + resource: git-pull-request + trigger: true + version: every + - do: + - put: git-pull-request + params: + path: git-repo + status: pending + - task: build-pr + image: ci-image + file: git-repo/ci/tasks/build-pr.yml + <<: *build-project-task-params + on_success: + put: git-pull-request + params: + path: git-repo + status: success + on_failure: + put: git-pull-request + params: + path: git-repo + status: failure - name: stage-milestone serial: true plan: @@ -412,3 +453,5 @@ groups: jobs: ["stage-milestone", "stage-rc", "stage-release", "promote-milestone", "promote-rc", "promote-release", "create-github-release"] - name: "ci-images" jobs: ["build-ci-images"] +- name: "pull-requests" + jobs: [ "build-pull-requests" ] diff --git a/ci/tasks/build-pr.yml b/ci/tasks/build-pr.yml new file mode 100644 index 0000000000..4847446ece --- /dev/null +++ b/ci/tasks/build-pr.yml @@ -0,0 +1,19 @@ +--- +platform: linux +inputs: +- name: git-repo +caches: +- path: gradle +params: + BRANCH: + CI: true + GRADLE_ENTERPRISE_ACCESS_KEY: + GRADLE_ENTERPRISE_CACHE_USERNAME: + GRADLE_ENTERPRISE_CACHE_PASSWORD: + GRADLE_ENTERPRISE_URL: https://ge.spring.io +run: + path: bash + args: + - -ec + - | + ${PWD}/git-repo/ci/scripts/build-project.sh