Skip to content

Commit

Permalink
Fix Helm chart requirements lock and version linting (#925)
Browse files Browse the repository at this point in the history
* Add validation count for version linting

* Add improved version linting

* Update Helm documentation

* Add lint validation for helm chart versions

* Fix lint versions step name

* Fix typo with FEAST_RELEASE_VERSION

* Always update tags
  • Loading branch information
woop authored Aug 3, 2020
1 parent 1f572e8 commit 3590339
Show file tree
Hide file tree
Showing 10 changed files with 67 additions and 29 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/complete.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v2
- name: install dependencies
- name: Lint versions throughout repo
run: make lint-versions

unit-test-java:
Expand Down
1 change: 0 additions & 1 deletion infra/charts/feast/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,6 @@ feast-batch-serving:
staging_location: gs://<bucket_name>/feast-staging-location
initial_retry_delay_seconds: 3
total_timeout_seconds: 21600
write_triggering_frequency_seconds: 600
subscriptions:
- name: "*"
project: "*"
Expand Down
2 changes: 1 addition & 1 deletion infra/charts/feast/charts/feast-core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Current chart version is `0.7-SNAPSHOT`
| gcpServiceAccount.existingSecret.name | string | `"feast-gcp-service-account"` | Name of the existing secret containing the service account |
| image.pullPolicy | string | `"IfNotPresent"` | Image pull policy |
| image.repository | string | `"gcr.io/kf-feast/feast-core"` | Docker image repository |
| image.tag | string | `"latest"` | Image tag |
| image.tag | string | `"0.6.2"` | Image tag |
| ingress.grpc.annotations | object | `{}` | Extra annotations for the ingress |
| ingress.grpc.auth.enabled | bool | `false` | Flag to enable auth |
| ingress.grpc.class | string | `"nginx"` | Which ingress controller to use |
Expand Down
2 changes: 1 addition & 1 deletion infra/charts/feast/charts/feast-core/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ image:
# image.repository -- Docker image repository
repository: gcr.io/kf-feast/feast-core
# image.tag -- Image tag
tag: latest
tag: 0.6.2
# image.pullPolicy -- Image pull policy
pullPolicy: IfNotPresent

Expand Down
2 changes: 1 addition & 1 deletion infra/charts/feast/charts/feast-jupyter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ Current chart version is `0.7-SNAPSHOT`
| gcpServiceAccount.existingSecret.name | string | `"feast-gcp-service-account"` | Name of the existing secret containing the service account |
| image.pullPolicy | string | `"Always"` | Image pull policy |
| image.repository | string | `"gcr.io/kf-feast/feast-jupyter"` | Docker image repository |
| image.tag | string | `"latest"` | Image tag |
| image.tag | string | `"0.6.2"` | Image tag |
| replicaCount | int | `1` | Number of pods that will be created |
2 changes: 1 addition & 1 deletion infra/charts/feast/charts/feast-jupyter/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ image:
# image.repository -- Docker image repository
repository: gcr.io/kf-feast/feast-jupyter
# image.tag -- Image tag
tag: latest
tag: 0.6.2
# image.pullPolicy -- Image pull policy
pullPolicy: Always

Expand Down
2 changes: 1 addition & 1 deletion infra/charts/feast/charts/feast-serving/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Current chart version is `0.7-SNAPSHOT`
| gcpServiceAccount.existingSecret.name | string | `"feast-gcp-service-account"` | Name of the existing secret containing the service account |
| image.pullPolicy | string | `"IfNotPresent"` | Image pull policy |
| image.repository | string | `"gcr.io/kf-feast/feast-serving"` | Docker image repository |
| image.tag | string | `"latest"` | Image tag |
| image.tag | string | `"0.6.2"` | Image tag |
| ingress.grpc.annotations | object | `{}` | Extra annotations for the ingress |
| ingress.grpc.auth.enabled | bool | `false` | Flag to enable auth |
| ingress.grpc.class | string | `"nginx"` | Which ingress controller to use |
Expand Down
2 changes: 1 addition & 1 deletion infra/charts/feast/charts/feast-serving/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ image:
# image.repository -- Docker image repository
repository: gcr.io/kf-feast/feast-serving
# image.tag -- Image tag
tag: latest
tag: 0.6.2
# image.pullPolicy -- Image pull policy
pullPolicy: IfNotPresent

Expand Down
8 changes: 4 additions & 4 deletions infra/charts/feast/requirements.lock
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
dependencies:
- name: feast-core
repository: ""
version: 0.5.1
version: 0.6.2
- name: feast-serving
repository: ""
version: 0.5.1
version: 0.6.2
- name: feast-serving
repository: ""
version: 0.5.1
version: 0.6.2
- name: feast-jupyter
repository: ""
version: 0.5.1
version: 0.6.2
- name: postgresql
repository: https://kubernetes-charts.storage.googleapis.com/
version: 8.6.1
Expand Down
73 changes: 56 additions & 17 deletions infra/scripts/validate-version-consistency.sh
Original file line number Diff line number Diff line change
@@ -1,38 +1,77 @@
#!/usr/bin/env bash

# This script will scan through a list of files to validate that all versions are consistent with the master version
# 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)
set -e

# List of files to validate
declare -a files_to_validate=(
"infra/charts/feast/Chart.yaml"
"infra/charts/feast/charts/feast-core/Chart.yaml"
"infra/charts/feast/charts/feast-serving/Chart.yaml"
"infra/charts/feast/charts/feast-jupyter/Chart.yaml"
"infra/charts/feast/requirements.yaml" # We are only testing for the version once
)

# 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
}

# 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

[[ -z "$FEAST_RELEASE_VERSION" ]] && {
echo "FEAST_RELEASE_VERSION is missing"
exit 1
}

# 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_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/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/requirements.yaml,4,${FEAST_MASTER_VERSION}"
"infra/charts/feast/requirements.lock,4,${FEAST_RELEASE_VERSION}"
"infra/docker-compose/.env.sample,1,${FEAST_RELEASE_VERSION}"
)

echo
echo "Testing list of files to ensure they have the following version $FEAST_MASTER_VERSION"
echo "Testing list of files to ensure they have the correct version"
echo

for i in "${files_to_validate[@]}"; do
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: $i"
echo "Testing whether versions are correctly set within file: $FILE_PATH"
echo
echo "File contents:"
echo "========================================================="
cat "$i"
cat "$FILE_PATH"
echo
echo "========================================================="
grep -q "$FEAST_MASTER_VERSION" "$i"
echo "SUCCESS: Version found"
ACTUAL_OCCURRENCES=$(grep -c "$VERSION" "$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"
else
echo "FAILURE"
echo
echo "Expecting $EXPECTED_OCCURRENCES occurrences of $VERSION in $FILE_PATH, but found $ACTUAL_OCCURRENCES"
exit 1
fi
echo "========================================================="
done
done

0 comments on commit 3590339

Please sign in to comment.