diff --git a/.azure-pipelines-templates/deploy_aci.yml b/.azure-pipelines-templates/deploy_aci.yml index db021a791..2ccbf98cb 100644 --- a/.azure-pipelines-templates/deploy_aci.yml +++ b/.azure-pipelines-templates/deploy_aci.yml @@ -16,10 +16,15 @@ jobs: - script: | set -ex RETRIES=500 - LAST_COMMIT=(`git log -1 --pretty=%B`) - GIT_SHA=${LAST_COMMIT[1]} - echo "##vso[task.setvariable variable=gitSha;isOutput=true]$GIT_SHA" - until [ $RETRIES -eq 0 ] || [[ `az acr repository show-tags -n ccfmsrc --repository ccf/ci` == *"$GIT_SHA"* ]] + HEAD_SHA=`git rev-parse HEAD` + if [ -n $(System.PullRequest.PullRequestId) ]; then + # If this is the case, we're running in a PR, and the SHA we really want is in the + # commit message of the last commit (which merges it into target) + LAST_COMMIT=(`git log -1 --pretty=%B`) + HEAD_SHA=${LAST_COMMIT[1]} + fi + echo "##vso[task.setvariable variable=gitSha;isOutput=true]$HEAD_SHA" + until [ $RETRIES -eq 0 ] || [[ `az acr repository show-tags -n ccfmsrc --repository ccf/ci` == *"$HEAD_SHA"* ]] do sleep 10 echo "$(( RETRIES-- )) tries remaining" diff --git a/.github/workflows/build-ci-container.yml b/.github/workflows/build-ci-container.yml index da4590367..996c676ea 100644 --- a/.github/workflows/build-ci-container.yml +++ b/.github/workflows/build-ci-container.yml @@ -44,7 +44,7 @@ jobs: run: docker pull $ACR_REGISTRY/ccf/ci:oe-0.18.4-hspec-snp - name: Build CCF CI SNP container - run: docker build -f docker/ccf_ci_built . --build-arg="base=ccfmsrc.azurecr.io/ccf/ci:oe-0.18.4-hspec" --build-arg="platform=snp" -t $ACR_REGISTRY/ccf/ci:pr-${{ github.event.pull_request.head.sha }} + run: docker build -f docker/ccf_ci_built . --build-arg="base=ccfmsrc.azurecr.io/ccf/ci:oe-0.18.4-hspec" --build-arg="platform=snp" -t $ACR_REGISTRY/ccf/ci:pr-`git rev-parse HEAD` - name: Push CI container - run: docker push $ACR_REGISTRY/ccf/ci:pr-${{ github.event.pull_request.head.sha }} + run: docker push $ACR_REGISTRY/ccf/ci:pr-`git rev-parse HEAD`