This repository was archived by the owner on Dec 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcloudbuild.yaml
More file actions
58 lines (58 loc) · 1.73 KB
/
cloudbuild.yaml
File metadata and controls
58 lines (58 loc) · 1.73 KB
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
steps:
- name: gcr.io/cloud-builders/gsutil
args: ['cp', 'gs://attach-containers-secrets/id_rsa.enc', '.']
- name: 'gcr.io/cloud-builders/gcloud'
args:
- kms
- decrypt
- --ciphertext-file=id_rsa.enc
- --plaintext-file=/root/.ssh/id_rsa
- --location=global
- --keyring=attach-kubernetes
- --key=github-key
volumes:
- name: 'ssh'
path: /root/.ssh
- name: 'gcr.io/cloud-builders/git'
entrypoint: 'bash'
args:
- '-c'
- |
ssh-keyscan -t rsa github.com > known_hosts
chmod 600 /root/.ssh/id_rsa
cat <<EOF >/root/.ssh/config
Hostname github.com
IdentityFile /root/.ssh/id_rsa
EOF
mv known_hosts /root/.ssh/known_hosts
volumes:
- name: 'ssh'
path: /root/.ssh
- name: 'gcr.io/cloud-builders/git'
entrypoint: 'bash'
args:
- '-c'
- |
ENVIRONMENT=$$(printf '%s' "$BRANCH_NAME" | sed 's/-.*//' | sed 's/[0-9]//g')
git clone -b "$${ENVIRONMENT}" [email protected]:attach-live/attach-kubernetes
volumes:
- name: 'ssh'
path: /root/.ssh
- name: 'node:10.15.3-stretch'
entrypoint: 'sh'
args:
- '-c'
- |
chmod +x ./attach-kubernetes/scripts/build-env.sh
./attach-kubernetes/scripts/build-env.sh $REPO_NAME $BRANCH_NAME
set -a
. ./variables.env
set +a
chmod +x ./hooks/pre-build.sh
./hooks/pre-build.sh $BRANCH_NAME
chmod +x ./hooks/build.sh
./hooks/build.sh $BRANCH_NAME
- name: 'gcr.io/cloud-builders/docker'
args: ['build', '-t', 'gcr.io/$PROJECT_ID/$REPO_NAME:$BRANCH_NAME-$COMMIT_SHA', '.']
images: ['gcr.io/$PROJECT_ID/$REPO_NAME']
tags: ['$BRANCH_NAME-$COMMIT_SHA']