-
Notifications
You must be signed in to change notification settings - Fork 6
/
azure-pipelines.yaml
59 lines (55 loc) · 2.2 KB
/
azure-pipelines.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
trigger:
- develop
pool:
vmImage: "ubuntu-latest"
variables:
- name: GIT_MIRROR_URL
value: "$(gitMirrorURL)"
- name: GIT_MIRROR_TOKEN
value: "$(gitMirrorToken)"
stages:
- stage: build_and_deploy
displayName: Build and Deploy
dependsOn: []
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))
jobs:
- job: build_and_deploy
displayName: Build Docker images and deploy through Kubernetes
steps:
- script: curl -Lo skaffold https://storage.googleapis.com/skaffold/releases/latest/skaffold-linux-amd64 && sudo install skaffold /usr/local/bin/
displayName: Install Skaffold
- task: DownloadSecureFile@1
name: authkey
displayName: "Download Service Account Key"
inputs:
secureFile: zk-gaming-azure.json
retryCount: "2"
- script: gcloud auth activate-service-account [email protected] --key-file=$(authkey.secureFilePath)
displayName: Activate Service Account
- task: Kubernetes@1
inputs:
connectionType: "Kubernetes Service Connection"
kubernetesServiceEndpoint: "gke-zk-gaming"
namespace: "boloney-staging"
command: "login"
- script: |
envsubst < deployment/staging/workloads/secrets/backend.template.yaml > deployment/staging/workloads/secrets/backend.yaml
skaffold run --filename skaffold.staging.yaml
displayName: Build and push docker images
env:
DB_PASSWORD: $(DB_PASSWORD)
CONSOLE_PASSWORD: $(CONSOLE_PASSWORD)
- stage: mirror
displayName: Mirror
dependsOn:
- build_and_deploy
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))
jobs:
- job:
displayName: Mirror repository
steps:
- task: CmdLine@2
displayName: Push repository to mirror
continueOnError: true
inputs:
script: 'git -c http.$(GIT_MIRROR_URL).extraheader="AUTHORIZATION: basic $(GIT_MIRROR_TOKEN)" push --force $(GIT_MIRROR_URL) HEAD:$(Build.SourceBranch)'