File tree Expand file tree Collapse file tree 1 file changed +19
-6
lines changed Expand file tree Collapse file tree 1 file changed +19
-6
lines changed Original file line number Diff line number Diff line change @@ -80,23 +80,36 @@ extends:
8080 inputs :
8181 targetType : inline
8282 script : |-
83- TARGET_BRANCH=$(TOOLKIT_BRANCH)
83+ CUSTOM_BRANCH=$(TOOLKIT_BRANCH)
84+ SOURCE_BRANCH=$(System.PullRequest.SourceBranch 2>/dev/null)
85+ TARGET_BRANCH=$(System.PullRequest.TargetBranch 2>/dev/null)
8486
8587 ls ~/.m2/repository/com/microsoft/azure/azure-toolkit-*
8688 cd ..
8789 git clone https://github.com/microsoft/azure-maven-plugins.git
88- cd azure-maven-plugins
90+ cd azure-maven-plugins/azure-toolkit-libs
8991
90- echo "build azure-toolkit-libs: $TARGET_BRANCH"
91- git fetch origin $TARGET_BRANCH
92- git checkout $TARGET_BRANCH
92+ custom_existed_in_remote=$(git ls-remote --heads origin ${CUSTOM_BRANCH})
93+ source_existed_in_remote=$(git ls-remote --heads origin ${SOURCE_BRANCH})
94+ target_existed_in_remote=$(git ls-remote --heads origin ${TARGET_BRANCH})
95+ if [[ -n ${custom_existed_in_remote} ]]; then
96+ BRANCH=$CUSTOM_BRANCH
97+ elif [[ -n ${source_existed_in_remote} ]]; then
98+ BRANCH=$SOURCE_BRANCH
99+ elif [[ -n ${target_existed_in_remote} ]]; then
100+ BRANCH=$TARGET_BRANCH
101+ fi
102+
103+ echo "build azure-toolkit-libs: $BRANCH"
104+ git fetch origin $BRANCH
105+ git checkout $BRANCH
93106
94107 git branch
95108 mvn clean install -T 4 -Dmaven.test.skip=true -Dmdep.analyze.skip=true -Dmaven.source.skip=true -Dmaven.javadoc.skip=true -Dcheckstyle.skip -B|| exit -1
96109
97110 ls ~/.m2/repository/com/microsoft/azure/azure-toolkit-*
98111 echo "cleaning up battlefield."
99- cd ../
112+ cd ../../
100113 rm -rf ./azure-maven-plugins
101114 exit 0
102115 - task : Bash@3
You can’t perform that action at this time.
0 commit comments