forked from openshift/release
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvalidate-ci-operator-config.sh
executable file
·40 lines (28 loc) · 1.12 KB
/
validate-ci-operator-config.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/bash
# This script ensures that the CI Operator configuration checked into git is up-to-date
# with the generator. If it is not, re-generate the configuration to update it.
set -o errexit
set -o nounset
set -o pipefail
workdir="$( mktemp -d )"
trap 'rm -rf "${workdir}"' EXIT
base_dir="${1:-}"
if [[ ! -d "${base_dir}" ]]; then
echo "Expected a single argument: a path to a directory with release repo layout"
exit 1
fi
ci_operator_dir="${base_dir}/ci-operator"
cp -r "${ci_operator_dir}" "${workdir}"
determinize-ci-operator --config-dir "${ci_operator_dir}/config" --confirm
if ! diff -Naupr "${ci_operator_dir}/config/" "${workdir}/ci-operator/config/"> "${workdir}/diff"; then
cat << EOF
ERROR: This check enforces that CI Operator configuration YAML files are generated
ERROR: correctly. We have automation in place that updates these configs and
ERROR: new changes to these configurations should be followed with a re-generation.
ERROR: Run the following command to re-generate the CI Operator configurations:
ERROR: $ make ci-operator-config
ERROR: The following errors were found:
EOF
cat "${workdir}/diff"
exit 1
fi