forked from sky9723/example-aks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.workflow
59 lines (49 loc) · 1.69 KB
/
main.workflow
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
workflow "Build and Deploy" {
on = "push"
resolves = [
"Verify AKS deployment",
]
}
# Build
action "Build Docker image" {
uses = "docker://docker:stable"
args = ["build", "-t", "aks-example-octozen", "."]
}
# Azure Kubernetes
action "Load AKS kube credentials" {
uses = "docker://swinton/azure"
secrets = ["AZURE_SERVICE_APP_ID", "AZURE_SERVICE_PASSWORD", "AZURE_SERVICE_TENANT"]
args = "aks get-credentials --resource-group AKSExampleOctozenCluster --name AKSExampleOctozenCluster"
}
action "Setup ACR" {
needs = ["Load AKS kube credentials"]
uses = "docker://swinton/azure"
args = "acr login --name AKSExampleOctozenRegistry"
secrets = ["AZURE_SERVICE_APP_ID", "AZURE_SERVICE_PASSWORD", "AZURE_SERVICE_TENANT"]
}
action "Tag image for ACR" {
needs = ["Build Docker image"]
uses = "actions/docker/tag@master"
args = ["aks-example-octozen", "aksexampleoctozenregistry.azurecr.io/aks-example-octozen"]
}
action "Push image to ACR" {
needs = ["Setup ACR", "Tag image for ACR"]
uses = "docker://docker:stable"
args = "push aksexampleoctozenregistry.azurecr.io/aks-example-octozen"
}
action "Deploy branch filter" {
needs = ["Push image to ACR"]
uses = "actions/bin/filter@master"
args = "branch master"
}
action "Deploy to AKS" {
needs = ["Push image to ACR", "Deploy branch filter"]
uses = "docker://gcr.io/cloud-builders/kubectl"
runs = "sh -l -c"
args = ["kubectl set image deployment aks-example-octozen aks-example-octozen=aksexampleoctozenregistry.azurecr.io/aks-example-octozen:latest"]
}
action "Verify AKS deployment" {
needs = ["Deploy to AKS"]
uses = "docker://gcr.io/cloud-builders/kubectl"
args = "rollout status deployment/aks-example-octozen"
}