-
Notifications
You must be signed in to change notification settings - Fork 1
/
cloudbuild.yaml
97 lines (87 loc) · 2.9 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
steps:
# Initializations
- id: Initialize git
name: gcr.io/cloud-builders/git
entrypoint: /bin/bash
args:
- -exc
- |
# Cloud Build x GitHub integration uses source archives to fetch
# the source, rather than Git source fetching, and as a consequence
# does not include the .git/ directory. As a workaround, we clone
# the repository and reset it to this build's commit sha.
git clone 'https://github.com/oci-labs/Google-Marketplace-EOSIO-Testnet.git' tmp
mv tmp/.git .git
rm -rf tmp
git reset --hard $COMMIT_SHA
git submodule update --init --recursive
- id: Create Kubernetes Cluster for Testing
name: gcr.io/cloud-builders/gcloud
entrypoint: bash
args:
- -exc
- |
build_id=${BUILD_ID}
cluster_name=testnet-tmp-${build_id:0:8}
gcloud container clusters create $$cluster_name --zone $_ZONE --project $PROJECT_ID
echo $$cluster_name > cluster_name
mkdir -p /workspace/.kube/
cp -r $$HOME/.kube/ /workspace/
- id: Pull Dev Image
name: gcr.io/cloud-builders/docker
waitFor:
- Initialize git
entrypoint: bash
args:
- -c
- |
TAG="$$(cat MARKETPLACE_TOOLS_TAG)"
{ docker pull "gcr.io/cloud-marketplace-tools/k8s/dev:$$TAG" && \
docker tag "gcr.io/cloud-marketplace-tools/k8s/dev:$$TAG" "gcr.io/cloud-marketplace-tools/k8s/dev:local"; } || \
echo "Pull Dev Image Failed" > build-failed
- id: Build Deployer Image
name: gcr.io/cloud-marketplace-tools/k8s/dev:local
waitFor:
- Pull Dev Image
env:
- 'GCLOUD_CONFIG=/workspace/.config/gcloud'
- 'EXTRA_DOCKER_PARAMS=--net cloudbuild'
# Use local Docker network named cloudbuild as described here:
# https://cloud.google.com/cloud-build/docs/overview#build_configuration_and_build_steps
entrypoint: bash
args:
- -c
- |
[ -f "build-failed" ] || make app/build || echo "Build Deployer Image Failed" >> build-failed
# EOS testnet Verification
- id: Verify EOSIO Testnet
name: gcr.io/cloud-marketplace-tools/k8s/dev:local
waitFor:
- Create Kubernetes Cluster for Testing
- Build Deployer Image
env:
- 'KUBE_CONFIG=/workspace/.kube'
- 'GCLOUD_CONFIG=/workspace/.config/gcloud'
- 'EXTRA_DOCKER_PARAMS=--net cloudbuild'
# Use local Docker network named cloudbuild as described here:
# https://cloud.google.com/cloud-build/docs/overview#build_configuration_and_build_steps
entrypoint: bash
args:
- -c
- |
[ -f "build-failed" ] || make crd/install && make app/verify || echo "Verify EOSIO Testnet Failed" >> build-failed
- id: Delete Kubernetes Cluster for Testing
name: gcr.io/cloud-builders/gcloud
env:
- 'GCLOUD_CONFIG=/workspace/.config/gcloud'
entrypoint: bash
args:
- -c
- |
[ ! -f "cluster_name" ] || gcloud -q container clusters delete $$(cat cluster_name) --zone $_ZONE --project $PROJECT_ID
[ -f "build-failed" ] || exit 0
cat build-failed
exit 1
substitutions:
_ZONE: us-central1-c
timeout: 1200s