-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8436 from dragonchaser/check-env-var-annotations
Check env var annotations
- Loading branch information
Showing
3 changed files
with
61 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#!/bin/bash | ||
|
||
# The following grep will filter out every line containing an `env` annotation | ||
# it will ignore every line that has allready a valid `introductionVersion` annotation | ||
# | ||
# valid examples: | ||
# | ||
# introductionVersion:"pre5.0" | ||
# introductionVersion:"5.0" | ||
# introductionVersion:"4.9.3-rc5" | ||
# introductionVersion:"5.0.1-cheesecake" | ||
# introductionVersion:"5.10.100.15" | ||
# introductionVersion:"0.0" | ||
# | ||
# invalid examples: | ||
# | ||
# introductionVersion:"5.0cheesecake" | ||
# introductionVersion:"5" | ||
# introductionVersion:"5blueberry" | ||
# introductionVersion:"5-lasagna" | ||
# introductionVersion:"4.9.3rc5" | ||
|
||
ERROR=0 | ||
|
||
SEMVER_REGEX="([0-9]|[1-9][0-9]*)(\.([0-9]|[1-9][0-9]*)){1,2}(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+)?" | ||
|
||
QUERY_INTRO=$(git grep "env:" -- '*.go' |grep -v -P "introductionVersion:\"($SEMVER_REGEX|(pre5\.0))\""|grep -v "_test.go"|grep -v "vendor/") | ||
|
||
RESULTS_INTRO=$(echo "${QUERY_INTRO}"|wc -l) | ||
if [ "${RESULTS_INTRO}" -gt 0 ]; then | ||
echo "===============================================================================================" | ||
echo "The following ${RESULTS_INTRO} files contain an invalid introductionVersion annotation:" | ||
echo "===============================================================================================" | ||
echo "$QUERY_INTRO" | ||
ERROR=1 | ||
fi | ||
|
||
# The following grep will filter out every line containing an `env` annotation | ||
# it will ignore every line that has allready a valid `desc` annotation | ||
|
||
QUERY_DESC=$(git grep "env:" -- '*.go' |grep -v -P "desc:\".{10,}\""|grep -v "_test.go"|grep -v "vendor/") | ||
|
||
RESULTS_DESC=$(echo "${QUERY_DESC}"|wc -l) | ||
if [ "${RESULTS_DESC}" -gt 0 ]; then | ||
echo "===============================================================================================" | ||
echo "The following ${RESULTS_DESC} files contain an invalid description annotation:" | ||
echo "===============================================================================================" | ||
echo "$QUERY_DESC" | ||
ERROR=1 | ||
fi | ||
exit ${ERROR} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Enhancement: Add a make step to validate the env var annotations | ||
|
||
We have added a make step `make validate-env-var-annotations` to validate the env var annotations in to the environment variables. | ||
|
||
https://github.com/owncloud/ocis/pull/8436 | ||
https://github.com/owncloud/ocis/issues/8258 |