This repository has been archived by the owner on Jan 30, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
azure-pipelines.yml
166 lines (161 loc) · 5.61 KB
/
azure-pipelines.yml
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
variables:
fatsDir: '$(system.defaultWorkingDirectory)/../fats'
fatsRefspec: c64950508fac705837205503ed4c8611acccc9c0 # projectriff/fats master as of 2019-08-15
duffleNamespace: kube-system
duffleServiceAccount: duffle-runtime
jobs:
- job: test_pr
pool:
vmImage: 'ubuntu-16.04'
condition: and(succeeded(), eq(variables['Build.Reason'], 'PullRequest'))
variables:
CLUSTER: minikube
REGISTRY: docker-daemon
CLUSTER_NAME: 'cnab-$(Build.BuildId)-minikube'
NAMESPACE: 'cnab-$(Build.BuildId)-minikube'
steps:
- bash: ./ci/fats-fetch.sh $(fatsDir) $(fatsRefspec) projectriff/fats
displayName: 'Fetch FATS'
- bash: |
$(fatsDir)/install.sh kubectl
$(fatsDir)/install.sh riff
$(fatsDir)/install.sh duffle
displayName: 'Install tools'
- bash: duffle init && make bundle
displayName: 'Build bundle'
- script: $(fatsDir)/start.sh
displayName: 'Start FATS'
- bash: |
source $(fatsDir)/.configure.sh
kubectl create serviceaccount $(duffleServiceAccount) -n $(duffleNamespace)
kubectl create clusterrolebinding "$(duffleServiceAccount)-cluster-admin" --clusterrole cluster-admin --serviceaccount "$(duffleNamespace):$(duffleServiceAccount)"
KUBE_NAMESPACE=$(duffleNamespace) SERVICE_ACCOUNT=$(duffleServiceAccount) duffle install myriff riff ${DUFFLE_RIFF_INSTALL_FLAGS} -d k8s
displayName: 'Install riff'
- bash: ./ci/run-tests.sh
displayName: 'Run tests'
env:
FATS_DIR: $(fatsDir)
FATS_REFSPEC: $(fatsRefspec)
- bash: ci/diagnostics.sh
condition: failed()
displayName: 'Collect diagnostics'
- bash: KUBE_NAMESPACE=$(duffleNamespace) SERVICE_ACCOUNT=$(duffleServiceAccount) duffle uninstall myriff -d k8s
condition: always()
displayName: 'Uninstall riff'
- bash: $(fatsDir)/cleanup.sh
condition: always()
displayName: 'Cleanup FATS'
displayName: 'Test PR'
- job: stage
pool:
vmImage: 'ubuntu-16.04'
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))
steps:
- bash: ./ci/fats-fetch.sh $(fatsDir) $(fatsRefspec) projectriff/fats
displayName: 'Fetch FATS'
- bash: |
$(fatsDir)/install.sh duffle
displayName: 'Install Tools'
- bash: duffle init && make bundle
displayName: 'Make bundle'
- bash: |
$(fatsDir)/install.sh gcloud
./ci/stage-bundle.sh
env:
DOCKER_USERNAME: '$(DockerUsername)'
DOCKER_PASSWORD: '$(DockerPassword)'
GCLOUD_CLIENT_SECRET: '$(GcloudClientSecret)'
displayName: 'Stage riff bundle'
displayName: 'Stage'
- job: test
dependsOn: stage
strategy:
matrix:
minikube:
imageName: ubuntu-16.04
qualifier: minikube
cluster: minikube
registry: dockerhub
gke:
imageName: ubuntu-16.04
qualifier: gke
cluster: gke
registry: gcr
pool:
vmImage: $(imageName)
variables:
CLUSTER: '$(cluster)'
REGISTRY: '$(registry)'
CLUSTER_NAME: 'cnab-$(Build.BuildId)-$(qualifier)'
NAMESPACE: '$(CLUSTER_NAME)'
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))
steps:
- bash: ./ci/fats-fetch.sh $(fatsDir) $(fatsRefspec) projectriff/fats
displayName: 'Fetch FATS'
- bash: |
$(fatsDir)/install.sh kubectl
$(fatsDir)/install.sh riff
$(fatsDir)/install.sh duffle
$(fatsDir)/install.sh gcloud
displayName: 'Install tools'
env:
GCLOUD_CLIENT_SECRET: '$(GcloudClientSecret)'
- bash: $(fatsDir)/start.sh
displayName: 'Start FATS'
env:
DOCKER_USERNAME: '$(DockerUsername)'
DOCKER_PASSWORD: '$(DockerPassword)'
GCLOUD_CLIENT_SECRET: '$(GcloudClientSecret)'
- bash: |
source $(fatsDir)/.configure.sh
version=`cat VERSION`
commit=$(git rev-parse HEAD)
file=riff-bundle-${version}-${commit}.json
curl -O https://storage.googleapis.com/projectriff/riff-cnab/builds/${file}
kubectl create serviceaccount $(duffleServiceAccount) -n $(duffleNamespace)
kubectl create clusterrolebinding "$(duffleServiceAccount)-cluster-admin" --clusterrole cluster-admin --serviceaccount "$(duffleNamespace):$(duffleServiceAccount)"
KUBE_NAMESPACE=$(duffleNamespace) SERVICE_ACCOUNT=$(duffleServiceAccount) duffle install myriff ${file} --bundle-is-file ${DUFFLE_RIFF_INSTALL_FLAGS} -d k8s
env:
COMPOSE_CONVERT_WINDOWS_PATHS: 1
displayName: 'Install riff'
- bash: ./ci/run-tests.sh
displayName: 'run fats'
env:
DOCKER_USERNAME: '$(DockerUsername)'
DOCKER_PASSWORD: '$(DockerPassword)'
GCLOUD_CLIENT_SECRET: '$(GcloudClientSecret)'
FATS_DIR: $(fatsDir)
FATS_REFSPEC: $(fatsRefspec)
- bash: ci/diagnostics.sh
condition: failed()
displayName: 'Collect diagnostics'
- bash: KUBE_NAMESPACE=$(duffleNamespace) SERVICE_ACCOUNT=$(duffleServiceAccount) duffle uninstall myriff -d k8s
condition: always()
displayName: 'Uninstall riff'
- bash: $(fatsDir)/cleanup.sh
env:
DOCKER_USERNAME: '$(DockerUsername)'
DOCKER_PASSWORD: '$(DockerPassword)'
condition: always()
displayName: 'Cleanup FATS'
displayName: 'Test'
- job: publish
dependsOn: test
pool:
vmImage: 'Ubuntu-16.04'
condition: |
and(
succeeded(),
ne(variables['Build.Reason'], 'PullRequest'),
eq(variables['Build.SourceBranch'], 'refs/heads/master')
)
steps:
- bash: ./ci/fats-fetch.sh $(fatsDir) $(fatsRefspec) projectriff/fats
displayName: 'Fetch FATS'
- bash: $(fatsDir)/install.sh gcloud
env:
GCLOUD_CLIENT_SECRET: '$(GcloudClientSecret)'
displayName: 'Install gcloud'
- bash: ./ci/publish.sh release
displayName: 'Publish bundle'
displayName: 'Publish'