Skip to content

Commit 26580e6

Browse files
author
Evans Aboge (from Dev Box)
committed
Remove build arg and add build date to tag
1 parent 79cb6d6 commit 26580e6

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

.azure-pipelines/ci-build.yml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ pr:
2222
- task/migrate-acr-pipeline
2323

2424
variables:
25-
REGISTRY: 'msgraphpperegistry.azurecr.io'
25+
REGISTRY: 'msgraphprodregistry.azurecr.io'
2626
IMAGE_NAME: 'public/openapi/hidi'
2727
PREVIEW_BRANCH: 'refs/heads/task/migrate-acr-pipeline'
2828

@@ -35,7 +35,7 @@ steps:
3535
- task: AzureCLI@2
3636
displayName: 'Login to Azure Container Registry'
3737
inputs:
38-
azureSubscription: 'ACR Push Test'
38+
azureSubscription: 'ACR Images Push Service Connection'
3939
scriptType: bash
4040
scriptLocation: inlineScript
4141
inlineScript: |
@@ -89,35 +89,38 @@ steps:
8989
9090
- bash: |
9191
date=$(date +'%Y%m%d')
92+
echo "Date value: $date"
93+
echo "##vso[task.setvariable variable=BUILDDATE;isOutput=true]$date"
9294
echo "##vso[task.setvariable variable=BUILDDATE]$date"
9395
displayName: 'Get current date'
96+
name: setdate
9497
condition: eq(variables['Build.SourceBranch'], variables['PREVIEW_BRANCH'])
9598
9699
- bash: |
97100
echo "Building Docker image..."
101+
echo "Using build date: ${BUILDDATE}"
98102
# Using quotes around tags to prevent flag interpretation
99103
docker build \
100-
--build-arg "version_suffix=preview.${BUILDDATE}${RUNNUMBER}" \
101104
-t "$(REGISTRY)/$(IMAGE_NAME):nightly" \
102-
-t "$(REGISTRY)/$(IMAGE_NAME):${VERSION}" \
105+
-t "$(REGISTRY)/$(IMAGE_NAME):${VERSION}.${BUILDDATE}${RUNNUMBER}" \
103106
"$(Build.SourcesDirectory)"
104107
105108
echo "Pushing Docker image with nightly tag..."
106109
docker push "$(REGISTRY)/$(IMAGE_NAME):nightly"
107-
docker push "$(REGISTRY)/$(IMAGE_NAME):${VERSION}"
110+
docker push "$(REGISTRY)/$(IMAGE_NAME):${VERSION}.${BUILDDATE}${RUNNUMBER}"
108111
displayName: 'Build and Push Nightly Image'
109112
condition: eq(variables['Build.SourceBranch'], variables['PREVIEW_BRANCH'])
110113
111114
- bash: |
112115
echo "Building Docker image for release..."
113116
docker build \
114117
-t "$(REGISTRY)/$(IMAGE_NAME):latest" \
115-
-t "$(REGISTRY)/$(IMAGE_NAME):${VERSION}" \
118+
-t "$(REGISTRY)/$(IMAGE_NAME):${VERSION}.${BUILDDATE}${RUNNUMBER}" \
116119
"$(Build.SourcesDirectory)"
117120
118121
echo "Pushing Docker image with latest and version tags..."
119122
docker push "$(REGISTRY)/$(IMAGE_NAME):latest"
120-
docker push "$(REGISTRY)/$(IMAGE_NAME):${VERSION}"
123+
docker push "$(REGISTRY)/$(IMAGE_NAME):${VERSION}.${BUILDDATE}${RUNNUMBER}"
121124
displayName: 'Build and Push Release Image'
122125
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/v')
123126

0 commit comments

Comments
 (0)