Skip to content

Commit

Permalink
build-acceptable-bundles: trust old repo url
Browse files Browse the repository at this point in the history
STONEBLD-2339

Even though the repo has moved to github.com/konflux-ci, users can still
resolve tasks from the old url (thanks to GitHub's automatic redirects).

Keep adding the github.com/redhat-appstudio git urls as trusted to avoid
breaking those who may already be using them.

Signed-off-by: Adam Cmiel <[email protected]>
  • Loading branch information
chmeliik committed May 20, 2024
1 parent 32b2e41 commit 0f317a3
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions .tekton/scripts/build-acceptable-bundles.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ set -o pipefail
DATA_BUNDLE_REPO="${DATA_BUNDLE_REPO:-quay.io/redhat-appstudio-tekton-catalog/data-acceptable-bundles}"
mapfile -t BUNDLES < <(cat "$@")

GIT_REPOSITORIES=(
# old repository, resolving tasks from this url still works thanks to GH redirects
git+https://github.com/redhat-appstudio/build-definitions.git
# current repository
# when running in CI, GIT_URL is set to {{repo_url}} from PAC (https://hostname/org/repo)
"git+${GIT_URL:-https://github.com/konflux-ci/build-definitions}.git"
)

# store a list of changed task files
task_records=()
# loop over all changed files
Expand All @@ -18,8 +26,9 @@ for path in $(git log -m -1 --name-only --pretty="format:" "${REVISION}"); do
file_name=$(basename "${path_array[-1]}" ".yaml")

if [[ "${dir_name_after_task}" == "${file_name}" ]]; then
# GIT_URL is the repo_url from PAC (https://hostname/org/repo)
task_records+=("git+${GIT_URL}.git//${path}@${REVISION}")
for git_repository in "${GIT_REPOSITORIES[@]}"; do
task_records+=("${git_repository}//${path}@${REVISION}")
done
fi
fi
done
Expand Down

0 comments on commit 0f317a3

Please sign in to comment.