File tree Expand file tree Collapse file tree
pkg/fixtures/workflows/azurepipelines Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- # Azure Kubernetes Service (AKS) pipeline with Kustomize
2- # Build and push image to Azure Container Registry; Deploy to Azure Kubernetes Service cluster
3-
4- variables :
5- armServiceConnection : testserviceconnection
6- azureContainerRegistry : myacr.acr.io
7- containerName : myapp
8- acrRg : myrg
9- clusterRg : myrg
10- clusterName : testcluster
11- kustomizePath : ./overlays/production
12- namespace : default
13- tag : " $(Build.BuildId)"
14- vmImageName : " ubuntu-latest"
15-
16- trigger :
17- - main
18-
19- name : Build and deploy an app to AKS
1+ # Azure Kubernetes Service (AKS) pipeline with Kustomize
2+ # Build and push image to Azure Container Registry; Deploy to Azure Kubernetes Service cluster
3+
4+ variables :
5+ armServiceConnection : testserviceconnection
6+ azureContainerRegistry : myacr.acr.io
7+ containerName : myapp
8+ acrRg : myrg
9+ clusterRg : myrg
10+ clusterName : testcluster
11+ kustomizePath : ./overlays/production
12+ namespace : default
13+ buildContextPath : .
14+ tag : " $(Build.BuildId)"
15+ vmImageName : " ubuntu-latest"
16+
17+ trigger :
18+ - main
19+
20+ name : Build and deploy an app to AKS
2021
2122stages :
2223 - stage : BuildAndPush
@@ -34,7 +35,7 @@ stages:
3435 scriptType : " bash"
3536 scriptLocation : " inlineScript"
3637 inlineScript : |
37- az acr build --image $1.azurecr.io/$2:$3 --registry $1 -g $4 .
38+ az acr build --image $1.azurecr.io/$2:$3 --registry $1 -g $4 $(buildContextPath)
3839 arguments : " $(azureContainerRegistry) $(containerName) $(tag) $(acrRg)"
3940
4041 - stage : Deploy
Original file line number Diff line number Diff line change 1- # Azure Kubernetes Service pipeline
2- # Build and push image to Azure Container Registry; Deploy to Azure Kubernetes Service cluster
3-
4- variables :
5- armServiceConnection : testserviceconnection
6- azureContainerRegistry : myacr.acr.io
7- containerName : myapp
8- clusterRg : myrg
9- acrRg : myrg
10- clusterName : testcluster
11- manifestPath : ./manifests
12- namespace : default
13- tag : " $(Build.BuildId)"
14- vmImageName : " ubuntu-latest"
15-
16- name : Build and deploy an app to AKS
17-
18- trigger :
19- - main
1+ # Azure Kubernetes Service pipeline
2+ # Build and push image to Azure Container Registry; Deploy to Azure Kubernetes Service cluster
3+
4+ variables :
5+ armServiceConnection : testserviceconnection
6+ azureContainerRegistry : myacr.acr.io
7+ containerName : myapp
8+ clusterRg : myrg
9+ acrRg : myrg
10+ clusterName : testcluster
11+ manifestPath : ./manifests
12+ namespace : default
13+ buildContextPath : .
14+ tag : " $(Build.BuildId)"
15+ vmImageName : " ubuntu-latest"
16+
17+ name : Build and deploy an app to AKS
18+
19+ trigger :
20+ - main
2021
2122stages :
2223 - stage : BuildAndPush
@@ -34,7 +35,7 @@ stages:
3435 scriptType : " bash"
3536 scriptLocation : " inlineScript"
3637 inlineScript : |
37- az acr build --image $1.azurecr.io/$2:$3 --registry $1 -g $4 .
38+ az acr build --image $1.azurecr.io/$2:$3 --registry $1 -g $4 $(buildContextPath)
3839 arguments : " $(azureContainerRegistry) $(containerName) $(tag) $(acrRg)"
3940
4041 - stage : Deploy
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ variables:
1010 clusterName : {{ .Config.GetVariableValue "CLUSTERNAME" }}
1111 kustomizePath : {{ .Config.GetVariableValue "KUSTOMIZEPATH" }}
1212 namespace : {{ .Config.GetVariableValue "NAMESPACE" }}
13+ buildContextPath : {{ .Config.GetVariableValue "BUILDCONTEXTPATH" }}
1314 tag : " $(Build.BuildId)"
1415 vmImageName : " ubuntu-latest"
1516
@@ -34,7 +35,7 @@ stages:
3435 scriptType : " bash"
3536 scriptLocation : " inlineScript"
3637 inlineScript : |
37- az acr build --image $1.azurecr.io/$2:$3 --registry $1 -g $4 .
38+ az acr build --image $1.azurecr.io/$2:$3 --registry $1 -g $4 $(buildContextPath)
3839 arguments : " $(azureContainerRegistry) $(containerName) $(tag) $(acrRg)"
3940
4041 - stage : Deploy
Original file line number Diff line number Diff line change @@ -63,3 +63,10 @@ variables:
6363 value : " default"
6464 description : " the Kubernetes namespace"
6565 versions : " >=0.0.1"
66+ - name : " BUILDCONTEXTPATH"
67+ type : " string"
68+ kind : " dirPath"
69+ default :
70+ value : " ."
71+ description : " the path to the Docker build context"
72+ versions : " >=0.0.1"
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ variables:
1010 clusterName : {{ .Config.GetVariableValue "CLUSTERNAME" }}
1111 manifestPath : {{ .Config.GetVariableValue "MANIFESTPATH" }}
1212 namespace : {{ .Config.GetVariableValue "NAMESPACE" }}
13+ buildContextPath : {{ .Config.GetVariableValue "BUILDCONTEXTPATH" }}
1314 tag : " $(Build.BuildId)"
1415 vmImageName : " ubuntu-latest"
1516
@@ -34,7 +35,7 @@ stages:
3435 scriptType : " bash"
3536 scriptLocation : " inlineScript"
3637 inlineScript : |
37- az acr build --image $1.azurecr.io/$2:$3 --registry $1 -g $4 .
38+ az acr build --image $1.azurecr.io/$2:$3 --registry $1 -g $4 $(buildContextPath)
3839 arguments : " $(azureContainerRegistry) $(containerName) $(tag) $(acrRg)"
3940
4041 - stage : Deploy
Original file line number Diff line number Diff line change @@ -63,3 +63,10 @@ variables:
6363 value : " default"
6464 description : " the Kubernetes namespace"
6565 versions : " >=0.0.1"
66+ - name : " BUILDCONTEXTPATH"
67+ type : " string"
68+ kind : " dirPath"
69+ default :
70+ value : " ."
71+ description : " the path to the Docker build context"
72+ versions : " >=0.0.1"
You can’t perform that action at this time.
0 commit comments