Skip to content

Commit 9c8e87b

Browse files
see-quickscholzj
andauthored
Add check for the released files (#66)
Signed-off-by: see-quick <[email protected]> Signed-off-by: Maros Orsak <[email protected]> Co-authored-by: Jakub Scholz <[email protected]>
1 parent 8a04a43 commit 9c8e87b

File tree

5 files changed

+83
-0
lines changed

5 files changed

+83
-0
lines changed

.azure/scripts/release_files_check.sh

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/usr/bin/env bash
2+
3+
set -eu
4+
5+
source ./.checksums
6+
SHA1SUM=sha1sum
7+
8+
RETURN_CODE=0
9+
10+
# Arrays holding the relevant information for each directory
11+
# TODO: after release add here "Helm Charts" HELM_CHART_CHECKSUM checksum_helm "./helm-charts" and "./packaging/helm-charts" in each line
12+
ITEMS=("install" "examples")
13+
CHECKSUM_VARS=("INSTALL_CHECKSUM" "EXAMPLES_CHECKSUM")
14+
MAKE_TARGETS=("checksum_install" "checksum_examples")
15+
DIRECTORIES=("./install" "./examples")
16+
PACKAGING_DIRS=("./packaging/install" "./packaging/examples")
17+
18+
for i in "${!ITEMS[@]}"; do
19+
NAME="${ITEMS[$i]}"
20+
CHECKSUM_VAR="${CHECKSUM_VARS[$i]}"
21+
MAKE_TARGET="${MAKE_TARGETS[$i]}"
22+
DIRECTORY="${DIRECTORIES[$i]}"
23+
PACKAGING_DIR="${PACKAGING_DIRS[$i]}"
24+
25+
CHECKSUM="$(make --no-print-directory $MAKE_TARGET)"
26+
EXPECTED_CHECKSUM="${!CHECKSUM_VAR}"
27+
28+
if [ "$CHECKSUM" != "$EXPECTED_CHECKSUM" ]; then
29+
echo "ERROR: Checksums of $DIRECTORY do not match."
30+
echo " Expected: ${EXPECTED_CHECKSUM}"
31+
echo " Actual: ${CHECKSUM}"
32+
echo "If your changes to $DIRECTORY are related to a new release, please update the checksums. Otherwise, please change only the files in the $PACKAGING_DIR directory. "
33+
RETURN_CODE=$((RETURN_CODE+1))
34+
else
35+
echo "Checksums of $DIRECTORY match => OK"
36+
fi
37+
done
38+
39+
exit $RETURN_CODE

.azure/templates/jobs/build_java.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ jobs:
3939
BUILD_REASON: $(Build.Reason)
4040
BRANCH: $(Build.SourceBranch)
4141
MVN_ARGS: "-e -V -B"
42+
- bash: "make release_files_check"
43+
displayName: "Check released files"
4244
- bash: ".azure/scripts/uncommitted-changes.sh"
4345
displayName: "Check for uncommitted files"
4446
# We have to TAR the target directory to maintain the permissions of

.checksums

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/env bash
2+
3+
### IMPORTANT ###
4+
# if the below line has changed, this means the ./helm-charts directory has changed
5+
# the checksum and ./helm-charts directory should only be modified on official releases as part of a release
6+
# if this checksum has changed as part of any non-release specific changes, please apply your changes to the
7+
# development version of the helm charts in ./packaging/helm-charts
8+
### IMPORTANT ###
9+
# TODO: after release un-comment this HELM_CHART_CHECKSUM="50e2ee0738ebfd558fa2e35c189b3abb5e3a5663 -"
10+
11+
### IMPORTANT ###
12+
# if the below line has changed, this means the ./install directory has changed
13+
# the checksum and ./install directory should only be modified on official releases as part of a release
14+
# if this checksum has changed as part of any non-release specific changes, please apply your changes to the
15+
# development version of the helm charts in ./packaging/install
16+
### IMPORTANT ###
17+
INSTALL_CHECKSUM="14107f5b805ba8ccceb44f0845d535b8732c2e6e -"
18+
19+
### IMPORTANT ###
20+
# if the below line has changed, this means the ./examples directory has changed
21+
# the checksum and ./examples directory should only be modified on official releases as part of a release
22+
# if this checksum has changed as part of any non-release specific changes, please apply your changes to the
23+
# development version of the helm charts in ./packaging/examples
24+
### IMPORTANT ###
25+
EXAMPLES_CHECKSUM="5329eddeedb33d52e207946b684862db93ebcd84 -"

Makefile

+11
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,17 @@ next_version:
7777
mvn versions:set -DnewVersion=$(shell echo $(NEXT_VERSION) | tr a-z A-Z)
7878
mvn versions:commit
7979

80+
release_files_check:
81+
./.azure/scripts/release_files_check.sh
82+
83+
checksum_examples:
84+
@$(FIND) ./examples/ -type f -print0 | LC_ALL=C $(SORT) -z | $(XARGS) -0 $(SHA1SUM) | $(SHA1SUM)
85+
86+
checksum_install:
87+
@$(FIND) ./install/ -type f -print0 | LC_ALL=C $(SORT) -z | $(XARGS) -0 $(SHA1SUM) | $(SHA1SUM)
88+
89+
checksum_helm:
90+
@$(FIND) ./helm-charts/ -type f -print0 | LC_ALL=C $(SORT) -z | $(XARGS) -0 $(SHA1SUM) | $(SHA1SUM)
8091

8192
.PHONY: all
8293
all: java_package docker_build docker_push crd_install helm_install

Makefile.os

+6
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,17 @@ FIND = find
22
SED = sed
33
GREP = grep
44
CP = cp
5+
SORT = sort
6+
SHA1SUM = sha1sum
7+
XARGS = xargs
58

69
UNAME_S := $(shell uname -s)
710
ifeq ($(UNAME_S),Darwin)
811
FIND = gfind
912
SED = gsed
1013
GREP = ggrep
1114
CP = gcp
15+
SORT = gsort
16+
SHA1SUM = gsha1sum
17+
XARGS = gxargs
1218
endif

0 commit comments

Comments
 (0)