-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcloudbuild.yaml
73 lines (66 loc) · 2.38 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
steps:
- name: gcr.io/cloud-builders/gcloud
args:
- kms
- decrypt
- --ciphertext-file=.netrc.enc
- --plaintext-file=.netrc
- --location=global
- --keyring=builder
- --key=builder
id: kms
- name: 'gcr.io/cloud-builders/docker'
args: ['build', '-t', 'debian', '-f', 'Dockerfile.debian', '.']
waitFor: ['kms']
id: debian
- name: 'gcr.io/cloud-builders/docker'
args: ['build', '-t', 'alpine', '-f', 'Dockerfile.alpine', '.']
waitFor: ['kms']
id: alpine
- name: 'gcr.io/cloud-builders/docker'
args: ['build', '-t', 'debian-buster', '-f', 'Dockerfile.debian-buster', '.']
waitFor: ['kms']
id: debian-buster
- name: 'gcr.io/cloud-builders/docker'
entrypoint: 'bash'
args:
- '-c'
- |
mkdir debian
mkdir alpine
mkdir debian-buster
id=$(docker create debian)
docker cp $id:/app/healthz debian/
docker rm -v $id
id=$(docker create alpine)
docker cp $id:/app/healthz alpine/
docker rm -v $id
id=$(docker create debian-buster)
docker cp $id:/app/healthz debian-buster/
docker rm -v $id
mkdir dist
tar czf dist/healthz-alpine.tar.gz alpine/
tar czf dist/healthz-debian.tar.gz debian/
tar czf dist/healthz-debian-buster.tar.gz debian-buster/
cd dist
shasum healthz-alpine.tar.gz > healthz-alpine.tar.gz.sha
shasum healthz-debian.tar.gz > healthz-debian.tar.gz.sha
shasum healthz-debian-buster.tar.gz > healthz-debian-buster.tar.gz.sha
waitFor: ['debian', 'alpine', 'debian-buster']
id: 'copy-artifacts'
# Create a github release and upload the artifacts with a go tool
- name: 'gcr.io/cloud-builders/curl'
secretEnv: ['GITHUB_TOKEN']
entrypoint: 'bash'
args:
- '-c'
- >-
if [ "$TAG_NAME" ] ; then
curl -sf -o ghr_v0.12.1_linux_amd64.tar.gz -L https://github.com/tcnksm/ghr/releases/download/v0.12.1/ghr_v0.12.1_linux_amd64.tar.gz;
echo -n "471c2eb1aee20dedffd00254f6c445abb5eb7d479bcae32c4210fdcf036b2dce ghr_v0.12.1_linux_amd64.tar.gz" | sha256sum -c - && tar xzf ghr_v0.12.1_linux_amd64.tar.gz;
ghr_*/ghr -t $$GITHUB_TOKEN -u onlinecity -r ocmg-go-health $TAG_NAME dist;
fi
secrets:
- kmsKeyName: projects/gatewayapi-212008/locations/global/keyRings/builder/cryptoKeys/builder
secretEnv:
GITHUB_TOKEN: "CiQAlT9vrJUW/X99VXf4Apc+n3ZIjNl2wL1yWvpalrBRXlB6kc4SUQA5Ot1jctaOFXfrQHk0gtbmvwLMk4IogbWoJzw0y968DzQhhQaCDphIUMyJahxVgqlOL5k1JJvanB424BTOpI5CLx7IqdzDh2BP/g7BATFKbQ=="