-
Notifications
You must be signed in to change notification settings - Fork 140
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tag bundles after acceptable bundles list pushed
This change addresses the issue where the acceptable bundles list does not contain new bundle updates. The issue is addressed by tagging new bundles after the acceptable bundle is pushed. This will ensure renovate does not push updates until after the acceptable bundles list has been updated. https://issues.redhat.com/browse/EC-627
- Loading branch information
1 parent
3118a13
commit 6d1fdbb
Showing
5 changed files
with
157 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash | ||
|
||
SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" | ||
# File containing the list of images | ||
OUTPUT_TASK_BUNDLE_LIST="${OUTPUT_TASK_BUNDLE_LIST-${SCRIPTDIR}/../task-bundle-list}" | ||
|
||
# Read the file and process each line | ||
while IFS=, read -r original_image new_image; do | ||
# Remove the quotes from the strings | ||
original_image=$(echo "$original_image" | tr -d '"' | xargs) | ||
new_image=$(echo "$new_image" | tr -d '"' | xargs) | ||
|
||
# Run the skopeo copy command | ||
echo "Copying from $original_image to $new_image" | ||
skopeo copy "docker://$original_image" "docker://$new_image" | ||
|
||
done < "$OUTPUT_TASK_BUNDLE_LIST" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
#!/bin/bash | ||
# this spec file tests creating Tekton bundles and the acceptable bundles list | ||
|
||
set -o errexit | ||
set -o pipefail | ||
set -o nounset | ||
|
||
eval "$(shellspec - -c) exit 1" | ||
|
||
check_tkn_push_url() { | ||
while read -r line; do | ||
if [[ "$line" == quay.io/* ]] && [[ ! "$line" =~ ^quay\.io/[a-zA-Z0-9_-]+/[a-zA-Z0-9_-]+:[0-9a-zA-Z\.-]+@sha256:[a-fA-F0-9]+$ ]]; then | ||
return 1 | ||
fi | ||
done | ||
} | ||
|
||
create_test_tasks() { | ||
mkdir -p tmp/task1/0.1 | ||
mkdir -p tmp/task2/0.1 | ||
touch tmp/task1/0.1/task1.yaml | ||
touch tmp/task2/0.1/task2.yaml | ||
} | ||
|
||
cleanup_test_data() { | ||
rm -rf tmp | ||
rm -f test-task-bundle-list | ||
rm -f test-task-bundle-list.csv | ||
} | ||
|
||
Describe "Creating new acceptable bundles" | ||
AfterAll 'cleanup_test_data' | ||
|
||
Mock skopeo | ||
# Make the skopeo inspect command fail | ||
if [ "$1" = "inspect" ]; then | ||
return 1 | ||
fi | ||
End | ||
|
||
Mock tkn | ||
echo "${5}@sha256:5678" | ||
End | ||
|
||
Mock sha256sum | ||
echo "1234" | ||
End | ||
|
||
Mock ec | ||
End | ||
|
||
Mock find | ||
echo "tmp/task1/0.1/\ntmp/task2/0.1/" | ||
End | ||
|
||
It "builds bundles with the correct sha as the tag" | ||
create_test_tasks | ||
Mock git | ||
echo "1234" | ||
End | ||
export OUTPUT_TASK_BUNDLE_LIST=test-task-bundle-list | ||
export QUAY_NAMESPACE=konflux-ci | ||
export SKIP_BUILD=true | ||
|
||
When call "hack/build-and-push.sh" | ||
The status should be success | ||
# each task and pipeline bundle ends with file checksum @ digest | ||
The output should satisfy check_tkn_push_url | ||
End | ||
|
||
It 'processes the bundles and generates the correct output file' | ||
# this is only used for the task_records var which is unused in this test | ||
Mock git | ||
echo "task/task1/task1.yaml\ntask/task2/task2.yaml" | ||
End | ||
|
||
export OUTPUT_TASK_BUNDLE_LIST="test-task-bundle-list.csv" | ||
export GIT_URL="https://my-url/org/repo" | ||
export REVISION="abcd1234" | ||
export DATA_BUNDLE_REPO="quay.io/konflux-ci/tekton-catalog/data-acceptable-bundles" | ||
|
||
When call hack/build-acceptable-bundles.sh "test-task-bundle-list" | ||
The status should be success | ||
The path test-task-bundle-list.csv should be file | ||
The contents of file "test-task-bundle-list.csv" should equal "quay.io/konflux-ci/task-task1:0.1-1234@sha256:5678,quay.io/konflux-ci/task-task1:0.1 | ||
quay.io/konflux-ci/task-task2:0.1-1234@sha256:5678,quay.io/konflux-ci/task-task2:0.1" | ||
The stdout should include "Bundles to be added:" | ||
The stdout should include "quay.io/konflux-ci/task-task1:0.1" | ||
The stdout should include "quay.io/konflux-ci/task-task2:0.1" | ||
End | ||
|
||
It "copies to the right image locations" | ||
export OUTPUT_TASK_BUNDLE_LIST="test-task-bundle-list.csv" | ||
When call "hack/push-and-tag.sh" | ||
The status should be success | ||
The output should include "Copying from quay.io/konflux-ci/task-task1:0.1-1234@sha256:5678 to quay.io/konflux-ci/task-task1:0.1" | ||
The output should include "Copying from quay.io/konflux-ci/task-task2:0.1-1234@sha256:5678 to quay.io/konflux-ci/task-task2:0.1" | ||
End | ||
End |