Skip to content

Commit ae2d22e

Browse files
bosesunehaUdeshyaDhungana
authored andcommitted
Add dockerfile param to az pipeline (Azure#558)
1 parent 8518bab commit ae2d22e

File tree

6 files changed

+28
-10
lines changed

6 files changed

+28
-10
lines changed

pkg/fixtures/workflows/azurepipelines/kustomize/.pipelines/azure-kubernetes-service.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ variables:
1111
kustomizePath: ./overlays/production
1212
namespace: default
1313
buildContextPath: .
14+
dockerfile: ./Dockerfile
1415
tag: "$(Build.BuildId)"
1516
vmImageName: "ubuntu-latest"
1617

@@ -35,8 +36,8 @@ stages:
3536
scriptType: "bash"
3637
scriptLocation: "inlineScript"
3738
inlineScript: |
38-
az acr build --image $1.azurecr.io/$2:$3 --registry $1 -g $4 $(buildContextPath)
39-
arguments: "$(azureContainerRegistry) $(containerName) $(tag) $(acrRg)"
39+
az acr build --image $1.azurecr.io/$2:$3 --registry $1 -g $4 -f $5 $6
40+
arguments: "$(azureContainerRegistry) $(containerName) $(tag) $(acrRg) $(dockerfile) $(buildContextPath)"
4041

4142
- stage: Deploy
4243
displayName: Deploy stage

pkg/fixtures/workflows/azurepipelines/manifests/.pipelines/azure-kubernetes-service.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ variables:
88
clusterRg: myrg
99
acrRg: myrg
1010
clusterName: testcluster
11-
manifestPath: ./manifests
11+
manifestPath: ./manifests/*
1212
namespace: default
1313
buildContextPath: .
14+
dockerfile: ./Dockerfile
1415
tag: "$(Build.BuildId)"
1516
vmImageName: "ubuntu-latest"
1617

@@ -35,8 +36,8 @@ stages:
3536
scriptType: "bash"
3637
scriptLocation: "inlineScript"
3738
inlineScript: |
38-
az acr build --image $1.azurecr.io/$2:$3 --registry $1 -g $4 $(buildContextPath)
39-
arguments: "$(azureContainerRegistry) $(containerName) $(tag) $(acrRg)"
39+
az acr build --image $1.azurecr.io/$2:$3 --registry $1 -g $4 -f $5 $6
40+
arguments: "$(azureContainerRegistry) $(containerName) $(tag) $(acrRg) $(dockerfile) $(buildContextPath)"
4041

4142
- stage: Deploy
4243
displayName: Deploy stage

template/azurePipelines/kustomize/.pipelines/azure-kubernetes-service.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ variables:
1111
kustomizePath: {{ .Config.GetVariableValue "KUSTOMIZEPATH" }}
1212
namespace: {{ .Config.GetVariableValue "NAMESPACE" }}
1313
buildContextPath: {{ .Config.GetVariableValue "BUILDCONTEXTPATH" }}
14+
dockerfile: {{ .Config.GetVariableValue "DOCKERFILE" }}
1415
tag: "$(Build.BuildId)"
1516
vmImageName: "ubuntu-latest"
1617

@@ -35,8 +36,8 @@ stages:
3536
scriptType: "bash"
3637
scriptLocation: "inlineScript"
3738
inlineScript: |
38-
az acr build --image $1.azurecr.io/$2:$3 --registry $1 -g $4 $(buildContextPath)
39-
arguments: "$(azureContainerRegistry) $(containerName) $(tag) $(acrRg)"
39+
az acr build --image $1.azurecr.io/$2:$3 --registry $1 -g $4 -f $5 $6
40+
arguments: "$(azureContainerRegistry) $(containerName) $(tag) $(acrRg) $(dockerfile) $(buildContextPath)"
4041

4142
- stage: Deploy
4243
displayName: Deploy stage

template/azurePipelines/kustomize/draft.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,10 @@ variables:
7070
value: "."
7171
description: "the path to the Docker build context"
7272
versions: ">=0.0.1"
73+
- name: "DOCKERFILE"
74+
type: "string"
75+
kind: "filePath"
76+
default:
77+
value: "./Dockerfile"
78+
description: "the path to the Dockerfile"
79+
versions: ">=0.0.1"

template/azurePipelines/manifests/.pipelines/azure-kubernetes-service.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ variables:
1111
manifestPath: {{ .Config.GetVariableValue "MANIFESTPATH" }}
1212
namespace: {{ .Config.GetVariableValue "NAMESPACE" }}
1313
buildContextPath: {{ .Config.GetVariableValue "BUILDCONTEXTPATH" }}
14+
dockerfile: {{ .Config.GetVariableValue "DOCKERFILE" }}
1415
tag: "$(Build.BuildId)"
1516
vmImageName: "ubuntu-latest"
1617

@@ -35,8 +36,8 @@ stages:
3536
scriptType: "bash"
3637
scriptLocation: "inlineScript"
3738
inlineScript: |
38-
az acr build --image $1.azurecr.io/$2:$3 --registry $1 -g $4 $(buildContextPath)
39-
arguments: "$(azureContainerRegistry) $(containerName) $(tag) $(acrRg)"
39+
az acr build --image $1.azurecr.io/$2:$3 --registry $1 -g $4 -f $5 $6
40+
arguments: "$(azureContainerRegistry) $(containerName) $(tag) $(acrRg) $(dockerfile) $(buildContextPath)"
4041

4142
- stage: Deploy
4243
displayName: Deploy stage

template/azurePipelines/manifests/draft.yaml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ variables:
5353
kind: "dirPath"
5454
default:
5555
disablePrompt: true
56-
value: "./manifests"
56+
value: "./manifests/*"
5757
description: "the path to the Kubernetes deployment manifest"
5858
versions: ">=0.0.1"
5959
- name: "NAMESPACE"
@@ -70,3 +70,10 @@ variables:
7070
value: "."
7171
description: "the path to the Docker build context"
7272
versions: ">=0.0.1"
73+
- name: "DOCKERFILE"
74+
type: "string"
75+
kind: "filePath"
76+
default:
77+
value: "./Dockerfile"
78+
description: "the path to the Dockerfile"
79+
versions: ">=0.0.1"

0 commit comments

Comments
 (0)