Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't push unnecessary things to redhat-appstudio-tekton-catalog #1459

Merged
merged 4 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 0 additions & 22 deletions .tekton/push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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=$(<acceptable_bundle_tag)
DATA_BUNDLE_RH_APPSTUDIO=quay.io/redhat-appstudio-tekton-catalog/data-acceptable-bundles

skopeo copy \
"docker://$DATA_BUNDLE_REPO:$DATA_BUNDLE_TAG" \
"docker://$DATA_BUNDLE_RH_APPSTUDIO:$DATA_BUNDLE_TAG"

skopeo copy \
"docker://$DATA_BUNDLE_REPO:$DATA_BUNDLE_TAG" \
"docker://$DATA_BUNDLE_RH_APPSTUDIO:latest"
volumeMounts:
- mountPath: /root/.docker/config.json
subPath: .dockerconfigjson
name: quay-secret
volumes:
- name: quay-secret
secret:
Expand Down
1 change: 0 additions & 1 deletion .tekton/scripts/check-task-pipeline-bundle-repos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
cd "$SCRIPTDIR/../.."

CATALOG_NAMESPACES=(
redhat-appstudio-tekton-catalog
konflux-ci/tekton-catalog
)

Expand Down
28 changes: 28 additions & 0 deletions hack/build-and-push.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)")
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down
Loading