From 0700eb16fbfe1e58e1d87d6120581fab2c8e32db Mon Sep 17 00:00:00 2001 From: Jef Roosens Date: Sat, 22 Jan 2022 19:01:46 +0100 Subject: [PATCH 01/31] 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/31] 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/31] 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/31] 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/31] 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/31] 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/31] 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/31] 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/31] 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/31] 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/31] 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/31] 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/31] 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/31] 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/31] 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/31] 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' From a1dd6c0c3634a452d963d364a750afe0ac2ae47a Mon Sep 17 00:00:00 2001 From: Jef Roosens Date: Sat, 22 Jan 2022 22:37:27 +0100 Subject: [PATCH 17/31] Moving some more tools into builder image [CI SKIP] --- .woodpecker/.release.yml | 1 + Dockerfile.builder | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.woodpecker/.release.yml b/.woodpecker/.release.yml index 9da27be..2e32c7f 100644 --- a/.woodpecker/.release.yml +++ b/.woodpecker/.release.yml @@ -8,6 +8,7 @@ skip_clone: true pipeline: prepare: image: 'chewingbever/vlang:latest' + pull: true secrets: [ s3_username, s3_password ] commands: - git clone "$CI_REPO_REMOTE" . diff --git a/Dockerfile.builder b/Dockerfile.builder index 48048f8..ff2761f 100644 --- a/Dockerfile.builder +++ b/Dockerfile.builder @@ -11,14 +11,17 @@ ENV VFLAGS -cc gcc RUN mkdir -p /opt/vlang && \ ln -s /opt/vlang/v /usr/bin/v && \ apk --no-cache add \ - git make gcc \ + git make gcc curl openssl \ musl-dev \ openssl-libs-static openssl-dev \ zlib-static bzip2-static xz-dev expat-static zstd-static lz4-static \ sqlite-static sqlite-dev \ libx11-dev glfw-dev freetype-dev \ libarchive-static libarchive-dev \ - diffutils + diffutils && \ + # yes yes I know this is amd64, it's okay + wget -O /usr/local/bin/mc https://dl.min.io/client/mc/release/linux-amd64/mc && \ + chmod +x /usr/local/bin/mc COPY . /vlang-local From 7443a06325ce13a7912a76af91ce90e5e38235b9 Mon Sep 17 00:00:00 2001 From: Jef Roosens Date: Sat, 22 Jan 2022 22:40:44 +0100 Subject: [PATCH 18/31] Poke the CI --- README.md | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 5d49577..b51ab7f 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,12 @@ terminal, & upload them to the servers using CI. The data directory consists of three main directories: -* `downloads` - This is where packages are initially downloaded. Because vieter moves files from this folder to the `pkgs` folder, these two folders should best be on the same drive +* `downloads` - This is where packages are initially downloaded. Because vieter + moves files from this folder to the `pkgs` folder, these two folders should + best be on the same drive * `pkgs` - This is where approved package files are stored. -* `repos` - Each repository gets a subfolder here. The subfolder contains the uncompressed contents of the db file. - * Each repo subdirectory contains the compressed db & files archive for the repository, alongside a directory called `files` which contains the uncompressed contents. +* `repos` - Each repository gets a subfolder here. The subfolder contains the + uncompressed contents of the db file. + * Each repo subdirectory contains the compressed db & files archive for the + repository, alongside a directory called `files` which contains the + uncompressed contents. From 9a102a08fadb05baa6168176bfdf61fcd2939e59 Mon Sep 17 00:00:00 2001 From: Jef Roosens Date: Sat, 22 Jan 2022 22:41:46 +0100 Subject: [PATCH 19/31] Come on --- Dockerfile.builder | 2 -- 1 file changed, 2 deletions(-) diff --git a/Dockerfile.builder b/Dockerfile.builder index ff2761f..bc90473 100644 --- a/Dockerfile.builder +++ b/Dockerfile.builder @@ -1,7 +1,5 @@ FROM alpine:3.12 -LABEL maintainer="spytheman " - WORKDIR /opt/vlang ENV VVV /opt/vlang From 4c42838c93630874dc6b6893cfa039a1b5f15a8b Mon Sep 17 00:00:00 2001 From: Jef Roosens Date: Sat, 22 Jan 2022 22:52:21 +0100 Subject: [PATCH 20/31] A test, as they say --- Dockerfile.builder | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Dockerfile.builder b/Dockerfile.builder index bc90473..2186c89 100644 --- a/Dockerfile.builder +++ b/Dockerfile.builder @@ -6,6 +6,8 @@ ENV VVV /opt/vlang ENV PATH /opt/vlang:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin ENV VFLAGS -cc gcc +RUN echo "$TARGETPLATFORM" && exit 1 + RUN mkdir -p /opt/vlang && \ ln -s /opt/vlang/v /usr/bin/v && \ apk --no-cache add \ From 3414f32718694b5426d43b313598c2710e978c6a Mon Sep 17 00:00:00 2001 From: Jef Roosens Date: Sat, 22 Jan 2022 22:58:09 +0100 Subject: [PATCH 21/31] Possible fix --- Dockerfile.builder | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Dockerfile.builder b/Dockerfile.builder index 2186c89..b075dda 100644 --- a/Dockerfile.builder +++ b/Dockerfile.builder @@ -6,8 +6,6 @@ ENV VVV /opt/vlang ENV PATH /opt/vlang:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin ENV VFLAGS -cc gcc -RUN echo "$TARGETPLATFORM" && exit 1 - RUN mkdir -p /opt/vlang && \ ln -s /opt/vlang/v /usr/bin/v && \ apk --no-cache add \ @@ -18,10 +16,13 @@ RUN mkdir -p /opt/vlang && \ sqlite-static sqlite-dev \ libx11-dev glfw-dev freetype-dev \ libarchive-static libarchive-dev \ - diffutils && \ - # yes yes I know this is amd64, it's okay - wget -O /usr/local/bin/mc https://dl.min.io/client/mc/release/linux-amd64/mc && \ - chmod +x /usr/local/bin/mc + diffutils + +RUN if [ "$TARGETPLATFORM" = 'linux/amd64' ]; then \ + wget -O /usr/local/bin/mc https://dl.min.io/client/mc/release/linux-amd64/mc && \ + chmod +x /usr/local/bin/mc ; \ +fi + COPY . /vlang-local From 3f77c49c0137c0e497569a491d9df07cb8a5e0f4 Mon Sep 17 00:00:00 2001 From: Jef Roosens Date: Sat, 22 Jan 2022 23:03:15 +0100 Subject: [PATCH 22/31] Forgot to add build arg --- Dockerfile.builder | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Dockerfile.builder b/Dockerfile.builder index b075dda..75b1e3c 100644 --- a/Dockerfile.builder +++ b/Dockerfile.builder @@ -1,5 +1,7 @@ FROM alpine:3.12 +ARG TARGETPLATFORM + WORKDIR /opt/vlang ENV VVV /opt/vlang From d2af65cbce2942119ca61605f082ad99324587d6 Mon Sep 17 00:00:00 2001 From: Jef Roosens Date: Sat, 22 Jan 2022 23:15:36 +0100 Subject: [PATCH 23/31] It's in the builder now [CI SKIP] --- .woodpecker/.build.yml | 3 --- .woodpecker/.release.yml | 6 ++---- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/.woodpecker/.build.yml b/.woodpecker/.build.yml index 516fb20..b91f7cc 100644 --- a/.woodpecker/.build.yml +++ b/.woodpecker/.build.yml @@ -40,9 +40,6 @@ pipeline: image: 'alpine:latest' secrets: [ s3_username, s3_password ] commands: - # 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:/:-:g')" diff --git a/.woodpecker/.release.yml b/.woodpecker/.release.yml index 2e32c7f..bc43b90 100644 --- a/.woodpecker/.release.yml +++ b/.woodpecker/.release.yml @@ -16,10 +16,8 @@ pipeline: # 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 -r "s3/vieter/commits/$CI_COMMIT_SHA" assets + - mc alias set s3/ https://s3.rustybever.be "$S3_USERNAME" "$S3_PASSWORD" + - mc cp -r "s3/vieter/commits/$CI_COMMIT_SHA" assets release: image: 'plugins/gitea-release' From 3fc22bf078319ab5499cd37946ceb16fd53901b9 Mon Sep 17 00:00:00 2001 From: Jef Roosens Date: Sun, 23 Jan 2022 10:53:58 +0100 Subject: [PATCH 24/31] Switchd to hyper-minimal docker image --- .woodpecker/.image.yml | 2 ++ .woodpecker/.publish.yml | 3 +++ .woodpecker/.release.yml | 1 + Dockerfile.ci | 20 ++++++++++++++++++++ 4 files changed, 26 insertions(+) create mode 100644 Dockerfile.ci diff --git a/.woodpecker/.image.yml b/.woodpecker/.image.yml index 7f583a8..dcf40f9 100644 --- a/.woodpecker/.image.yml +++ b/.woodpecker/.image.yml @@ -2,12 +2,14 @@ # because it has to be the target of the pull request branches: dev platform: linux/amd64 +depends_on: build pipeline: dryrun: image: woodpeckerci/plugin-docker-buildx secrets: [ docker_username, docker_password ] settings: + dockerfile: Dockerfile.ci repo: chewingbever/vieter tag: dev platforms: [ linux/arm/v7, linux/arm64/v8, linux/amd64 ] diff --git a/.woodpecker/.publish.yml b/.woodpecker/.publish.yml index 9e5f39a..1e70eaf 100644 --- a/.woodpecker/.publish.yml +++ b/.woodpecker/.publish.yml @@ -6,9 +6,12 @@ pipeline: image: woodpeckerci/plugin-docker-buildx secrets: [ docker_username, docker_password ] settings: + dockerfile: Dockerfile.ci repo: chewingbever/vieter tag: dev platforms: [ linux/arm/v7, linux/arm64/v8, linux/amd64 ] + args: + - CI_COMMIT_SHA when: event: push branch: dev diff --git a/.woodpecker/.release.yml b/.woodpecker/.release.yml index bc43b90..a220c75 100644 --- a/.woodpecker/.release.yml +++ b/.woodpecker/.release.yml @@ -1,6 +1,7 @@ # Yeah so this only works on tags so we'll worry about this later platform: linux/amd64 branches: main +depends_on: build # We need the entire repo in order for the release names to work skip_clone: true diff --git a/Dockerfile.ci b/Dockerfile.ci new file mode 100644 index 0000000..387d2ef --- /dev/null +++ b/Dockerfile.ci @@ -0,0 +1,20 @@ +# vim: ft=dockerfile +# This image just has the required tools to download the binaries +FROM chewingbever/vlang:latest AS builder + +ARG TARGETPLATFORM +ARG CI_COMMIT_SHA + +WORKDIR /app + +RUN curl \ + -o vieter \ + "https://s3.rustybever.be/vieter/commits/${CI_COMMIT_SHA}/vieter-$(echo "${TARGETPLATFORM}" | sed 's:/:-:g')" && \ + chmod +x vieter + + +FROM scratch + +COPY --from=builder /app/vieter /bin/vieter + +ENTRYPOINT ["/bin/vieter"] From 702fb0d13bd2eacbeaab08b4c899bdd51a1ad64c Mon Sep 17 00:00:00 2001 From: Jef Roosens Date: Sun, 23 Jan 2022 10:55:03 +0100 Subject: [PATCH 25/31] Oops --- .woodpecker/.image.yml | 2 +- .woodpecker/.release.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.woodpecker/.image.yml b/.woodpecker/.image.yml index dcf40f9..3d0b310 100644 --- a/.woodpecker/.image.yml +++ b/.woodpecker/.image.yml @@ -2,7 +2,7 @@ # because it has to be the target of the pull request branches: dev platform: linux/amd64 -depends_on: build +depends_on: [ build ] pipeline: dryrun: diff --git a/.woodpecker/.release.yml b/.woodpecker/.release.yml index a220c75..7dfd624 100644 --- a/.woodpecker/.release.yml +++ b/.woodpecker/.release.yml @@ -1,7 +1,7 @@ # Yeah so this only works on tags so we'll worry about this later platform: linux/amd64 branches: main -depends_on: build +depends_on: [ build ] # We need the entire repo in order for the release names to work skip_clone: true From c3657e178eb1c8bddde17c3255182d2149a84acb Mon Sep 17 00:00:00 2001 From: Jef Roosens Date: Sun, 23 Jan 2022 10:56:22 +0100 Subject: [PATCH 26/31] Oops again --- .woodpecker/.publish.yml | 1 + .woodpecker/.release.yml | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/.woodpecker/.publish.yml b/.woodpecker/.publish.yml index 1e70eaf..08eadb9 100644 --- a/.woodpecker/.publish.yml +++ b/.woodpecker/.publish.yml @@ -31,3 +31,4 @@ pipeline: depends_on: - builder + - build diff --git a/.woodpecker/.release.yml b/.woodpecker/.release.yml index 7dfd624..bc43b90 100644 --- a/.woodpecker/.release.yml +++ b/.woodpecker/.release.yml @@ -1,7 +1,6 @@ # Yeah so this only works on tags so we'll worry about this later platform: linux/amd64 branches: main -depends_on: [ build ] # We need the entire repo in order for the release names to work skip_clone: true From 015af3626cc9e89b4abc3cae3a5ab6c4e6f7083a Mon Sep 17 00:00:00 2001 From: Jef Roosens Date: Sun, 23 Jan 2022 10:58:49 +0100 Subject: [PATCH 27/31] Used wrong image for upload step --- .woodpecker/.build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.woodpecker/.build.yml b/.woodpecker/.build.yml index b91f7cc..66caa8c 100644 --- a/.woodpecker/.build.yml +++ b/.woodpecker/.build.yml @@ -37,7 +37,7 @@ pipeline: event: push upload: - image: 'alpine:latest' + image: 'chewingbever/vlang:latest' secrets: [ s3_username, s3_password ] commands: # https://gist.github.com/JustinTimperio/7c7115f87b775618637d67ac911e595f From c7d1a78b84139544bf4f38b17f32ebcf55d1f804 Mon Sep 17 00:00:00 2001 From: Jef Roosens Date: Sun, 23 Jan 2022 11:13:47 +0100 Subject: [PATCH 28/31] This *should* work --- .woodpecker/.publish.yml | 2 +- Dockerfile.ci | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.woodpecker/.publish.yml b/.woodpecker/.publish.yml index 08eadb9..cbcc8f0 100644 --- a/.woodpecker/.publish.yml +++ b/.woodpecker/.publish.yml @@ -10,7 +10,7 @@ pipeline: repo: chewingbever/vieter tag: dev platforms: [ linux/arm/v7, linux/arm64/v8, linux/amd64 ] - args: + args-from-env: - CI_COMMIT_SHA when: event: push diff --git a/Dockerfile.ci b/Dockerfile.ci index 387d2ef..0a3f8cd 100644 --- a/Dockerfile.ci +++ b/Dockerfile.ci @@ -7,7 +7,7 @@ ARG CI_COMMIT_SHA WORKDIR /app -RUN curl \ +RUN curl --fail \ -o vieter \ "https://s3.rustybever.be/vieter/commits/${CI_COMMIT_SHA}/vieter-$(echo "${TARGETPLATFORM}" | sed 's:/:-:g')" && \ chmod +x vieter From e79e607721d92da3e41b49a17a56b9d233f84de7 Mon Sep 17 00:00:00 2001 From: Jef Roosens Date: Sun, 23 Jan 2022 11:33:07 +0100 Subject: [PATCH 29/31] Possible fix --- .woodpecker/.publish.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.woodpecker/.publish.yml b/.woodpecker/.publish.yml index cbcc8f0..5655314 100644 --- a/.woodpecker/.publish.yml +++ b/.woodpecker/.publish.yml @@ -10,8 +10,8 @@ pipeline: repo: chewingbever/vieter tag: dev platforms: [ linux/arm/v7, linux/arm64/v8, linux/amd64 ] - args-from-env: - - CI_COMMIT_SHA + args: + - "CI_COMMIT_SHA=${CI_COMMIT_SHA}" when: event: push branch: dev From 434c8d62edb789221dc06d68730138c0e8420fbc Mon Sep 17 00:00:00 2001 From: Jef Roosens Date: Sun, 23 Jan 2022 13:58:29 +0100 Subject: [PATCH 30/31] A new challenger approaches --- .woodpecker/.publish.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.woodpecker/.publish.yml b/.woodpecker/.publish.yml index 5655314..e6da2b6 100644 --- a/.woodpecker/.publish.yml +++ b/.woodpecker/.publish.yml @@ -10,8 +10,8 @@ pipeline: repo: chewingbever/vieter tag: dev platforms: [ linux/arm/v7, linux/arm64/v8, linux/amd64 ] - args: - - "CI_COMMIT_SHA=${CI_COMMIT_SHA}" + build-args-from-env: + - CI_COMMIT_SHA when: event: push branch: dev From bca53f6ea4c815fd73e0d63c0548b15aee491a76 Mon Sep 17 00:00:00 2001 From: Jef Roosens Date: Sun, 23 Jan 2022 18:43:52 +0100 Subject: [PATCH 31/31] I can be so dumb --- .woodpecker/.publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.woodpecker/.publish.yml b/.woodpecker/.publish.yml index e6da2b6..2e6b459 100644 --- a/.woodpecker/.publish.yml +++ b/.woodpecker/.publish.yml @@ -10,7 +10,7 @@ pipeline: repo: chewingbever/vieter tag: dev platforms: [ linux/arm/v7, linux/arm64/v8, linux/amd64 ] - build-args-from-env: + build_args_from_env: - CI_COMMIT_SHA when: event: push