From 7409aa2e0133a2c278a78a97edc610527fddd0f0 Mon Sep 17 00:00:00 2001 From: robertIsaac Date: Wed, 31 Jul 2024 14:28:26 +0300 Subject: [PATCH] docs(misc): fix azure yml (#22480) --- docs/nx-cloud/enterprise/dte/azure-dte.md | 14 +++++++++----- docs/shared/monorepo-ci-azure.md | 2 ++ 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/docs/nx-cloud/enterprise/dte/azure-dte.md b/docs/nx-cloud/enterprise/dte/azure-dte.md index cf7ddfd0cbc23..de8c41bb97df5 100644 --- a/docs/nx-cloud/enterprise/dte/azure-dte.md +++ b/docs/nx-cloud/enterprise/dte/azure-dte.md @@ -32,6 +32,10 @@ jobs: pool: vmImage: 'ubuntu-latest' steps: + - checkout: self + fetchDepth: 0 + persistCredentials: true + - script: npm ci - script: npx nx-cloud start-agent @@ -41,11 +45,7 @@ jobs: vmImage: 'ubuntu-latest' steps: # Get last successfull commit from Azure Devops CLI - - displayName: 'Get last successful commit SHA' - condition: ne(variables['Build.Reason'], 'PullRequest') - env: - AZURE_DEVOPS_EXT_PAT: $(System.AccessToken) - bash: | + - bash: | LAST_SHA=$(az pipelines build list --branch $(Build.SourceBranchName) --definition-ids $(System.DefinitionId) --result succeeded --top 1 --query "[0].triggerInfo.\"ci.sourceSha\"") if [ -z "$LAST_SHA" ] then @@ -54,6 +54,10 @@ jobs: echo "Last successful commit SHA: $LAST_SHA" echo "##vso[task.setvariable variable=BASE_SHA]$LAST_SHA" fi + displayName: 'Get last successful commit SHA' + condition: ne(variables['Build.Reason'], 'PullRequest') + env: + AZURE_DEVOPS_EXT_PAT: $(System.AccessToken) - script: git branch --track main origin/main - script: npm ci diff --git a/docs/shared/monorepo-ci-azure.md b/docs/shared/monorepo-ci-azure.md index 589f0ede38a91..e4bd7ade06a30 100644 --- a/docs/shared/monorepo-ci-azure.md +++ b/docs/shared/monorepo-ci-azure.md @@ -28,6 +28,8 @@ jobs: steps: - checkout: self fetchDepth: 0 + persistCredentials: true + # Set Azure Devops CLI default settings - bash: az devops configure --defaults organization=$(System.TeamFoundationCollectionUri) project=$(System.TeamProject) displayName: 'Set default Azure DevOps organization and project'