diff --git a/.tekton/push.yaml b/.tekton/push.yaml index 47c28d481e..77546c73dd 100644 --- a/.tekton/push.yaml +++ b/.tekton/push.yaml @@ -169,28 +169,6 @@ spec: - $(workspaces.source.path)/pipeline-bundle-list-konflux-ci - $(workspaces.source.path)/task-bundle-list-appstudio - $(workspaces.source.path)/pipeline-bundle-list-appstudio - - name: copy-acceptable-bundle-to-appstudio - image: quay.io/konflux-ci/appstudio-utils:{{ revision }} - workingDir: $(workspaces.source.path)/source - script: | - #!/bin/bash - set -euo pipefail - - DATA_BUNDLE_REPO=quay.io/konflux-ci/tekton-catalog/data-acceptable-bundles - DATA_BUNDLE_TAG=$(/dev/null 2>&1 && pwd )" cd "$SCRIPTDIR/../.." CATALOG_NAMESPACES=( - redhat-appstudio-tekton-catalog konflux-ci/tekton-catalog ) diff --git a/hack/build-and-push.sh b/hack/build-and-push.sh index 26964a4836..d4c91bf50c 100755 --- a/hack/build-and-push.sh +++ b/hack/build-and-push.sh @@ -14,6 +14,24 @@ function is_official_repo() { grep -Eq '^(quay\.io/)?(redhat-appstudio-tekton-catalog|konflux-ci/tekton-catalog)(/.*)?$' <<< "$1" } +function should_skip_repo() { + local -r quay_namespace="$1" + local -r repo_name="$2" + + # only skip repos in the redhat-appstudio-tekton-catalog namespace + if [ "$quay_namespace" != redhat-appstudio-tekton-catalog ]; then + return 1 + fi + + local http_code + http_code=$( + curl -I -s -L -w "%{http_code}\n" -o /dev/null "https://quay.io/v2/${quay_namespace}/${repo_name}/tags/list" + ) + + # and only skip them if they don't already exist + [ "$http_code" != "200" ] +} + # local dev build script SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" WORKDIR=$(mktemp -d --suffix "-$(basename "${BASH_SOURCE[0]}" .sh)") @@ -126,6 +144,11 @@ cd "$SCRIPTDIR/.." find task/*/*/ -maxdepth 0 -type d | awk -F '/' '{ print $0, $2, $3 }' | \ while read -r task_dir task_name task_version do + if should_skip_repo "$QUAY_NAMESPACE" "task-$task_name"; then + echo "NOTE: not pushing task-$task_name:$task_version to $QUAY_NAMESPACE; the repo does not exist and $QUAY_NAMESPACE is deprecated" + continue + fi + prepared_task_file="${WORKDIR}/$task_name-${task_version}.yaml" if [ -f "$task_dir/$task_name.yaml" ]; then cp "$task_dir/$task_name.yaml" "$prepared_task_file" @@ -201,6 +224,11 @@ if [ -n "$ENABLE_SOURCE_BUILD" ]; then done fi +if [ "$QUAY_NAMESPACE" == redhat-appstudio-tekton-catalog ]; then + echo "NOTE: not pushing any pipelines to $QUAY_NAMESPACE; the namespace is deprecated" + exit 0 +fi + # Build Pipeline bundle with pipelines pointing to newly built task bundles for pipeline_yaml in "$generated_pipelines_dir"/*.yaml "$core_services_pipelines_dir"/*.yaml do