This repository has been archived by the owner on Jul 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
/
cloudbuild-pr.yaml
85 lines (85 loc) · 3.03 KB
/
cloudbuild-pr.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
steps:
- id: fetch-source
waitFor:
- '-'
name: gcr.io/cloud-builders/git
entrypoint: bash
args:
- '-c'
- |
# Cloud Build does not copy in the git repo, just source files, so we can't compute a diff.
# Check out the code again using git.
ls -A1 | xargs rm -rf
git init
echo git fetch --no-tags --progress $$REPO_URL +$$OTHER_BRANCH_REMOTE_REF:$$OTHER_BRANCH_LOCAL_REF +$$BASE_BRANCH_REMOTE_REF:$$BASE_BRANCH_LOCAL_REF
git fetch --no-tags --progress $$REPO_URL +$$OTHER_BRANCH_REMOTE_REF:$$OTHER_BRANCH_LOCAL_REF +$$BASE_BRANCH_REMOTE_REF:$$BASE_BRANCH_LOCAL_REF
git config remote.origin.url $$REPO_URL
git config user.name cloudbuild
git config user.email cloudbuild@example.com
git checkout -f $$OTHER_BRANCH_LOCAL_REF
git merge --no-ff --no-edit --no-progress $$BASE_BRANCH_LOCAL_REF
MERGE_REV=$(git rev-parse HEAD^{commit})
git checkout -f $$BASE_BRANCH_LOCAL_REF
git merge --no-ff --no-edit --no-progress $$MERGE_REV
MERGE_REV=$(git rev-parse HEAD^{commit})
git checkout -f $$MERGE_REV
env:
- OTHER_BRANCH_REMOTE_REF=refs/pull/$_PR_NUMBER/head
- OTHER_BRANCH_LOCAL_REF=refs/remotes/origin/PR-$_PR_NUMBER
- BASE_BRANCH_REMOTE_REF=refs/heads/$_BASE_BRANCH
- BASE_BRANCH_LOCAL_REF=refs/remotes/origin/$_BASE_BRANCH
- REPO_URL=https://github.com/curioswitch/curiostack
- id: curio-generated-fetch-builder-image
waitFor:
- '-'
name: ghcr.io/curioswitch/cloud-builder
entrypoint: bash
args:
- -c
- echo Fetched builder image.
- id: curio-generated-fetch-compressed-build-cache
waitFor:
- '-'
name: curiostack/gsutil-lz4
volumes:
- name: gradle-wrapper
path: /root/.gradle/wrapper
- name: gradle-caches
path: /root/.gradle/caches
- name: curiostack
path: /root/.gradle/curiostack
dir: /root/.gradle
entrypoint: ash
args:
- -c
- gsutil cp gs://curioswitch-gradle-build-cache/cloudbuild-cache-compressed.tar.lz4 /tmp/cloudbuild-cache-compressed.tar.lz4 && lz4 -dc /tmp/cloudbuild-cache-compressed.tar.lz4 | tar -xp || echo Could not fetch compressed build cache...
- id: build-all
waitFor:
- fetch-source
- curio-generated-fetch-compressed-build-cache
name: ghcr.io/curioswitch/cloud-builder
volumes:
- name: gradle-wrapper
path: /root/.gradle/wrapper
- name: gradle-caches
path: /root/.gradle/caches
- name: curiostack
path: /root/.gradle/curiostack
entrypoint: ./gradlew
args:
- continuousBuild
- --stacktrace
- --scan
- --no-daemon
env:
- CI=true
- GITHUB_PR_REMOTE_REF=refs/pull/$_PR_NUMBER/head
- CLOUDBUILD_BUILD_ID=$BUILD_ID
- GRADLE_USER_HOME=/root/.gradle
secretEnv:
- CODECOV_TOKEN
timeout: 60m
secrets:
- kmsKeyName: projects/curioswitch-cluster/locations/us-central1/keyRings/cloudbuild/cryptoKeys/github
secretEnv:
CODECOV_TOKEN: CiQAxdYgHOdQ5tY7WYjvBYlUsXk9g4GvELjEJZhEIFcxrkuDKY4STQA/OpLB7g9Gr8K5MZrwZXVDH/Ste1P6ZOFJl0TYILjU31c72w8Mmhde5JJv1VyEHW+67h8UARJHh6yOktrGFBU6wGzKDud0p6az3PoW