-
Notifications
You must be signed in to change notification settings - Fork 10
/
cloudbuild.yaml
100 lines (100 loc) · 2.87 KB
/
cloudbuild.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
substitutions:
_ARTIFACT_BUCKET: gs://rpa-devops-artifacts
_DOC_BUCKET: documentation.redpillanalytics.com
_DOC_PATH: ${_DOC_BUCKET}/${REPO_NAME}
_DOC_REMOTE: s3://${_DOC_PATH}
_DOC_LOCAL: build/docs/groovydoc/
_DOC_BASE_URL: https://s3.amazonaws.com/${_DOC_PATH}
_ARTIFACT_LOCATION: ${_ARTIFACT_BUCKET}/${REPO_NAME}
_STATUS_FILE: build-status.txt
# Get repository URL
_REPO_URL: $(body.repository.html_url)
steps:
- name: gcr.io/$PROJECT_ID/project-version
id: version
args:
- $_REPO_URL
- $BRANCH_NAME
waitFor: [ '-' ]
- name: gcr.io/$PROJECT_ID/docker-compose
id: test
entrypoint: bash
args:
- '-cx'
- |
./gradlew cleanLibs build groovydoc runAllTests buildDashboard validatePlugins
env:
- 'PROJECT_ID=$PROJECT_ID'
waitFor:
- version
- name: gcr.io/google.com/cloudsdktool/cloud-sdk
id: publish
entrypoint: bash
args:
- '-cx'
- |
if [ $BRANCH_NAME == "master" ]
then
./gradlew publish -Pgradle.publish.key=$${GRADLE_KEY} -Pgradle.publish.secret=$${GRADLE_SECRET}
fi
waitFor:
- test
# Need a rewrite of gradle-analytics that doesn't rely on a local git repo
# - name: gcr.io/google.com/cloudsdktool/cloud-sdk
# id: analytics
# entrypoint: bash
# args:
# - '-c'
# - |
# ./gradlew producer
# waitFor:
# - publish
- name: amazon/aws-cli
id: publish-docs
entrypoint: bash
args:
- '-cx'
- |
if [ $BRANCH_NAME == "master" ]
then
aws s3 sync ${_DOC_LOCAL} ${_DOC_REMOTE}/`<stepvars/version`/ \
&& aws s3 sync ${_DOC_LOCAL} ${_DOC_REMOTE}/latest \
&& echo "Version API documentation located at: ${_DOC_BASE_URL}/`<stepvars/version`/overview-summary.html" \
&& echo "Latest API documentation located at: ${_DOC_BASE_URL}/latest/overview-summary.html"
fi
waitFor:
- test
- publish
timeout: 3600s
options:
#machineType: 'N1_HIGHCPU_32'
substitution_option: 'ALLOW_LOOSE'
dynamic_substitutions: true
env:
- GRADLE_USER_HOME=.gradle
- GRADLE_OPTS="-Dorg.gradle.daemon=false"
- ORG_GRADLE_PROJECT_analytics_buildTag=$BUILD_ID
- CI=true
secretEnv:
- GITHUB_TOKEN
- AWS_ACCESS_KEY_ID
- AWS_SECRET_ACCESS_KEY
- GRADLE_KEY
- GRADLE_SECRET
artifacts:
objects:
location: ${_ARTIFACT_LOCATION}
paths:
- build/libs/*.jar
availableSecrets:
secretManager:
- versionName: projects/737919165778/secrets/GITHUB_TOKEN/versions/latest
env: GITHUB_TOKEN
- versionName: projects/737919165778/secrets/AWS_ACCESS_KEY_ID/versions/latest
env: AWS_ACCESS_KEY_ID
- versionName: projects/737919165778/secrets/AWS_SECRET_ACCESS_KEY/versions/latest
env: AWS_SECRET_ACCESS_KEY
- versionName: projects/737919165778/secrets/GRADLE_KEY/versions/latest
env: GRADLE_KEY
- versionName: projects/737919165778/secrets/GRADLE_SECRET/versions/latest
env: GRADLE_SECRET