Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
# Azure Kubernetes Service (AKS) pipeline with Kustomize
# Build and push image to Azure Container Registry; Deploy to Azure Kubernetes Service cluster

variables:
armServiceConnection: testserviceconnection
azureContainerRegistry: myacr.acr.io
containerName: myapp
acrRg: myrg
clusterRg: myrg
clusterName: testcluster
kustomizePath: ./overlays/production
namespace: default
tag: "$(Build.BuildId)"
vmImageName: "ubuntu-latest"

trigger:
- main

name: Build and deploy an app to AKS
# Azure Kubernetes Service (AKS) pipeline with Kustomize
# Build and push image to Azure Container Registry; Deploy to Azure Kubernetes Service cluster

variables:
armServiceConnection: testserviceconnection
azureContainerRegistry: myacr.acr.io
containerName: myapp
acrRg: myrg
clusterRg: myrg
clusterName: testcluster
kustomizePath: ./overlays/production
namespace: default
buildContextPath: .
tag: "$(Build.BuildId)"
vmImageName: "ubuntu-latest"

trigger:
- main

name: Build and deploy an app to AKS

stages:
- stage: BuildAndPush
Expand All @@ -34,7 +35,7 @@ stages:
scriptType: "bash"
scriptLocation: "inlineScript"
inlineScript: |
az acr build --image $1.azurecr.io/$2:$3 --registry $1 -g $4 .
az acr build --image $1.azurecr.io/$2:$3 --registry $1 -g $4 $(buildContextPath)
arguments: "$(azureContainerRegistry) $(containerName) $(tag) $(acrRg)"

- stage: Deploy
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
# Azure Kubernetes Service pipeline
# Build and push image to Azure Container Registry; Deploy to Azure Kubernetes Service cluster

variables:
armServiceConnection: testserviceconnection
azureContainerRegistry: myacr.acr.io
containerName: myapp
clusterRg: myrg
acrRg: myrg
clusterName: testcluster
manifestPath: ./manifests
namespace: default
tag: "$(Build.BuildId)"
vmImageName: "ubuntu-latest"

name: Build and deploy an app to AKS

trigger:
- main
# Azure Kubernetes Service pipeline
# Build and push image to Azure Container Registry; Deploy to Azure Kubernetes Service cluster

variables:
armServiceConnection: testserviceconnection
azureContainerRegistry: myacr.acr.io
containerName: myapp
clusterRg: myrg
acrRg: myrg
clusterName: testcluster
manifestPath: ./manifests
namespace: default
buildContextPath: .
tag: "$(Build.BuildId)"
vmImageName: "ubuntu-latest"

name: Build and deploy an app to AKS

trigger:
- main

stages:
- stage: BuildAndPush
Expand All @@ -34,7 +35,7 @@ stages:
scriptType: "bash"
scriptLocation: "inlineScript"
inlineScript: |
az acr build --image $1.azurecr.io/$2:$3 --registry $1 -g $4 .
az acr build --image $1.azurecr.io/$2:$3 --registry $1 -g $4 $(buildContextPath)
arguments: "$(azureContainerRegistry) $(containerName) $(tag) $(acrRg)"

- stage: Deploy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ variables:
clusterName: {{ .Config.GetVariableValue "CLUSTERNAME" }}
kustomizePath: {{ .Config.GetVariableValue "KUSTOMIZEPATH" }}
namespace: {{ .Config.GetVariableValue "NAMESPACE" }}
buildContextPath: {{ .Config.GetVariableValue "BUILDCONTEXTPATH" }}
tag: "$(Build.BuildId)"
vmImageName: "ubuntu-latest"

Expand All @@ -34,7 +35,7 @@ stages:
scriptType: "bash"
scriptLocation: "inlineScript"
inlineScript: |
az acr build --image $1.azurecr.io/$2:$3 --registry $1 -g $4 .
az acr build --image $1.azurecr.io/$2:$3 --registry $1 -g $4 $(buildContextPath)
arguments: "$(azureContainerRegistry) $(containerName) $(tag) $(acrRg)"

- stage: Deploy
Expand Down
7 changes: 7 additions & 0 deletions template/azurePipelines/kustomize/draft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,10 @@ variables:
value: "default"
description: "the Kubernetes namespace"
versions: ">=0.0.1"
- name: "BUILDCONTEXTPATH"
type: "string"
kind: "dirPath"
default:
value: "."
description: "the path to the Docker build context"
versions: ">=0.0.1"
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ variables:
clusterName: {{ .Config.GetVariableValue "CLUSTERNAME" }}
manifestPath: {{ .Config.GetVariableValue "MANIFESTPATH" }}
namespace: {{ .Config.GetVariableValue "NAMESPACE" }}
buildContextPath: {{ .Config.GetVariableValue "BUILDCONTEXTPATH" }}
tag: "$(Build.BuildId)"
vmImageName: "ubuntu-latest"

Expand All @@ -34,7 +35,7 @@ stages:
scriptType: "bash"
scriptLocation: "inlineScript"
inlineScript: |
az acr build --image $1.azurecr.io/$2:$3 --registry $1 -g $4 .
az acr build --image $1.azurecr.io/$2:$3 --registry $1 -g $4 $(buildContextPath)
arguments: "$(azureContainerRegistry) $(containerName) $(tag) $(acrRg)"

- stage: Deploy
Expand Down
7 changes: 7 additions & 0 deletions template/azurePipelines/manifests/draft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,10 @@ variables:
value: "default"
description: "the Kubernetes namespace"
versions: ">=0.0.1"
- name: "BUILDCONTEXTPATH"
type: "string"
kind: "dirPath"
default:
value: "."
description: "the path to the Docker build context"
versions: ">=0.0.1"
Loading