[bitnami/*] Change pipelines to get to build branch from readme (#191)

* Change pipelines to try to get modified branch from readme file

Signed-off-by: Fran Mulero <fmulero@vmware.com>

* Amend jspath to get README changes

Signed-off-by: Fran Mulero <fmulero@vmware.com>

* Apply suggestions

Signed-off-by: Fran Mulero <fmulero@vmware.com>
This commit is contained in:
Fran Mulero
2022-07-20 19:43:59 +02:00
committed by GitHub
parent 78f99c83e7
commit fc376afd55
2 changed files with 29 additions and 4 deletions

View File

@@ -33,6 +33,17 @@ jobs:
files_changed="$(echo $files_changed_data | jq -r '.files[] | .filename')"
# Adding || true to avoid "Process exited with code 1" errors
containers+=($(echo "$files_changed" | xargs dirname | grep -o "bitnami/[^/]*/[^/]*/[^/]*" | sort | uniq || true))
# Changes done in readme files?
readme_object="$(echo $files_changed_data | jq -r '[ .files[] | select(.filename | test("bitnami/[^/]+/README.md"))] | first')"
if [[ "${readme_object}" != "null" ]]; then
# Look for modified branch in Readme content
container_name="$(echo ${readme_object} | jq -r '.filename' | sed -nr "s|bitnami/([^/]+)/README.md|\1|p")"
branch="$(echo ${readme_object} | jq -r '.patch' | grep -o "([^/]*/[^/]*/Dockerfile)" | sort -u | sed -nr "s|\((.+)/Dockerfile\)|\1|p")"
if [[ ! -z "${branch}" ]] && [[ ! -z "${container_name}" ]]; then
# readme file changed and the diff contains a change about the latest version generated by EAM
containers+=("bitnami/${container_name}/${branch}")
fi
fi
done
if [[ "${#containers[@]}" -le "0" ]]; then