[Ci]: check if there is a sonic dirty version issue (#10445)

Why I did it
[Ci]: check if there is a sonic dirty version issue
If there is a dirty version issue in PR build, the build will be failed.
This commit is contained in:
xumia 2022-04-08 10:49:21 +08:00 committed by GitHub
parent 51e4e8068e
commit f24a04fa3d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 0 deletions

View File

@ -132,3 +132,4 @@ jobs:
make $BUILD_OPTIONS target/sonic-$(GROUP_NAME).bin make $BUILD_OPTIONS target/sonic-$(GROUP_NAME).bin
fi fi
displayName: "Build sonic image" displayName: "Build sonic image"
- template: check-dirty-version.yml

View File

@ -0,0 +1,16 @@
steps:
- script: |
. functions.sh
SONIC_VERSION=$(sonic_get_version)
echo "SONIC_VERSION=$SONIC_VERSION"
if [[ "$SONIC_VERSION" == *dirty* ]]; then
# Print the detail dirty info
git status --untracked-files=no -s --ignore-submodules
# Exit with error, if it is a PR build
if [ "$(Build.Reason)" == "PullRequest" ]; then
echo "Build failed for the dirty version: $SONIC_VERSION" 1>&2
exit 1
fi
fi
displayName: "Check the dirty version"