From 3d61a3ee044066be76df306d99940861858775e0 Mon Sep 17 00:00:00 2001 From: Mykola Morhun Date: Mon, 14 Oct 2024 12:41:31 +0300 Subject: [PATCH] Always name attached file Dockerfile in push-dockerfile task --- task/push-dockerfile-oci-ta/0.1/push-dockerfile-oci-ta.yaml | 6 ++++-- task/push-dockerfile/0.1/push-dockerfile.yaml | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/task/push-dockerfile-oci-ta/0.1/push-dockerfile-oci-ta.yaml b/task/push-dockerfile-oci-ta/0.1/push-dockerfile-oci-ta.yaml index c3e93b8e46..65b4d0d057 100644 --- a/task/push-dockerfile-oci-ta/0.1/push-dockerfile-oci-ta.yaml +++ b/task/push-dockerfile-oci-ta/0.1/push-dockerfile-oci-ta.yaml @@ -104,10 +104,12 @@ spec: dockerfile_image=${IMAGE%:*}:${IMAGE_DIGEST/:/-}${TAG_SUFFIX} - cd "$(dirname $dockerfile_path)" + dockerfile_for_upload_path=/tmp/Dockerfile + cp "$dockerfile_path" "$dockerfile_for_upload_path" + cd "$(dirname $dockerfile_for_upload_path)" retry oras push --no-tty \ --format json \ --registry-config "$auth_json" \ --artifact-type "$ARTIFACT_TYPE" \ - "$dockerfile_image" "$(basename $dockerfile_path)" | + "$dockerfile_image" "$(basename $dockerfile_for_upload_path)" | yq '.reference' | tr -d '\r\n' >"$IMAGE_REF_RESULT" diff --git a/task/push-dockerfile/0.1/push-dockerfile.yaml b/task/push-dockerfile/0.1/push-dockerfile.yaml index 74728f0781..eafc3c0198 100644 --- a/task/push-dockerfile/0.1/push-dockerfile.yaml +++ b/task/push-dockerfile/0.1/push-dockerfile.yaml @@ -85,12 +85,14 @@ spec: dockerfile_image=${IMAGE%:*}:${IMAGE_DIGEST/:/-}${TAG_SUFFIX} - cd "$(dirname $dockerfile_path)" + dockerfile_for_upload_path=/tmp/Dockerfile + cp "$dockerfile_path" "$dockerfile_for_upload_path" + cd "$(dirname $dockerfile_for_upload_path)" retry oras push --no-tty \ --format json \ --registry-config "$auth_json" \ --artifact-type "$ARTIFACT_TYPE" \ - "$dockerfile_image" "$(basename $dockerfile_path)" \ + "$dockerfile_image" "$(basename $dockerfile_for_upload_path)" \ | yq '.reference' | tr -d '\r\n' >"$IMAGE_REF_RESULT" workspaces: