Skip to content

Commit f24a04f

Browse files
authored
[Ci]: check if there is a sonic dirty version issue (sonic-net#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.
1 parent 51e4e80 commit f24a04f

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

.azure-pipelines/azure-pipelines-build.yml

+1
Original file line numberDiff line numberDiff line change
@@ -132,3 +132,4 @@ jobs:
132132
make $BUILD_OPTIONS target/sonic-$(GROUP_NAME).bin
133133
fi
134134
displayName: "Build sonic image"
135+
- template: check-dirty-version.yml
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
steps:
2+
- script: |
3+
. functions.sh
4+
SONIC_VERSION=$(sonic_get_version)
5+
echo "SONIC_VERSION=$SONIC_VERSION"
6+
if [[ "$SONIC_VERSION" == *dirty* ]]; then
7+
# Print the detail dirty info
8+
git status --untracked-files=no -s --ignore-submodules
9+
10+
# Exit with error, if it is a PR build
11+
if [ "$(Build.Reason)" == "PullRequest" ]; then
12+
echo "Build failed for the dirty version: $SONIC_VERSION" 1>&2
13+
exit 1
14+
fi
15+
fi
16+
displayName: "Check the dirty version"

0 commit comments

Comments
 (0)