From 0700eb16fbfe1e58e1d87d6120581fab2c8e32db Mon Sep 17 00:00:00 2001 From: Jef Roosens Date: Sat, 22 Jan 2022 19:01:46 +0100 Subject: [PATCH 01/16] Added static binary upload --- .woodpecker/.build.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.woodpecker/.build.yml b/.woodpecker/.build.yml index 4b87f8b..fdfd3da 100644 --- a/.woodpecker/.build.yml +++ b/.woodpecker/.build.yml @@ -28,3 +28,16 @@ pipeline: - readelf -d pvieter - du -h pvieter - '[ "$(readelf -d pvieter | grep NEEDED | wc -l)" = 0 ]' + # This removes so much, it's amazing + - strip -s pvieter + - du -h pvieter + + upload: + 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:/:-:')" From 81a0881454d378e1bcdbd18bb7993fbe54fadea0 Mon Sep 17 00:00:00 2001 From: Jef Roosens Date: Sat, 22 Jan 2022 19:22:19 +0100 Subject: [PATCH 02/16] 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} From 32fc1317b052228d8c88680c19a162f3b30b599b Mon Sep 17 00:00:00 2001 From: Jef Roosens Date: Sat, 22 Jan 2022 19:26:52 +0100 Subject: [PATCH 03/16] Squashing some bugs --- .woodpecker/.build.yml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.woodpecker/.build.yml b/.woodpecker/.build.yml index 2a243dd..15dbdb2 100644 --- a/.woodpecker/.build.yml +++ b/.woodpecker/.build.yml @@ -42,18 +42,18 @@ pipeline: # 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 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` + - 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} + 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 From 2ce92e237d679570dae6c3d9646754cd5559773f Mon Sep 17 00:00:00 2001 From: Jef Roosens Date: Sat, 22 Jan 2022 19:29:01 +0100 Subject: [PATCH 04/16] CI? --- .woodpecker/.build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.woodpecker/.build.yml b/.woodpecker/.build.yml index 15dbdb2..1b6e83f 100644 --- a/.woodpecker/.build.yml +++ b/.woodpecker/.build.yml @@ -24,7 +24,7 @@ pipeline: group: 'build' commands: - make prod - # Make sure the binary is actually static + # Make sure the binary is actually statically built - readelf -d pvieter - du -h pvieter - '[ "$(readelf -d pvieter | grep NEEDED | wc -l)" = 0 ]' From df648ba129762b1754e0c808c07d84df89b50520 Mon Sep 17 00:00:00 2001 From: Jef Roosens Date: Sat, 22 Jan 2022 19:30:46 +0100 Subject: [PATCH 05/16] Stewie just said that! --- .woodpecker/.build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.woodpecker/.build.yml b/.woodpecker/.build.yml index 1b6e83f..6803f01 100644 --- a/.woodpecker/.build.yml +++ b/.woodpecker/.build.yml @@ -42,7 +42,7 @@ pipeline: # 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 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` From da57da8ceed554c7712d188fa882f82297601481 Mon Sep 17 00:00:00 2001 From: Jef Roosens Date: Sat, 22 Jan 2022 19:36:42 +0100 Subject: [PATCH 06/16] Of course I forgot the g --- .woodpecker/.build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.woodpecker/.build.yml b/.woodpecker/.build.yml index 6803f01..f3ae8b6 100644 --- a/.woodpecker/.build.yml +++ b/.woodpecker/.build.yml @@ -41,7 +41,7 @@ pipeline: # 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 OBJ_PATH="/vieter/commits/$CI_COMMIT_SHA/vieter-$(echo '${PLATFORM}' | sed 's:/:-:g')" - export DATE="$(date -R --utc)" - export CONTENT_TYPE='application/zstd' - export SIG_STRING="PUT\n\n$CONTENT_TYPE\n$DATE\n$OBJ_PATH" From a810d5b3b0e3416fe9d60b39cf580426662f7017 Mon Sep 17 00:00:00 2001 From: Jef Roosens Date: Sat, 22 Jan 2022 21:26:25 +0100 Subject: [PATCH 07/16] Added gitea release section to ci --- .woodpecker/.build.yml | 2 -- .woodpecker/.release.yml | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 .woodpecker/.release.yml diff --git a/.woodpecker/.build.yml b/.woodpecker/.build.yml index f3ae8b6..ecf1d73 100644 --- a/.woodpecker/.build.yml +++ b/.woodpecker/.build.yml @@ -5,8 +5,6 @@ matrix: - linux/arm/v7 # These checks already get performed on the feature branches -branches: - exclude: [ main, dev ] platform: ${PLATFORM} pipeline: diff --git a/.woodpecker/.release.yml b/.woodpecker/.release.yml new file mode 100644 index 0000000..622b6e4 --- /dev/null +++ b/.woodpecker/.release.yml @@ -0,0 +1,33 @@ +platform: linux/amd64 + +pipeline: + prepare: + image: 'chewingbever/vlang:latest' + secrets: [ s3_username, s3_password ] + commands: + # Write the title to a file that the plugin can then read + - echo "$(git describe --tags --abbrev=0 2> /dev/null || echo '0.0.0')-$(git rev-list --count ^dev)" > title + - cat title + - 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 "s3/vieter/commits/$CI" assets + + release: + image: 'plugins/gitea-release' + secrets: + - gitea_release_api_key + settings: + base_url: https://git.rustybever.be + files: assets/* + checksums: + - md5 + - sha256 + prerelease: true + # This should get read in as a file + title: title + when: + event: push + +depends_on: + - build From 3d07213a917bf53455eaac6be90cd4f595869c4d Mon Sep 17 00:00:00 2001 From: Jef Roosens Date: Sat, 22 Jan 2022 21:27:55 +0100 Subject: [PATCH 08/16] Wrong env var used --- .woodpecker/.release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.woodpecker/.release.yml b/.woodpecker/.release.yml index 622b6e4..26bf522 100644 --- a/.woodpecker/.release.yml +++ b/.woodpecker/.release.yml @@ -11,7 +11,7 @@ pipeline: - 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 "s3/vieter/commits/$CI" assets + - ./mc cp "s3/vieter/commits/$CI_COMMIT_SHA" assets release: image: 'plugins/gitea-release' From fd4439eb429bf2e44b949a7ebf5ef6dad5737f69 Mon Sep 17 00:00:00 2001 From: Jef Roosens Date: Sat, 22 Jan 2022 21:54:03 +0100 Subject: [PATCH 09/16] Possible releases fix --- .woodpecker/.build.yml | 4 ++-- .woodpecker/.release.yml | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.woodpecker/.build.yml b/.woodpecker/.build.yml index ecf1d73..c067a6c 100644 --- a/.woodpecker/.build.yml +++ b/.woodpecker/.build.yml @@ -1,8 +1,8 @@ matrix: PLATFORM: - linux/amd64 - - linux/arm64 - - linux/arm/v7 + # - linux/arm64 + # - linux/arm/v7 # These checks already get performed on the feature branches platform: ${PLATFORM} diff --git a/.woodpecker/.release.yml b/.woodpecker/.release.yml index 26bf522..184f5eb 100644 --- a/.woodpecker/.release.yml +++ b/.woodpecker/.release.yml @@ -1,17 +1,23 @@ platform: linux/amd64 +# We need the entire repo in order for the release names to work +clone: + skip: true + pipeline: prepare: image: 'chewingbever/vlang:latest' secrets: [ s3_username, s3_password ] commands: + - git clone "$CI_REPO_REMOTE" + - git checkout "$CI_COMMIT_BRANCH" # Write the title to a file that the plugin can then read - echo "$(git describe --tags --abbrev=0 2> /dev/null || echo '0.0.0')-$(git rev-list --count ^dev)" > title - cat title - 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 "s3/vieter/commits/$CI_COMMIT_SHA" assets + - ./mc cp -r "s3/vieter/commits/$CI_COMMIT_SHA" assets release: image: 'plugins/gitea-release' From 21ef11ec336fe3591bbe7b170f0646f455691102 Mon Sep 17 00:00:00 2001 From: Jef Roosens Date: Sat, 22 Jan 2022 21:55:11 +0100 Subject: [PATCH 10/16] We go agane --- .woodpecker/.release.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.woodpecker/.release.yml b/.woodpecker/.release.yml index 184f5eb..ee6cc17 100644 --- a/.woodpecker/.release.yml +++ b/.woodpecker/.release.yml @@ -2,7 +2,8 @@ platform: linux/amd64 # We need the entire repo in order for the release names to work clone: - skip: true + git: + skip: true pipeline: prepare: From 8aeabe3476d224f73dc8bc4e200590b8cd69a384 Mon Sep 17 00:00:00 2001 From: Jef Roosens Date: Sat, 22 Jan 2022 21:58:04 +0100 Subject: [PATCH 11/16] finally --- .woodpecker/.release.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.woodpecker/.release.yml b/.woodpecker/.release.yml index ee6cc17..d3ea0b2 100644 --- a/.woodpecker/.release.yml +++ b/.woodpecker/.release.yml @@ -1,9 +1,7 @@ platform: linux/amd64 # We need the entire repo in order for the release names to work -clone: - git: - skip: true +skip_clone: true pipeline: prepare: From 7552e0e86fc4eebd0e4694fedfe63971e5e7e27b Mon Sep 17 00:00:00 2001 From: Jef Roosens Date: Sat, 22 Jan 2022 22:02:22 +0100 Subject: [PATCH 12/16] Some more debugging --- .woodpecker/.release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.woodpecker/.release.yml b/.woodpecker/.release.yml index d3ea0b2..46651b9 100644 --- a/.woodpecker/.release.yml +++ b/.woodpecker/.release.yml @@ -8,7 +8,7 @@ pipeline: image: 'chewingbever/vlang:latest' secrets: [ s3_username, s3_password ] commands: - - git clone "$CI_REPO_REMOTE" + - git clone "$CI_REPO_REMOTE" . - git checkout "$CI_COMMIT_BRANCH" # Write the title to a file that the plugin can then read - echo "$(git describe --tags --abbrev=0 2> /dev/null || echo '0.0.0')-$(git rev-list --count ^dev)" > title From 20ec4c12043eec5bd50fedb852011c7eeaa4b074 Mon Sep 17 00:00:00 2001 From: Jef Roosens Date: Sat, 22 Jan 2022 22:12:30 +0100 Subject: [PATCH 13/16] Let's give up for now --- .woodpecker/.build.yml | 6 ++++-- .woodpecker/.lint.yml | 6 +----- .woodpecker/.release.yml | 2 ++ 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.woodpecker/.build.yml b/.woodpecker/.build.yml index c067a6c..96fa16b 100644 --- a/.woodpecker/.build.yml +++ b/.woodpecker/.build.yml @@ -1,8 +1,8 @@ matrix: PLATFORM: - linux/amd64 - # - linux/arm64 - # - linux/arm/v7 + - linux/arm64 + - linux/arm/v7 # These checks already get performed on the feature branches platform: ${PLATFORM} @@ -11,12 +11,14 @@ pipeline: # The default build isn't needed, as alpine switches to gcc for the compiler anyways debug: image: 'chewingbever/vlang:latest' + pull: true group: 'build' commands: - make debug prod: image: 'chewingbever/vlang:latest' + pull: true environment: - LDFLAGS=-lz -lbz2 -llzma -lexpat -lzstd -llz4 -static group: 'build' diff --git a/.woodpecker/.lint.yml b/.woodpecker/.lint.yml index 1ccd077..ce000cd 100644 --- a/.woodpecker/.lint.yml +++ b/.woodpecker/.lint.yml @@ -6,12 +6,8 @@ platform: linux/amd64 pipeline: lint: image: 'chewingbever/vlang:latest' + pull: true group: lint commands: - make lint - - vet: - image: 'chewingbever/vlang:latest' - group: lint - commands: - make vet diff --git a/.woodpecker/.release.yml b/.woodpecker/.release.yml index 46651b9..9da27be 100644 --- a/.woodpecker/.release.yml +++ b/.woodpecker/.release.yml @@ -1,4 +1,6 @@ +# Yeah so this only works on tags so we'll worry about this later platform: linux/amd64 +branches: main # We need the entire repo in order for the release names to work skip_clone: true From 4a71fd1f7f5beaa30c2ffad4e4ed7ffcf31a0bad Mon Sep 17 00:00:00 2001 From: Jef Roosens Date: Sat, 22 Jan 2022 22:14:29 +0100 Subject: [PATCH 14/16] Builds should only run on push --- .woodpecker/.build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.woodpecker/.build.yml b/.woodpecker/.build.yml index 96fa16b..6e522d3 100644 --- a/.woodpecker/.build.yml +++ b/.woodpecker/.build.yml @@ -3,6 +3,8 @@ matrix: - linux/amd64 - linux/arm64 - linux/arm/v7 +when: + event: push # These checks already get performed on the feature branches platform: ${PLATFORM} From 2b2f3987d7a4edb3f1a7de9d373fe552b9c3569e Mon Sep 17 00:00:00 2001 From: Jef Roosens Date: Sat, 22 Jan 2022 22:17:38 +0100 Subject: [PATCH 15/16] Same thing, different style --- .woodpecker/.build.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.woodpecker/.build.yml b/.woodpecker/.build.yml index 6e522d3..c00e0a7 100644 --- a/.woodpecker/.build.yml +++ b/.woodpecker/.build.yml @@ -3,8 +3,6 @@ matrix: - linux/amd64 - linux/arm64 - linux/arm/v7 -when: - event: push # These checks already get performed on the feature branches platform: ${PLATFORM} @@ -33,6 +31,8 @@ pipeline: # This removes so much, it's amazing - strip -s pvieter - du -h pvieter + when: + event: push upload: image: 'alpine:latest' @@ -59,3 +59,5 @@ pipeline: -H "Content-Type: $CONTENT_TYPE" -H "Authorization: AWS $S3_USERNAME:$SIGNATURE" https://$URL$OBJ_PATH + when: + event: push From 46ad12797d4660c721dd7a424e5e771cb8340acf Mon Sep 17 00:00:00 2001 From: Jef Roosens Date: Sat, 22 Jan 2022 22:18:19 +0100 Subject: [PATCH 16/16] You know what they say --- .woodpecker/.build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.woodpecker/.build.yml b/.woodpecker/.build.yml index c00e0a7..516fb20 100644 --- a/.woodpecker/.build.yml +++ b/.woodpecker/.build.yml @@ -15,6 +15,8 @@ pipeline: group: 'build' commands: - make debug + when: + event: push prod: image: 'chewingbever/vlang:latest'