Skip to content

Commit 4c7cc70

Browse files
committed
Build PRs on CI
Closes gh-26882
1 parent f7fc362 commit 4c7cc70

File tree

2 files changed

+62
-0
lines changed

2 files changed

+62
-0
lines changed

ci/pipeline.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@ resource_types:
5454
source:
5555
repository: dpb587/github-status-resource
5656
tag: master
57+
- name: pull-request
58+
type: registry-image
59+
source:
60+
repository: teliaoss/github-pr-resource
61+
tag: v0.23.0
5762
- name: slack-notification
5863
type: registry-image
5964
source:
@@ -93,6 +98,14 @@ resources:
9398
username: ((artifactory-username))
9499
password: ((artifactory-password))
95100
build_name: ((build-name))
101+
- name: git-pull-request
102+
type: pull-request
103+
icon: source-pull
104+
source:
105+
access_token: ((github-ci-pull-request-token))
106+
repository: ((github-repo-name))
107+
base_branch: ((branch))
108+
ignore_paths: ["ci/*"]
96109
- name: repo-status-build
97110
type: github-status-resource
98111
icon: eye-check-outline
@@ -257,6 +270,34 @@ jobs:
257270
<<: *slack-fail-params
258271
- put: repo-status-jdk15-build
259272
params: { state: "success", commit: "git-repo" }
273+
- name: build-pull-requests
274+
serial: true
275+
public: true
276+
plan:
277+
- get: ci-image
278+
- get: git-repo
279+
resource: git-pull-request
280+
trigger: true
281+
version: every
282+
- do:
283+
- put: git-pull-request
284+
params:
285+
path: git-repo
286+
status: pending
287+
- task: build-pr
288+
image: ci-image
289+
file: git-repo/ci/tasks/build-pr.yml
290+
<<: *build-project-task-params
291+
on_success:
292+
put: git-pull-request
293+
params:
294+
path: git-repo
295+
status: success
296+
on_failure:
297+
put: git-pull-request
298+
params:
299+
path: git-repo
300+
status: failure
260301
- name: stage-milestone
261302
serial: true
262303
plan:
@@ -412,3 +453,5 @@ groups:
412453
jobs: ["stage-milestone", "stage-rc", "stage-release", "promote-milestone", "promote-rc", "promote-release", "create-github-release"]
413454
- name: "ci-images"
414455
jobs: ["build-ci-images"]
456+
- name: "pull-requests"
457+
jobs: [ "build-pull-requests" ]

ci/tasks/build-pr.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
platform: linux
3+
inputs:
4+
- name: git-repo
5+
caches:
6+
- path: gradle
7+
params:
8+
BRANCH:
9+
CI: true
10+
GRADLE_ENTERPRISE_ACCESS_KEY:
11+
GRADLE_ENTERPRISE_CACHE_USERNAME:
12+
GRADLE_ENTERPRISE_CACHE_PASSWORD:
13+
GRADLE_ENTERPRISE_URL: https://ge.spring.io
14+
run:
15+
path: bash
16+
args:
17+
- -ec
18+
- |
19+
${PWD}/git-repo/ci/scripts/build-project.sh

0 commit comments

Comments
 (0)