From 0e4c86e23c291d75262ac28fb84e57ab782bc736 Mon Sep 17 00:00:00 2001 From: "Collin M. Barrett" Date: Sun, 16 Feb 2020 12:56:07 -0600 Subject: [PATCH] try using skip ci to avoid re-migrating --- server/azure-pipelines.migrate.yaml | 35 ++++++++++++++--------------- 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/server/azure-pipelines.migrate.yaml b/server/azure-pipelines.migrate.yaml index a8cf1d0c6..14b7d4c3a 100644 --- a/server/azure-pipelines.migrate.yaml +++ b/server/azure-pipelines.migrate.yaml @@ -30,26 +30,25 @@ jobs: git clone "$FORKURI" . git checkout "$SYSTEM_PULLREQUEST_SOURCEBRANCH" - # TODO: possibly eliminate: https://docs.microsoft.com/en-us/azure/devops/pipelines/scripts/git-commands?view=azure-devops&tabs=yaml#how-do-i-avoid-triggering-a-ci-build-when-the-script-pushes - - task: Bash@3 - displayName: abort if just migrated - env: - GITHUBNAME: $(GITHUBNAME) - inputs: - targetType: inline - script: | - LASTAUTHOR=$(git log -n 1 --pretty=format:"%an") - LASTMSG=$(git log -n 1 --pretty=format:"%s") - if [[ $LASTAUTHOR == "$GITHUBNAME" ]] && [[ $LASTMSG == "migrate PR #$SYSTEM_PULLREQUEST_PULLREQUESTNUMBER" ]] ; then - echo "Just migrated. Aborting..." - else - echo "##vso[task.setvariable variable=required;isOutput=true]true" - fi + # - task: Bash@3 + # displayName: abort if just migrated + # env: + # GITHUBNAME: $(GITHUBNAME) + # inputs: + # targetType: inline + # script: | + # LASTAUTHOR=$(git log -n 1 --pretty=format:"%an") + # LASTMSG=$(git log -n 1 --pretty=format:"%s") + # if [[ $LASTAUTHOR == "$GITHUBNAME" ]] && [[ $LASTMSG == "migrate PR #$SYSTEM_PULLREQUEST_PULLREQUESTNUMBER [skip ci]" ]] ; then + # echo "Just migrated. Aborting..." + # else + # echo "##vso[task.setvariable variable=required;isOutput=true]true" + # fi - job: AddMigration displayName: add migration dependsOn: IsMigrationRequired - condition: and(eq(variables['IsMigrationRequired.required'], 'true'), succeeded()) + # condition: and(eq(variables['IsMigrationRequired.required'], 'true'), succeeded()) steps: - checkout: none @@ -86,7 +85,7 @@ jobs: echo "$MIGLIST" if [[ $MIGLIST == *$SYSTEM_PULLREQUEST_PULLREQUESTNUMBER ]] ; then echo "A migration already exists for PR #$SYSTEM_PULLREQUEST_PULLREQUESTNUMBER. Reverting..." - REVERTHASH=$(git log -n 1 --author="$GITHUBNAME" --grep="migrate PR #$SYSTEM_PULLREQUEST_PULLREQUESTNUMBER" --pretty=format:"%H") + REVERTHASH=$(git log -n 1 --author="$GITHUBNAME" --grep="migrate PR #$SYSTEM_PULLREQUEST_PULLREQUESTNUMBER [skip ci]" --pretty=format:"%H") git revert --no-edit "$REVERTHASH" fi @@ -124,7 +123,7 @@ jobs: echo "No-op migration. Effective EF migrations add/change 3 files total (.Designer.cs, .cs, and *ModelSnapshot.cs). Abandoning..." else git add . - git commit -m "migrate PR #$SYSTEM_PULLREQUEST_PULLREQUESTNUMBER" + git commit -m "migrate PR #$SYSTEM_PULLREQUEST_PULLREQUESTNUMBER [skip ci]" echo "##vso[task.setvariable variable=added;isOutput=true]true" fi