From 81a0881454d378e1bcdbd18bb7993fbe54fadea0 Mon Sep 17 00:00:00 2001 From: Jef Roosens Date: Sat, 22 Jan 2022 19:22:19 +0100 Subject: [PATCH] Switched to cross-platform curl-based solution --- .woodpecker/.build.yml | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/.woodpecker/.build.yml b/.woodpecker/.build.yml index fdfd3da..2a243dd 100644 --- a/.woodpecker/.build.yml +++ b/.woodpecker/.build.yml @@ -36,8 +36,24 @@ pipeline: image: 'alpine:latest' secrets: [ s3_username, s3_password ] commands: - # https://min.io/download#/linux - - wget https://dl.min.io/client/mc/release/linux-amd64/mc - - chmod +x mc - - ./mc alias set s3 https://s3.rustybever.be "$S3_USERNAME" "$S3_PASSWORD" - - ./mc cp pvieter "s3/vieter/commits/$CI_COMMIT_SHA/vieter-$(echo '${PLATFORM}' | sed 's:/:-:')" + # We should just add this to the builder image instead + - apk add curl openssl + + # https://gist.github.com/JustinTimperio/7c7115f87b775618637d67ac911e595f + - export URL=s3.rustybever.be + - export OBJ_PATH="/vieter/commits/$CI_COMMIT_SHA/vieter-$(echo '${PLATFORM}' | sed 's:/:-:')" + - export DATE=`date -R --utc` + - export CONTENT_TYPE='application/zstd' + - export SIG_STRING="PUT\n\n${CONTENT_TYPE}\n${DATE}\n${OBJ_PATH}" + - export SIGNATURE=`echo -en ${SIG_STRING} | openssl sha1 -hmac ${S3_PASSWORD} -binary | base64` + + - > + curl \ + --silent \ + -XPUT \ + -T pvieter \ + -H "Host: $URL" \ + -H "Date: ${DATE}" \ + -H "Content-Type: ${CONTENT_TYPE}" \ + -H "Authorization: AWS ${S3_USERNAME}:${SIGNATURE}" \ + https://$URL${OBJ_PATH}