Skip to content

Commit 93585b0

Browse files
fix
1 parent 52b8775 commit 93585b0

File tree

1 file changed

+0
-55
lines changed

1 file changed

+0
-55
lines changed

.azure-pipelines/azure-pipelines-UpgrateVersion.yml

-55
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,6 @@ stages:
5757
pool:
5858
vmImage: 'ubuntu-20.04'
5959
steps:
60-
- script: |
61-
if [ -z "$(which gh)" ]; then
62-
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key C99B11DEB97541F0
63-
sudo apt-add-repository https://cli.github.com/packages
64-
sudo apt update
65-
sudo apt install gh
66-
fi
67-
displayName: 'Install gh'
6860
- checkout: self
6961
displayName: 'Checkout code'
7062
- download: current
@@ -91,53 +83,6 @@ stages:
9183
done
9284
git diff files/build/versions
9385
displayName: 'Freeze Versions'
94-
- script: |
95-
if [ -z "$GIT_USER" ]; then
96-
echo "Skipped to send the pull request, GIT_USER not set."
97-
exit 0
98-
fi
99-
GIT_STATUS=$(git status --porcelain files/build/versions)
100-
if [ -z "$GIT_STATUS" ]; then
101-
echo "Skipped to send the pull request, no version change in files/build/versions"
102-
exit 0
103-
fi
104-
if [ ! -d "$HOME" ]; then
105-
sudo mkdir -p $HOME
106-
sudo chown -R $(id -un):$(id -gn) $HOME
107-
fi
108-
SOURCE_BRANCH=$(Build.SourceBranch)
109-
REPO_NAME=$(Build.Repository.Name)
110-
[ -z "$GIT_REPO" ] && GIT_REPO=${REPO_NAME#*/}
111-
BRANCH_NAME=repd/versions/${SOURCE_BRANCH#refs/heads/}
112-
echo '#!/bin/bash' > git_env_password.sh
113-
echo 'echo $GIT_PASSWORD' >> git_env_password.sh
114-
chmod a+x git_env_password.sh
115-
export GIT_ASKPASS=./git_env_password.sh
116-
117-
git config user.name $GIT_USER
118-
git config credential.https://g.yxqyang.asia.username $GIT_USER
119-
git add files/build/versions
120-
git commit -m "[ci/build]: Upgrade SONiC package versions"
121-
git checkout -b $BRANCH_NAME
122-
git remote add remote https://github.com/$GIT_USER/$GIT_REPO
123-
git push remote HEAD:refs/heads/$BRANCH_NAME -f
124-
git branch -u remote/$BRANCH_NAME
125-
126-
echo $GIT_PASSWORD | gh auth login --with-token
127-
TITLE="Upgrade SONiC Versions"
128-
BODY="Upgrade SONiC Versions"
129-
RET=0
130-
if ! gh pr create -t "$TITLE" -b "$BODY" -B $(Build.SourceBranch) -R $(Build.Repository.Name) > pr.log 2>&1; then
131-
if ! grep -q "already exists" pr.log; then
132-
RET=1
133-
fi
134-
fi
135-
cat pr.log
136-
exit $RET
137-
env:
138-
GIT_USER: $(GIT_USER)
139-
GIT_PASSWORD: $(GIT_PASSWORD)
140-
displayName: 'Send Pull Request'
14186
- publish: $(System.DefaultWorkingDirectory)/files/build/versions
14287
artifact: 'sonic-buildimage.versions'
14388
displayName: 'Archive SONiC versions'

0 commit comments

Comments
 (0)