Skip to content

Commit

Permalink
fix: current texts
Browse files Browse the repository at this point in the history
Signed-off-by: Leandro Mendes <[email protected]>
  • Loading branch information
theflockers committed Feb 14, 2025
1 parent c54c810 commit 5ac4608
Show file tree
Hide file tree
Showing 14 changed files with 420 additions and 90 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,9 @@ spec:
process_component() { # Expected argument is [component json]
set -x
COMPONENT=$1
PULLSPEC=$(jq -er '.containerImage' <<< "${COMPONENT}")
PULLSPEC=$(jq -er '.containerImage' <<< "${COMPONENT}") \
|| (echo "Missing containerImage for component." && exit 1 )
DESTINATION="${DISK_IMAGE_DIR}/$(jq -er '.staged.destination' <<< "${COMPONENT}")/FILES" \
|| (echo "Missing staged.destination value for component. This should be an existing pulp repo. \
Failing" && exit 1)
Expand All @@ -182,8 +184,10 @@ spec:
NUM_MAPPED_FILES=$(jq '.staged.files | length' <<< "${COMPONENT}")
for ((i = 0; i < NUM_MAPPED_FILES; i++)) ; do
FILE=$(jq -c --arg i "$i" '.staged.files[$i|tonumber]' <<< "$COMPONENT")
SOURCE=$(jq -er '.source' <<< "$FILE")
FILENAME=$(jq -er '.filename' <<< "$FILE")
SOURCE=$(jq -er '.source' <<< "$FILE") \
|| (echo "Missing staged.files.source for component." && exit 1 )
FILENAME=$(jq -er '.filename' <<< "$FILE") \
|| (echo "Missing staged.files.filename for component." && exit 1 )
# The .qcow2 images are not zipped
if [ -f "${SOURCE}.gz" ] ; then
gzip -d "${SOURCE}.gz"
Expand Down Expand Up @@ -212,7 +216,7 @@ spec:
while (( ${RUNNING_JOBS@P} >= $(params.concurrentLimit) )); do
wait -n
done
process_component "$COMPONENT" 2> "$STDERR_FILE" &
process_component "$COMPONENT" > "$STDERR_FILE" &
done
# Wait for remaining processes to finish
Expand Down Expand Up @@ -720,7 +724,6 @@ spec:
# get all of the signed binaries into a common directory
CONTENT_DIR=/shared/artifacts
find $CONTENT_DIR
SIGNED_DIR="$CONTENT_DIR/signed"
mkdir -p "$SIGNED_DIR"
mkdir -p "$CONTENT_DIR"/linux
Expand Down Expand Up @@ -853,10 +856,9 @@ spec:
if [ "$err" -eq 0 ] ; then
echo -n "Success" > "$(results.result.path)"
else
echo "$0: ERROR '$command' failed at line $line - exited with status $err" \
> "$(results.result.path)"
echo "$0: ERROR '$command' failed at line $line - exited with status $err" > "$(results.result.path)"
if [ -f "$STDERR_FILE" ] ; then
tail -n 20 "$STDERR_FILE" >> "$(results.result.path)"
tail -n 20 "$STDERR_FILE" | tee -a "$(results.result.path)"
fi
fi
exit 0 # exit the script cleanly as there is no point in proceeding past an error or exit call
Expand Down Expand Up @@ -899,22 +901,21 @@ spec:
return
fi
# using { ;} to avoid subshell
productName="$(jq -er '.productName' <<< "${contentGatewayConfig}")" \
|| { echo "Missing contentGateway.productName value for component. This should be an existing product \
in the Developer Portal. Failing" && exit 1; }
|| ( echo "Missing contentGateway.productName value for component. This should be an existing product" \
"in the Developer Portal. Failing" && exit 1 )
productCode="$(jq -er '.productCode' <<< "${contentGatewayConfig}")" \
|| { echo "Missing contentGateway.productCode value for component. This should be an existing product \
in the Developer Portal. Failing" && exit 1; }
|| ( echo "Missing contentGateway.productCode value for component. This should be an existing product" \
"in the Developer Portal. Failing" && exit 1 )
productVersionName="$(jq -er '.productVersionName' <<< "${contentGatewayConfig}")" \
|| { echo "Missing contentGateway.productVersionName value for component. This should be an existing \
product in the Developer Portal. Failing" && exit 1; }
|| ( echo "Missing contentGateway.productVersionName value for component. This should be an existing" \
"product in the Developer Portal. Failing" && exit 1 )
filePrefix="$(jq -er '.filePrefix' <<< "${contentGatewayConfig}")" \
|| { echo "Missing contentGateway.filePrefix value for component. This should be the prefix for files to \
upload to the Developer Portal. Failing" && exit 1; }
|| ( echo "Missing contentGateway.filePrefix value for component. This should be the prefix for files to" \
"upload to the Developer Portal. Failing" && exit 1 )
developer_portal_wrapper --debug --product-name "${productName}" \
--product-code "${productCode}" \
Expand Down Expand Up @@ -966,5 +967,6 @@ spec:
NUM_COMPONENTS=$(jq '.components | length' <<< "$SNAPSHOT_JSON")
for ((i = 0; i < NUM_COMPONENTS; i++)) ; do
COMPONENT=$(jq -c --arg i "$i" '.components[$i|tonumber]' <<< "$SNAPSHOT_JSON")
process_component_for_developer_portal "$COMPONENT" "${component_destinations[$i]}" 2> "$STDERR_FILE"
# eventually the function does not redirect the error to stderr, so looking for all output
process_component_for_developer_portal "$COMPONENT" "${component_destinations[$i]}" @> "$STDERR_FILE"
done
6 changes: 3 additions & 3 deletions tasks/internal/push-artifacts-to-cdn-task/tests/mocks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ function oras() {
elif [[ "$*" =~ push.* ]]; then
echo Simulating oras push
echo "Digest: sha256:$(echo | sha256sum |awk '{ print $1}')"
elif [[ "$*" == *"nonexistent-disk-image"* ]]; then
echo Simulating failing oras pull call
exit 1
elif [[ "$*" == "pull --registry-config"* ]]; then
echo "Mocking pulling files"
touch binary-windows-amd64.zip
Expand All @@ -26,9 +29,6 @@ function oras() {
touch windows/binary-windows-amd64.exe
touch linux/binary-linux-amd64
touch macos/binary-darwin-amd64
elif [[ "$*" == *"nonexistent-disk-image"* ]]; then
echo Simulating failing oras pull call
exit 1
fi
touch fail_gzip.raw.gz
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,38 @@ spec:
params:
- name: snapshot_json
value: >-
{"application":"amd-bootc-1-3-qcow2-disk-image","artifacts":{},"components":[{
"containerImage":"quay.io/org/tenant/qcow-disk-image/qcow2-disk-image@sha256:abcdef12345",
"contentGateway":{"filePrefix":"amd-1.3","productName":"Disk Image for Linux",
"productVersionName":"1.3-staging"},"staged":{"destination":"x86_64-isos","files":[{
"filename":"amd-1.3-x86_64-kvm.qcow2","source":"disk.qcow2"},{"filename":"amd-1.3-x86_64-kvm.raw",
"source":"disk.raw"}],"version":"1.3"}}]}
{
"application": "amd-bootc-1-3-qcow2-disk-image",
"artifacts": {},
"components": [
{
"containerImage": "quay.io/org/tenant/qcow-disk-image/qcow2-disk-image@sha256:abcdef12345",
"contentGateway": {
"filePrefix": "amd-1.3",
"productName": "MyName",
"productVersionName": "1.3-staging"
},
"staged": {
"destination": "test-product-amd64",
"files": [
{
"filename": "binary-windows-amd64.zip",
"source": "binary-windows-amd64.zip"
},
{
"filename": "binary-darwin-amd64.tar.gz",
"source": "binary-darwin-amd64.tar.gz"
},
{
"filename": "binary-linux-amd64.tar.gz",
"source": "binary-linux-amd64.tar.gz"
}
],
"version": "1.3"
}
}
]
}
- name: exodusGwSecret
value: "pulp-task-exodus-secret"
- name: exodusGwEnv
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,39 @@ spec:
params:
- name: snapshot_json
value: >-
{"application":"amd-bootc-1-3-qcow2-disk-image","artifacts":{},"components":[{
"containerImage":"quay.io/org/tenant/qcow-disk-image/qcow2-disk-image@sha256:abcdef12345",
"contentGateway":{"filePrefix":"amd-1.3","productCode":"DISK",
"productVersionName":"1.3-staging"},"staged":{"destination":"x86_64-isos","files":[{
"filename":"amd-1.3-x86_64-kvm.qcow2","source":"disk.qcow2"},{"filename":"amd-1.3-x86_64-kvm.raw",
"source":"disk.raw"}],"version":"1.3"}}]}
{
"application": "amd-bootc-1-3-qcow2-disk-image",
"artifacts": {},
"components": [
{
"containerImage": "quay.io/org/tenant/qcow-disk-image/qcow2-disk-image@sha256:abcdef12345",
"contentGateway": {
"filePrefix": "amd-1.3",
"productCode": "Code",
"productVersionName": "1.3-staging"
},
"staged": {
"destination": "test-product-amd64",
"files": [
{
"filename": "binary-windows-amd64.zip",
"source": "binary-windows-amd64.zip"
},
{
"filename": "binary-darwin-amd64.tar.gz",
"source": "binary-darwin-amd64.tar.gz"
},
{
"filename": "binary-linux-amd64.tar.gz",
"source": "binary-linux-amd64.tar.gz"
}
],
"version": "1.3"
}
}
]
}
- name: exodusGwSecret
value: "pulp-task-exodus-secret"
- name: exodusGwEnv
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,38 @@ spec:
params:
- name: snapshot_json
value: >-
{"application":"amd-bootc-1-3-qcow2-disk-image","artifacts":{},"components":[{
"containerImage":"quay.io/org/tenant/qcow-disk-image/qcow2-disk-image@sha256:abcdef12345",
"contentGateway":{"filePrefix":"amd-1.3","productCode":"DISK","productName":"Disk Image for Linux"},
"staged":{"destination":"x86_64-isos","files":[{
"filename":"amd-1.3-x86_64-kvm.qcow2","source":"disk.qcow2"},{"filename":"amd-1.3-x86_64-kvm.raw",
"source":"disk.raw"}],"version":"1.3"}}]}
{
"application": "amd-bootc-1-3-qcow2-disk-image",
"artifacts": {},
"components": [
{
"containerImage": "quay.io/org/tenant/qcow-disk-image/qcow2-disk-image@sha256:abcdef12345",
"contentGateway": {
"filePrefix": "amd-1.3",
"productCode": "Code",
"productName": "Name"
},
"staged": {
"destination": "test-product-amd64",
"files": [
{
"filename": "binary-windows-amd64.zip",
"source": "binary-windows-amd64.zip"
},
{
"filename": "binary-darwin-amd64.tar.gz",
"source": "binary-darwin-amd64.tar.gz"
},
{
"filename": "binary-linux-amd64.tar.gz",
"source": "binary-linux-amd64.tar.gz"
}
],
"version": "1.3"
}
}
]
}
- name: exodusGwSecret
value: "pulp-task-exodus-secret"
- name: exodusGwEnv
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,38 @@ spec:
params:
- name: snapshot_json
value: >-
{"application":"amd-bootc-1-3-qcow2-disk-image","artifacts":{},"components":[{
"contentGateway":{"filePrefix":"amd-1.3","productCode":"DISK","productName":"Disk Image for Linux",
"productVersionName":"1.3-staging"},"staged":{"destination":"x86_64-isos","files":[{
"filename":"amd-1.3-x86_64-kvm.qcow2","source":"disk.qcow2"},{"filename":"amd-1.3-x86_64-kvm.raw",
"source":"disk.raw"}],"version":"1.3"}}]}
{
"application": "amd-bootc-1-3-qcow2-disk-image",
"artifacts": {},
"components": [
{
"contentGateway": {
"filePrefix": "amd-1.3",
"productCode": "Code",
"productName": "MyName",
"productVersionName": "1.3-staging"
},
"staged": {
"destination": "test-product-amd64",
"files": [
{
"filename": "binary-windows-amd64.zip",
"source": "binary-windows-amd64.zip"
},
{
"filename": "binary-darwin-amd64.tar.gz",
"source": "binary-darwin-amd64.tar.gz"
},
{
"filename": "binary-linux-amd64.tar.gz",
"source": "binary-linux-amd64.tar.gz"
}
],
"version": "1.3"
}
}
]
}
- name: exodusGwSecret
value: "pulp-task-exodus-secret"
- name: exodusGwEnv
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,35 @@ spec:
params:
- name: snapshot_json
value: >-
{"application":"amd-bootc-1-3-qcow2-disk-image","artifacts":{},"components":[{
"containerImage":"quay.io/org/tenant/qcow-disk-image/qcow2-disk-image@sha256:abcdef12345",
"contentGateway":{"filePrefix":"amd-1.3","productCode":"DISK","productName":"Disk Image for Linux",
"productVersionName":"1.3-staging"},"staged":{"destination":"x86_64-isos","files":[{
"source":"disk.qcow2"},{"filename":"amd-1.3-x86_64-kvm.raw",
"source":"disk.raw"}],"version":"1.3"}}]}
{
"application": "amd-bootc-1-3-qcow2-disk-image",
"artifacts": {},
"components": [
{
"containerImage": "quay.io/org/tenant/qcow-disk-image/qcow2-disk-image@sha256:abcdef12345",
"contentGateway": {
"filePrefix": "amd-1.3",
"productCode": "Code",
"productName": "Name",
"productVersionName": "1.3-staging"
},
"staged": {
"destination": "test-product-amd64",
"files": [
{
"source": "binary-windows-amd64.zip"
},
{
"source": "binary-darwin-amd64.tar.gz"
},
{
"source": "binary-linux-amd64.tar.gz"
}
]
}
}
]
}
- name: exodusGwSecret
value: "pulp-task-exodus-secret"
- name: exodusGwEnv
Expand All @@ -32,6 +55,8 @@ spec:
value: "https://content-gateway.com"
- name: cgwSecret
value: "pulp-task-cgw-secret"
- name: author
value: testuser
- name: check-result
runAfter:
- run-task
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,36 @@ spec:
params:
- name: snapshot_json
value: >-
{"application":"amd-bootc-1-3-qcow2-disk-image","artifacts":{},"components":[{
"containerImage":"quay.io/org/tenant/qcow-disk-image/qcow2-disk-image@sha256:abcdef12345",
"contentGateway":{"filePrefix":"amd-1.3","productCode":"DISK","productName":"Disk Image for Linux",
"productVersionName":"1.3-staging"},"staged":{"destination":"x86_64-isos","files":[{
"filename":"amd-1.3-x86_64-kvm.qcow2"},{"filename":"amd-1.3-x86_64-kvm.raw",
"source":"disk.raw"}],"version":"1.3"}}]}
{
"application": "amd-bootc-1-3-qcow2-disk-image",
"artifacts": {},
"components": [
{
"containerImage": "quay.io/org/tenant/qcow-disk-image/qcow2-disk-image@sha256:abcdef12345",
"contentGateway": {
"filePrefix": "amd-1.3",
"productCode": "Code",
"productName": "Name",
"productVersionName": "1.3-staging"
},
"staged": {
"destination": "test-product-amd64",
"files": [
{
"filename": "binary-windows-amd64.zip"
},
{
"filename": "binary-darwin-amd64.tar.gz"
},
{
"filename": "binary-linux-amd64.tar.gz"
}
],
"version": "1.3"
}
}
]
}
- name: exodusGwSecret
value: "pulp-task-exodus-secret"
- name: exodusGwEnv
Expand All @@ -32,6 +56,8 @@ spec:
value: "https://content-gateway.com"
- name: cgwSecret
value: "pulp-task-cgw-secret"
- name: author
value: testuser
- name: check-result
runAfter:
- run-task
Expand Down
Loading

0 comments on commit 5ac4608

Please sign in to comment.