Skip to content

Commit c84d50f

Browse files
Cherry pick adding checks before publish tasks in the release pipeline (#1307) (#1359)
## Why make this change? Cherry-picking so that we don't push images unnecessarily to MCR. - #1307 Co-authored-by: Shyam Sundar J <shyamsundarj@microsoft.com>
1 parent cae395a commit c84d50f

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

.pipelines/build-pipelines.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ steps:
208208

209209
- task: NuGetCommand@2
210210
displayName: 'Publish Nuget to Internal Feed'
211-
condition: eq(variables.isReleaseBuild, 'true')
211+
condition: and(succeeded(), eq(variables.isReleaseBuild, 'true'))
212212
inputs:
213213
command: 'push'
214214
feedsToUse: 'select'
@@ -220,7 +220,7 @@ steps:
220220

221221
- task: NuGetCommand@2
222222
displayName: 'Publish Nuget to Nuget.org'
223-
condition: eq(variables.isReleaseBuild, 'true')
223+
condition: and(succeeded(), eq(variables.isReleaseBuild, 'true'))
224224
inputs:
225225
command: push
226226
packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg;!$(Build.ArtifactStagingDirectory)/**/*.symbols.nupkg'
@@ -236,7 +236,7 @@ steps:
236236
# Create a draft release with Assets
237237
- task: GitHubRelease@1
238238
displayName: "Draft Github Release"
239-
condition: eq(variables.isReleaseBuild, 'true')
239+
condition: and(succeeded(), eq(variables.isReleaseBuild, 'true'))
240240
inputs:
241241
gitHubConnection: 'DataApiBuilder'
242242
repositoryName: '$(Build.Repository.Name)'
@@ -268,7 +268,7 @@ steps:
268268
# Build a docker image and push it to the container registry.
269269
- task: Docker@2
270270
displayName: "Build and push docker image to Azure Container Registry"
271-
condition: eq(variables.isReleaseBuild, 'false')
271+
condition: and(succeeded(), eq(variables.isReleaseBuild, 'false'))
272272
inputs:
273273
containerRegistry: 'CosmosDB GraphQL/Hawaii'
274274
repository: 'dab/$(Build.SourceBranch)'
@@ -282,7 +282,7 @@ steps:
282282
# Tag the image with the value of the releaseName variable and nuget release version.
283283
- task: Docker@2
284284
displayName: "Build and push docker image to Azure Container Registry tagged with releaseName and nuget release version"
285-
condition: eq(variables.isReleaseBuild, 'true')
285+
condition: and(succeeded(), eq(variables.isReleaseBuild, 'true'))
286286
inputs:
287287
containerRegistry: 'CosmosDB GraphQL/Hawaii'
288288
repository: 'dab'
@@ -299,7 +299,7 @@ steps:
299299
# Tag the image with dab version and latest.
300300
- task: Docker@2
301301
displayName: "Build and push docker image to ACR for publishing to MCR"
302-
condition: eq(variables.isReleaseBuild, 'true')
302+
condition: and(succeeded(), eq(variables.isReleaseBuild, 'true'))
303303
inputs:
304304
containerRegistry: 'CosmosDB GraphQL/Hawaii'
305305
repository: 'public/azure-databases/data-api-builder'
@@ -308,4 +308,3 @@ steps:
308308
tags: |
309309
$(dabVersion)
310310
latest
311-

0 commit comments

Comments
 (0)