Skip to content

Commit

Permalink
Merge branch 'main' into integration_quay_reorg
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh-Everett authored Dec 10, 2024
2 parents bc45489 + c54c202 commit b7e69e6
Show file tree
Hide file tree
Showing 8 changed files with 68 additions and 44 deletions.
82 changes: 42 additions & 40 deletions hack/build-and-push.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ function should_skip_repo() {

# local dev build script
SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
cd "$SCRIPTDIR/.." || exit 1

WORKDIR=$(mktemp -d --suffix "-$(basename "${BASH_SOURCE[0]}" .sh)")

tkn_bundle_push() {
Expand Down Expand Up @@ -111,14 +113,14 @@ fi

APPSTUDIO_UTILS_IMG="quay.io/$QUAY_NAMESPACE/${TEST_REPO_NAME:-appstudio-utils}:${TEST_REPO_NAME:+appstudio-utils-}$BUILD_TAG"

OUTPUT_TASK_BUNDLE_LIST="${OUTPUT_TASK_BUNDLE_LIST-${SCRIPTDIR}/../task-bundle-list}"
OUTPUT_PIPELINE_BUNDLE_LIST="${OUTPUT_PIPELINE_BUNDLE_LIST-${SCRIPTDIR}/../pipeline-bundle-list}"
OUTPUT_TASK_BUNDLE_LIST="${OUTPUT_TASK_BUNDLE_LIST-task-bundle-list}"
OUTPUT_PIPELINE_BUNDLE_LIST="${OUTPUT_PIPELINE_BUNDLE_LIST-pipeline-bundle-list}"
rm -f "${OUTPUT_TASK_BUNDLE_LIST}" "${OUTPUT_PIPELINE_BUNDLE_LIST}"

# Build appstudio-utils image
if [ "$SKIP_BUILD" == "" ]; then
echo "Using $QUAY_NAMESPACE to push results "
docker build -t "$APPSTUDIO_UTILS_IMG" "$SCRIPTDIR/../appstudio-utils/"
docker build -t "$APPSTUDIO_UTILS_IMG" "appstudio-utils/"
docker push "$APPSTUDIO_UTILS_IMG"

# This isn't needed during PR testing
Expand All @@ -139,8 +141,6 @@ core_services_pipelines_dir=$(mktemp -d -p "$WORKDIR" core-services-pipelines.XX
oc kustomize --output "$core_services_pipelines_dir" pipelines/core-services/

# Build tasks
(
cd "$SCRIPTDIR/.."
find task/*/*/ -maxdepth 0 -type d | awk -F '/' '{ print $0, $2, $3 }' | \
while read -r task_dir task_name task_version
do
Expand All @@ -166,41 +166,41 @@ do
task_description=$(yq e '.spec.description' "$prepared_task_file" | head -n 1)

if digest=$(skopeo inspect --no-tags --format='{{.Digest}}' docker://"${task_bundle}-${task_file_sha}" 2>/dev/null); then
task_bundle_with_digest=${task_bundle}@${digest}
task_bundle_with_digest=${task_bundle}@${digest}
else
ANNOTATIONS=()
ANNOTATIONS+=("org.opencontainers.image.source=${VCS_URL}")
ANNOTATIONS+=("org.opencontainers.image.revision=${VCS_REF}")
ANNOTATIONS+=("org.opencontainers.image.url=${VCS_URL}/tree/${VCS_REF}/${task_dir}")
# Ensure an empty string is set rather than string "null" if the version label is not present
concrete_task_version=$(yq '.metadata.labels."app.kubernetes.io/version"' "$prepared_task_file" | sed '/null/d')
ANNOTATIONS+=("org.opencontainers.image.version=${concrete_task_version}")
# yq will return null if the element is missing.
if [[ "${task_description}" != "null" ]]; then
ANNOTATIONS+=("org.opencontainers.image.description=${task_description}")
fi
if [ -f "${task_dir}/README.md" ]; then
ANNOTATIONS+=("org.opencontainers.image.documentation=${VCS_URL}/tree/${VCS_REF}/${task_dir}README.md")
fi
if [ -f "${task_dir}/TROUBLESHOOTING.md" ]; then
ANNOTATIONS+=("dev.tekton.docs.troubleshooting=${VCS_URL}/tree/${VCS_REF}/${task_dir}TROUBLESHOOTING.md")
fi
if [ -f "${task_dir}/USAGE.md" ]; then
ANNOTATIONS+=("dev.tekton.docs.usage=${VCS_URL}/tree/${VCS_REF}/${task_dir}USAGE.md")
fi

ANNOTATION_FLAGS=()
for annotation in "${ANNOTATIONS[@]}"; do
ANNOTATION_FLAGS+=("--annotate" "$(escape_tkn_bundle_arg "$annotation")")
done

output=$(tkn_bundle_push "${ANNOTATION_FLAGS[@]}" -f "$prepared_task_file" "$task_bundle" | save_ref "$task_bundle" "$OUTPUT_TASK_BUNDLE_LIST")
echo "$output"
task_bundle_with_digest="${output##*$'\n'}"

# copy task to new tag pointing to commit where the file was changed lastly, so that image persists
# even when original tag is updated
skopeo copy "docker://${task_bundle}" "docker://${task_bundle}-${task_file_sha}"
ANNOTATIONS=()
ANNOTATIONS+=("org.opencontainers.image.source=${VCS_URL}")
ANNOTATIONS+=("org.opencontainers.image.revision=${VCS_REF}")
ANNOTATIONS+=("org.opencontainers.image.url=${VCS_URL}/tree/${VCS_REF}/${task_dir}")
# Ensure an empty string is set rather than string "null" if the version label is not present
concrete_task_version=$(yq '.metadata.labels."app.kubernetes.io/version"' "$prepared_task_file" | sed '/null/d')
ANNOTATIONS+=("org.opencontainers.image.version=${concrete_task_version}")
# yq will return null if the element is missing.
if [[ "${task_description}" != "null" ]]; then
ANNOTATIONS+=("org.opencontainers.image.description=${task_description}")
fi
if [ -f "${task_dir}/README.md" ]; then
ANNOTATIONS+=("org.opencontainers.image.documentation=${VCS_URL}/tree/${VCS_REF}/${task_dir}README.md")
fi
if [ -f "${task_dir}/TROUBLESHOOTING.md" ]; then
ANNOTATIONS+=("dev.tekton.docs.troubleshooting=${VCS_URL}/tree/${VCS_REF}/${task_dir}TROUBLESHOOTING.md")
fi
if [ -f "${task_dir}/USAGE.md" ]; then
ANNOTATIONS+=("dev.tekton.docs.usage=${VCS_URL}/tree/${VCS_REF}/${task_dir}USAGE.md")
fi

ANNOTATION_FLAGS=()
for annotation in "${ANNOTATIONS[@]}"; do
ANNOTATION_FLAGS+=("--annotate" "$(escape_tkn_bundle_arg "$annotation")")
done

output=$(tkn_bundle_push "${ANNOTATION_FLAGS[@]}" -f "$prepared_task_file" "$task_bundle" | save_ref "$task_bundle" "$OUTPUT_TASK_BUNDLE_LIST")
echo "$output"
task_bundle_with_digest="${output##*$'\n'}"

# copy task to new tag pointing to commit where the file was changed lastly, so that image persists
# even when original tag is updated
skopeo copy "docker://${task_bundle}" "docker://${task_bundle}-${task_file_sha}"
fi
# version placeholder is removed naturally by the substitution.
real_task_name=$(yq e '.metadata.name' "$prepared_task_file")
Expand All @@ -218,7 +218,6 @@ do
yq e "$sub_expr_2" -i "${filename}"
done
done
)

# Used for build-definitions pull request CI only
if [ -n "$ENABLE_SOURCE_BUILD" ]; then
Expand Down Expand Up @@ -292,3 +291,6 @@ if [ "$SKIP_INSTALL" == "" ]; then
echo "export CUSTOM_DOCKER_BUILD_MULTI_PLATFORM_OCI_TA_PIPELINE_BUNDLE=$docker_multi_platform_oci_ta_pipeline_bundle" >> bundle_values.env
echo "export CUSTOM_FBC_BUILDER_PIPELINE_BUNDLE=$fbc_pipeline_bundle" >> bundle_values.env
fi


# vim: set et sw=4 ts=4:
2 changes: 1 addition & 1 deletion task/generate-odcs-compose/0.1/generate-odcs-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ spec:
description: Directory to write the result .repo files.
steps:
- name: generate-odcs-compose
image: quay.io/redhat-appstudio/tools@sha256:6676c661b5d56faa1b377218c32d2825571a9e275c32f77e521376580f4a2f4a
image: quay.io/redhat-appstudio/tools@sha256:49f776c18b06cd7343103652106336c27d116dd367a7d5a2538aab0f40656d27
env:
- name: CLIENT_ID
valueFrom:
Expand Down
2 changes: 1 addition & 1 deletion task/generate-odcs-compose/0.2/generate-odcs-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ spec:
description: Directory to write the result .repo files.
steps:
- name: generate-odcs-compose
image: quay.io/redhat-appstudio/tools@sha256:6676c661b5d56faa1b377218c32d2825571a9e275c32f77e521376580f4a2f4a
image: quay.io/redhat-appstudio/tools@sha256:49f776c18b06cd7343103652106336c27d116dd367a7d5a2538aab0f40656d27
env:
- name: CLIENT_ID
valueFrom:
Expand Down
7 changes: 7 additions & 0 deletions task/generate-odcs-compose/OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# See the OWNERS docs: https://go.k8s.io/owners

approvers:
- gbenhaim
- avi-biton
- amisstea
- yftacherzog
8 changes: 8 additions & 0 deletions task/provision-env-with-ephemeral-namespace/OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# See the OWNERS docs: https://go.k8s.io/owners

approvers:
- gbenhaim
- oamsalem
- amisstea
- avi-biton
- yftacherzog
2 changes: 1 addition & 1 deletion task/rpms-signature-scan/0.1/rpms-signature-scan.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ spec:
optional: true
steps:
- name: rpms-signature-scan
image: quay.io/redhat-appstudio/tools@sha256:6676c661b5d56faa1b377218c32d2825571a9e275c32f77e521376580f4a2f4a
image: quay.io/redhat-appstudio/tools@sha256:49f776c18b06cd7343103652106336c27d116dd367a7d5a2538aab0f40656d27
volumeMounts:
- name: workdir
mountPath: "$(params.workdir)"
Expand Down
2 changes: 1 addition & 1 deletion task/rpms-signature-scan/0.2/rpms-signature-scan.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ spec:
optional: true
steps:
- name: rpms-signature-scan
image: quay.io/redhat-appstudio/tools@sha256:6676c661b5d56faa1b377218c32d2825571a9e275c32f77e521376580f4a2f4a
image: quay.io/redhat-appstudio/tools@sha256:49f776c18b06cd7343103652106336c27d116dd367a7d5a2538aab0f40656d27
volumeMounts:
- name: workdir
mountPath: "$(params.workdir)"
Expand Down
7 changes: 7 additions & 0 deletions task/rpms-signature-scan/OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# See the OWNERS docs: https://go.k8s.io/owners

approvers:
- gbenhaim
- avi-biton
- amisstea
- yftacherzog

0 comments on commit b7e69e6

Please sign in to comment.