-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Branch and RC Awareness to Version Lint & Fix Semver Regex #998
Merged
feast-ci-bot
merged 15 commits into
feast-dev:master
from
mrzzy:branch-aware-version-lint
Sep 11, 2020
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
49e87be
Update version lint script to detect maven, docker image and stable v…
mrzzy a76e282
Allow users to lint versions against their merge branch of choice by …
mrzzy 8d60885
Update development image tag version from 'dev' to 'develop' to make …
mrzzy 6c67443
Update lint version script to only echo file contents when version is…
mrzzy 06047c0
Update lint script to flag all failures instead of just one.
mrzzy fb5dc44
Remove file contents output from lint version script.
mrzzy c055f13
Update lint version script to make output more concise and readable.
mrzzy 6015b58
Use develop images instead of stable images in master deployments.
mrzzy 724d8b5
Update outdated documentation in serving readme.
mrzzy b5cba7e
Fix outdated version in datatypes java README.md and add version lint…
mrzzy 34be3b5
Add version lint checks to documentation.
mrzzy 7e547f0
Fix semver regex in github actions workflow not matching suffixless v…
mrzzy 7f412f1
Add version lint check for latest stable version in changelog.
mrzzy 8b57dd8
Update lint-version script use tool agnostic variable names.
mrzzy 4aa062e
Fix typo.
mrzzy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
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
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
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
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
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 |
---|---|---|
@@ -1,8 +1,8 @@ | ||
COMPOSE_PROJECT_NAME=feast | ||
FEAST_VERSION=0.6.2 | ||
FEAST_VERSION=develop | ||
GCP_SERVICE_ACCOUNT=./gcp-service-accounts/key.json | ||
FEAST_CORE_CONFIG=./core/core.yml | ||
FEAST_JOB_CONTROLLER_CONFIG=./jobcontroller/jobcontroller.yml | ||
FEAST_HISTORICAL_SERVING_CONFIG=./serving/historical-serving.yml | ||
FEAST_HISTORICAL_SERVING_ENABLED=false | ||
FEAST_ONLINE_SERVING_CONFIG=./serving/online-serving.yml | ||
FEAST_ONLINE_SERVING_CONFIG=./serving/online-serving.yml |
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 |
---|---|---|
@@ -1,80 +1,131 @@ | ||
#!/usr/bin/env bash | ||
|
||
# This script will scan through a list of files to validate that all versions are consistent with | ||
# - Master version (could be snapshot) | ||
# - Highest stable commit (latest tag) | ||
# - Master version: version set in maven (could be snapshot) | ||
# - Release version: 'dev' on master, Lastest tag on release branches. | ||
# - Stable Version: Highest stable tag. release candidates not included. | ||
# Usage: ./validate-version-consistency.sh | ||
# Optionaly set TARGET_MERGE_BRANCH var to the target merge branch to lint | ||
# versions against the given merge branch. | ||
set -e | ||
|
||
BRANCH_NAME=${TARGET_MERGE_BRANCH-$(git rev-parse --abbrev-ref HEAD)} | ||
# Matches (ie vMAJOR.MINOR-branch) release branch names | ||
RELEASE_BRANCH_REGEX="^v[0-9]+\.[0-9]+-branch$" | ||
|
||
# Determine the current Feast version from Maven (pom.xml) | ||
export FEAST_MASTER_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) | ||
[[ -z "$FEAST_MASTER_VERSION" ]] && { | ||
echo "$FEAST_MASTER_VERSION is missing, please check pom.xml and maven" | ||
exit 1 | ||
} | ||
echo "Linting Master Version: $FEAST_MASTER_VERSION" | ||
|
||
# Determine the highest released version from Git history | ||
git fetch --prune --unshallow --tags || true | ||
FEAST_RELEASE_VERSION_WITH_V=$(git tag -l --sort -version:refname | head -n 1) | ||
echo $FEAST_RELEASE_VERSION_WITH_V | ||
|
||
export FEAST_RELEASE_VERSION=${FEAST_RELEASE_VERSION_WITH_V#"v"} | ||
echo $FEAST_RELEASE_VERSION | ||
|
||
# Determine Last release tag relative to current branch | ||
if [ $BRANCH_NAME = "master" ] | ||
then | ||
# Use development version | ||
FEAST_RELEASE_VERSION="develop" | ||
elif echo "$BRANCH_NAME" | grep -P $RELEASE_BRANCH_REGEX &>/dev/null | ||
then | ||
# Use last release tag tagged on the release branch | ||
LAST_MERGED_TAG=$(git tag -l --sort -version:refname --merged | head -n 1) | ||
FEAST_MASTER_VERSION=${LAST_MERGED_TAG#"v"} | ||
else | ||
# Do not enforce version linting as we don't know if the target merge branch FEAST_RELEASE_VERSION="_ANY" | ||
FEAST_RELEASE_VERSION="_ANY" | ||
echo "WARNING: Skipping docker version lint" | ||
fi | ||
[[ -z "$FEAST_RELEASE_VERSION" ]] && { | ||
echo "FEAST_RELEASE_VERSION is missing" | ||
exit 1 | ||
} | ||
export FEAST_RELEASE_VERSION | ||
echo "Linting Release Version: $FEAST_RELEASE_VERSION" | ||
|
||
# Determine highest stable version (no release candidates) relative to current branch. | ||
# Regular expression for matching stable tags in the format vMAJOR.MINOR.PATCH | ||
STABLE_TAG_REGEX="^v[0-9]+\.[0-9]+\.[0-9]+$" | ||
if [ $BRANCH_NAME = "master" ] | ||
then | ||
# Use last stable tag repo wide | ||
LAST_STABLE_TAG=$(git tag --sort -version:refname | grep -P "$STABLE_TAG_REGEX" | head -n 1) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will break if the user tries to lint-version when checking out a specific commit in master as it does not take tag date into account. |
||
FEAST_STABLE_VERSION=${LAST_STABLE_TAG#"v"} | ||
elif echo "$BRANCH_NAME" | grep -P $RELEASE_BRANCH_REGEX &>/dev/null | ||
then | ||
# Use last stable tag tagged on the release branch | ||
LAST_STABLE_MERGE_TAG=$(git tag --sort -version:refname --merged | grep -P "$STABLE_TAG_REGEX" | head -n 1) | ||
FEAST_STABLE_VERSION=${LAST_STABLE_MERGE_TAG#"v"} | ||
else | ||
# Do not enforce version linting as we don't know if the target merge branch | ||
FEAST_STABLE_VERSION="_ANY" | ||
echo "WARNING: Skipping stable version lint" | ||
fi | ||
[[ -z "$FEAST_STABLE_VERSION" ]] && { | ||
echo "FEAST_STABLE_VERSION is missing" | ||
exit 1 | ||
} | ||
export FEAST_STABLE_VERSION | ||
echo "Linting Stable Version: $FEAST_STABLE_VERSION" | ||
|
||
# List of files to validate with master version (from pom.xml) | ||
# Structure is a comma separated list of structure | ||
# <File to validate>, <Amount of occurrences of specific version to look for>, <version to look for> | ||
# | ||
|
||
declare -a files_to_validate_version=( | ||
"infra/charts/feast/Chart.yaml,1,${FEAST_MASTER_VERSION}" | ||
"infra/charts/feast/charts/feast-core/Chart.yaml,1,${FEAST_MASTER_VERSION}" | ||
"infra/charts/feast/charts/feast-core/values.yaml,1,${FEAST_RELEASE_VERSION}" | ||
"infra/charts/feast/charts/feast-core/README.md,1,${FEAST_MASTER_VERSION}" | ||
"infra/charts/feast/charts/feast-core/README.md,1,${FEAST_RELEASE_VERSION}" | ||
"infra/charts/feast/charts/feast-serving/Chart.yaml,1,${FEAST_MASTER_VERSION}" | ||
"infra/charts/feast/charts/feast-jupyter/values.yaml,1,${FEAST_RELEASE_VERSION}" | ||
"infra/charts/feast/charts/feast-jupyter/README.md,1,${FEAST_RELEASE_VERSION}" | ||
"infra/charts/feast/charts/feast-jupyter/README.md,1,${FEAST_MASTER_VERSION}" | ||
"infra/charts/feast/charts/feast-jupyter/Chart.yaml,1,${FEAST_MASTER_VERSION}" | ||
"infra/charts/feast/charts/feast-serving/values.yaml,1,${FEAST_RELEASE_VERSION}" | ||
"infra/charts/feast/charts/feast-serving/README.md,1,${FEAST_RELEASE_VERSION}" | ||
"infra/charts/feast/charts/feast-serving/README.md,1,${FEAST_MASTER_VERSION}" | ||
"infra/charts/feast/charts/feast-jobcontroller/Chart.yaml,1,${FEAST_MASTER_VERSION}" | ||
"infra/charts/feast/charts/feast-jobcontroller/values.yaml,1,${FEAST_RELEASE_VERSION}" | ||
"infra/charts/feast/charts/feast-jobcontroller/README.md,1,${FEAST_MASTER_VERSION}" | ||
"infra/charts/feast/charts/feast-jobcontroller/README.md,1,${FEAST_RELEASE_VERSION}" | ||
"infra/charts/feast/requirements.yaml,4,${FEAST_MASTER_VERSION}" | ||
"infra/charts/feast/requirements.lock,4,${FEAST_RELEASE_VERSION}" | ||
"infra/charts/feast/requirements.lock,4,${FEAST_MASTER_VERSION}" | ||
"infra/docker-compose/.env.sample,1,${FEAST_RELEASE_VERSION}" | ||
"datatypes/java/README.md,1,${FEAST_MASTER_VERSION}" | ||
"docs/contributing/development-guide.md,4,${FEAST_MASTER_VERSION}" | ||
"docs/administration/audit-logging.md,1,${FEAST_STABLE_VERSION}" | ||
"docs/getting-started/deploying-feast/docker-compose.md,1,${FEAST_STABLE_VERSION}" | ||
"docs/getting-started/deploying-feast/kubernetes.md,1,${FEAST_STABLE_VERSION}" | ||
"README.md,1,${FEAST_STABLE_VERSION}" | ||
"CHANGELOG.md,2,${FEAST_STABLE_VERSION}" | ||
) | ||
|
||
echo | ||
echo "Testing list of files to ensure they have the correct version" | ||
echo | ||
|
||
|
||
IS_LINT_SUCCESS=true | ||
for i in "${files_to_validate_version[@]}"; do | ||
IFS=',' read -r FILE_PATH EXPECTED_OCCURRENCES VERSION <<<"${i}" | ||
echo | ||
echo | ||
echo "Testing whether versions are correctly set within file: $FILE_PATH" | ||
echo | ||
echo "File contents:" | ||
echo "=========================================================" | ||
cat "$FILE_PATH" | ||
echo | ||
# Disable version lint if '_ANY' specified as version. | ||
if [ "$VERSION" = "_ANY" ] | ||
then | ||
continue | ||
fi | ||
|
||
echo "=========================================================" | ||
ACTUAL_OCCURRENCES=$(grep -c "$VERSION" "$FILE_PATH" || true) | ||
echo "Testing whether versions are correctly set within file: $FILE_PATH" | ||
ACTUAL_OCCURRENCES=$(grep -c -P "\bv?$VERSION\b" "$FILE_PATH" || true) | ||
|
||
if [ "${ACTUAL_OCCURRENCES}" -eq "${EXPECTED_OCCURRENCES}" ]; then | ||
echo "SUCCESS" | ||
echo | ||
echo "Expecting $EXPECTED_OCCURRENCES occurrences of $VERSION in $FILE_PATH, and found $ACTUAL_OCCURRENCES" | ||
echo "OK: Expecting $EXPECTED_OCCURRENCES occurrences of '$VERSION' in $FILE_PATH, and found $ACTUAL_OCCURRENCES" | ||
else | ||
echo "FAILURE" | ||
echo | ||
echo "Expecting $EXPECTED_OCCURRENCES occurrences of $VERSION in $FILE_PATH, but found $ACTUAL_OCCURRENCES" | ||
exit 1 | ||
echo "FAIL: Expecting $EXPECTED_OCCURRENCES occurrences of '$VERSION' in $FILE_PATH, but found $ACTUAL_OCCURRENCES" | ||
IS_LINT_SUCCESS=false | ||
fi | ||
echo "=========================================================" | ||
done | ||
|
||
if $IS_LINT_SUCCESS; then exit 0; else exit 1; fi |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--merged
would ensure lint-version will to work if user checks out a specific commit in a vX.Y-branch release branch as it only lists tags reachable from HEAD.