11#! /usr/bin/env bash
22
3- # This script will scan through a list of files to validate that all versions are consistent with the master version
3+ # This script will scan through a list of files to validate that all versions are consistent with
4+ # - Master version (could be snapshot)
5+ # - Highest stable commit (latest tag)
46set -e
57
6- # List of files to validate
7- declare -a files_to_validate=(
8- " infra/charts/feast/Chart.yaml"
9- " infra/charts/feast/charts/feast-core/Chart.yaml"
10- " infra/charts/feast/charts/feast-serving/Chart.yaml"
11- " infra/charts/feast/charts/feast-jupyter/Chart.yaml"
12- " infra/charts/feast/requirements.yaml" # We are only testing for the version once
13- )
14-
158# Determine the current Feast version from Maven (pom.xml)
169export FEAST_MASTER_VERSION=$( mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
1710[[ -z " $FEAST_MASTER_VERSION " ]] && {
1811 echo " $FEAST_MASTER_VERSION is missing, please check pom.xml and maven"
1912 exit 1
2013}
2114
15+ # Determine the highest released version from Git history
16+ git fetch --prune --unshallow --tags || true
17+ FEAST_RELEASE_VERSION_WITH_V=$( git tag -l --sort -version:refname | head -n 1)
18+ echo $FEAST_RELEASE_VERSION_WITH_V
19+
20+ export FEAST_RELEASE_VERSION=${FEAST_RELEASE_VERSION_WITH_V# " v" }
21+ echo $FEAST_RELEASE_VERSION
22+
23+ [[ -z " $FEAST_RELEASE_VERSION " ]] && {
24+ echo " FEAST_RELEASE_VERSION is missing"
25+ exit 1
26+ }
27+
28+ # List of files to validate with master version (from pom.xml)
29+ # Structure is a comma separated list of structure
30+ # <File to validate>, <Amount of occurrences of specific version to look for>, <version to look for>
31+ #
32+
33+ declare -a files_to_validate_version=(
34+ " infra/charts/feast/Chart.yaml,1,${FEAST_MASTER_VERSION} "
35+ " infra/charts/feast/charts/feast-core/Chart.yaml,1,${FEAST_MASTER_VERSION} "
36+ " infra/charts/feast/charts/feast-core/values.yaml,1,${FEAST_RELEASE_VERSION} "
37+ " infra/charts/feast/charts/feast-core/README.md,1,${FEAST_RELEASE_VERSION} "
38+ " infra/charts/feast/charts/feast-serving/Chart.yaml,1,${FEAST_MASTER_VERSION} "
39+ " infra/charts/feast/charts/feast-jupyter/values.yaml,1,${FEAST_RELEASE_VERSION} "
40+ " infra/charts/feast/charts/feast-jupyter/README.md,1,${FEAST_RELEASE_VERSION} "
41+ " infra/charts/feast/charts/feast-jupyter/Chart.yaml,1,${FEAST_MASTER_VERSION} "
42+ " infra/charts/feast/charts/feast-serving/values.yaml,1,${FEAST_RELEASE_VERSION} "
43+ " infra/charts/feast/charts/feast-serving/README.md,1,${FEAST_RELEASE_VERSION} "
44+ " infra/charts/feast/requirements.yaml,4,${FEAST_MASTER_VERSION} "
45+ " infra/charts/feast/requirements.lock,4,${FEAST_RELEASE_VERSION} "
46+ " infra/docker-compose/.env.sample,1,${FEAST_RELEASE_VERSION} "
47+ )
48+
2249echo
23- echo " Testing list of files to ensure they have the following version $FEAST_MASTER_VERSION "
50+ echo " Testing list of files to ensure they have the correct version"
2451echo
2552
26- for i in " ${files_to_validate[@]} " ; do
53+ for i in " ${files_to_validate_version[@]} " ; do
54+ IFS=' ,' read -r FILE_PATH EXPECTED_OCCURRENCES VERSION <<< " ${i}"
2755 echo
2856 echo
29- echo " Testing whether versions are correctly set within file: $i "
57+ echo " Testing whether versions are correctly set within file: $FILE_PATH "
3058 echo
3159 echo " File contents:"
3260 echo " ========================================================="
33- cat " $i "
61+ cat " $FILE_PATH "
62+ echo
3463 echo " ========================================================="
35- grep -q " $FEAST_MASTER_VERSION " " $i "
36- echo " SUCCESS: Version found"
64+ ACTUAL_OCCURRENCES=$( grep -c " $VERSION " " $FILE_PATH " || true)
65+
66+ if [ " ${ACTUAL_OCCURRENCES} " -eq " ${EXPECTED_OCCURRENCES} " ]; then
67+ echo " SUCCESS"
68+ echo
69+ echo " Expecting $EXPECTED_OCCURRENCES occurrences of $VERSION in $FILE_PATH , and found $ACTUAL_OCCURRENCES "
70+ else
71+ echo " FAILURE"
72+ echo
73+ echo " Expecting $EXPECTED_OCCURRENCES occurrences of $VERSION in $FILE_PATH , but found $ACTUAL_OCCURRENCES "
74+ exit 1
75+ fi
3776 echo " ========================================================="
38- done
77+ done
0 commit comments