-
Notifications
You must be signed in to change notification settings - Fork 149
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
44 changed files
with
13,874 additions
and
1,428 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
name: Validate PR - kustomize manifests | ||
'on': | ||
pull_request: | ||
branches: [main] | ||
jobs: | ||
kustomize-build: | ||
name: Check Kustomize Build of Task and Pipelines | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v4 | ||
- name: Validate Manifests | ||
run: hack/verify-manifests.sh |
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 |
---|---|---|
@@ -0,0 +1,66 @@ | ||
#!/bin/bash -e | ||
|
||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" | ||
|
||
# You can ignore building manifests for some tasks by providing the SKIP_TASKS variable | ||
# with the task name separated by a space, for example: | ||
# SKIP_TASKS="git-clone init" | ||
|
||
SKIP_TASKS="generate-odcs-compose provision-env-with-ephemeral-namespace verify-signed-rpms" | ||
|
||
# You can ignore building manifests for some pipelines by providing the SKIP_PIPELINES variable | ||
# with the task name separated by a space, for example: | ||
# SKIP_PIPELINES="rhtap gitops-pull-request-rhtap" | ||
|
||
SKIP_PIPELINES="gitops-pull-request-rhtap" | ||
|
||
main() { | ||
local kustomize=${1:-kustomize} | ||
local dirs | ||
|
||
cd "$SCRIPT_DIR/.." | ||
task_dirs=$(find task -maxdepth 4 \( -name 'kustomization.yaml' -o -name 'kustomization.yml' \) -exec dirname {} \;) | ||
pipeline_dirs=$(find pipelines -mindepth 2 \( -name 'kustomization.yaml' -o -name 'kustomization.yml' \) -exec dirname {} \;) | ||
local ret=0 | ||
|
||
for task_dir in ${task_dirs}; do | ||
echo "Building task directory: ${task_dir}" | ||
task_name=$(echo $task_dir | awk -F '/' '{print $2}') | ||
# Skip the tasks mentioned in SKIP_TASKS | ||
skipit= | ||
for tname in ${SKIP_TASKS};do | ||
[[ ${tname} == "${task_name}" ]] && skipit=True | ||
done | ||
[[ -n ${skipit} ]] && continue | ||
if ! "$kustomize" build -o "$task_dir/$task_name.yaml" "$task_dir"; then | ||
echo "failed to build task: $task_dir" >&2 | ||
ret=1 | ||
fi | ||
done | ||
|
||
for pipeline_dir in ${pipeline_dirs}; do | ||
echo "Building pipeline directory: ${pipeline_dir}" | ||
pipeline_name=$(echo $pipeline_dir | awk -F '/' '{print $2}') | ||
# Skip the pipelines mentioned in SKIP_PIPELINES | ||
skipit= | ||
for pname in ${SKIP_PIPELINES};do | ||
[[ ${pname} == "${pipeline_name}" ]] && skipit=True | ||
done | ||
[[ -n ${skipit} ]] && continue | ||
|
||
if ! "$kustomize" build -o "$pipeline_dir/$pipeline_name.yaml" "$pipeline_dir"; then | ||
echo "failed to build pipeline: $pipeline_dir" >&2 | ||
ret=1 | ||
fi | ||
done | ||
|
||
exit "$ret" | ||
|
||
} | ||
|
||
if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then | ||
main "$@" | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/bin/bash -e | ||
|
||
main() { | ||
local target_dir=${1:?target dir for storing kustomize should be specified} | ||
|
||
mkdir -p "$target_dir" | ||
if [[ -f "${target_dir}/kustomize" ]]; then | ||
exit 0 | ||
fi | ||
|
||
curl -L https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize%2Fv5.3.0/kustomize_v5.3.0_linux_amd64.tar.gz | tar -C "$target_dir" -xvzf - | ||
|
||
ls -l "$target_dir" | ||
echo "PATH -> $PATH" | ||
} | ||
|
||
|
||
if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then | ||
main "$@" | ||
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
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/bash -e | ||
|
||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" | ||
|
||
main() { | ||
local kustomize=${1:-kustomize} | ||
|
||
"${SCRIPT_DIR}"/build-manifests.sh "$kustomize" | ||
if [[ $(git status --porcelain) ]]; then | ||
git diff --exit-code >&2 || { | ||
echo "Did you forget to build the manifests locally?" >&2; | ||
echo "Please run ./hack/build-manifests.sh and update your PR" >&2; | ||
exit 1; | ||
} | ||
fi | ||
echo "changes are up to date" >&2 | ||
} | ||
|
||
if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then | ||
main "$@" | ||
fi |
Oops, something went wrong.