-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcloudbuild.yaml
49 lines (40 loc) · 1.2 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
# default substitutions: https://cloud.google.com/build/docs/configuring-builds/substitute-variable-values
#
# https://github.com/GoogleCloudPlatform/cloud-build-samples
# https://github.com/GoogleCloudPlatform/cloud-builders-community
---
# IMAGE_NAME
# $COMMIT_SHA
steps:
- id: 'setup'
name: 'docker.io/controlplane/cp-infra:latest'
entrypoint: bash
args:
- -c
- |
set -Eeuxo pipefail
make help
cat <<EOF > /workspace/image_label.txt
echo ${BRANCH_NAME} | sed 's,/,-,g' | awk '{print tolower($0)}')_${COMMIT_SHA}
EOF
cat <<EOF > /workspace/image_name.txt
gcr.io/${PROJECT_ID}/${_PROJECT_NAME}:$(cat /workspace/image_label.txt)
EOF
printf "\n\nCONTAINER IMAGE:\t%s\n\n\n" "$(cat /workspace/image_name.txt)"
- id: 'container build'
name: 'gcr.io/kaniko-project/executor:debug'
entrypoint: sh
args:
- -c
- |
set -euxo pipefail
/kaniko/executor --dockerfile=/workspace/Dockerfile \
--context=/workspace \
--context=dir://. \
--destination="`cat /workspace/image_name.txt`" \
--cache=true \
--cache-ttl=99h \
substitutions:
_PROJECT_NAME: gcloud-sdk
options:
machineType: 'N1_HIGHCPU_32'