From 6635c5fc9d01c39b3d054e58f4430b725df88696 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charlotte=20=F0=9F=A6=9D=20Delenk?= Date: Sat, 25 Jun 2022 20:52:37 +0100 Subject: [PATCH] use parallelism and nix images --- .drone.yml | 80 ++++++++++++++++++++++++++++++++++++++++----------- art/update.sh | 2 +- 2 files changed, 64 insertions(+), 18 deletions(-) diff --git a/.drone.yml b/.drone.yml index be4dcff..31c2dca 100644 --- a/.drone.yml +++ b/.drone.yml @@ -7,19 +7,59 @@ steps: - name: Update flake image: nixos/nix commands: - - echo "substituters = https://cache.nixos.org/ https://f000.backblazeb2.com/file/cache-chir-rs/" >> /etc/nix/nix.conf - - echo "trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= nixcache:8KKuGz95Pk4UJ5W/Ni+pN+v+LDTkMMFV4yrGmAYgkDg= hydra.nixos.org-1:CNHJZBh9K4tP3EKF6FkkgeVYsS3ohTl+oS0Qa8bezVs=" >> /etc/nix/nix.conf - echo "experimental-features = nix-command flakes" >> /etc/nix/nix.conf - nix flake update - - (cd minecraft && ./update.sh) - - (cd mastodon && ./update.sh) - - (cd matrix/matrix-media-repo && ./update.sh) - - (cd art && ./update.sh) - - nix fmt - - name: Push git - image: alpine:latest + - name: Update minecraft + image: nixery.dev/shell/curl/jq + commands: + - (cd minecraft && ./update.sh) + depends_on: + - Update flake + - name: Update mastodon-glitch + image: nixery.dev/shell/bundix/yarn2nix/yarn/nix-prefetch-git/jq + commands: + - (cd mastodon && ./update.sh) + environment: + USER: nobody + depends_on: + - Update flake + - name: Update matrix-media-repo + image: nixery.dev/shell/nix-prefetch-git/jq + commands: + - (cd matrix/matrix-media-repo && ./update.sh) + environment: + USER: nobody + depends_on: + - Update flake + - name: Update mautrix-whatsapp + image: nixery.dev/shell/nix-prefetch-git/jq + commands: + - (cd matrix/mautrix-whatsapp && ./update.sh) + environment: + USER: nobody + depends_on: + - Update flake + - name: Update art + image: nixery.dev/shell/nix-prefetch-git/jq + commands: + - (cd art && ./update.sh) + environment: + USER: nobody + depends_on: + - Update flake + - name: Format nix + image: nixery.dev/shell/alejandra + commands: + - alejandra . + depends_on: + - Update minecraft + - Update mastodon-glitch + - Update matrix-media-repo + - Update mautrix-whatsapp + - Update art + - name: Push git + image: nixery.dev/shell/gitFull commands: - - apk add git openssh git-lfs - mkdir ~/.ssh - echo "$SSH_KEY" > ~/.ssh/id_ed25519 - chmod 600 ~/.ssh/id_ed25519 @@ -34,20 +74,26 @@ steps: environment: SSH_KEY: from_secret: SSH_KEY + depends_on: Format nix - name: Create pull request - image: alpine:latest + image: nixery.dev/shell/curl commands: - - apk add jq curl - | - echo '{ "assignee": "DarkKirb", "base": "main", "head": "update-package", "title": "Update packages" }' | jq '.body = $body' --arg body "$(cat ../pr-message.txt)" | curl -XPOST 'https://git.chir.rs/api/v1/repos/DarkKirb/nix-packages/pulls' -H "Accept: application/json" -H "Content-Type: application/json" -H "Authorization: Bearer $AUTHORISATION" --data-binary @- + echo '{ "assignee": "DarkKirb", "base": "main", "head": "update-package", "title": "Update packages", "body": "" }' | curl -XPOST 'https://git.chir.rs/api/v1/repos/DarkKirb/nix-packages/pulls' -H "Accept: application/json" -H "Content-Type: application/json" -H "Authorization: Bearer $AUTHORISATION" --data-binary @- environment: AUTHORISATION: from_secret: GITEA_KEY + depends_on: Push git +#trigger: +# event: +# - cron +# cron: +# - updater trigger: event: - - cron - cron: - - updater + - push + branch: + - main --- kind: pipeline type: docker @@ -55,7 +101,7 @@ name: notify-hydra steps: - name: Notify hydra - image: curlimages/curl:latest + image: nixery.dev/shell/curl commands: - curl --get --data-urlencode "jobsets=darkkirb:nix-packages" https://hydra.chir.rs/api/push trigger: diff --git a/art/update.sh b/art/update.sh index b2f8b9b..e6efaec 100755 --- a/art/update.sh +++ b/art/update.sh @@ -12,7 +12,7 @@ function cleanup { trap cleanup EXIT echo "Fetching source code $REVISION from $URL" -JSON=$(nix-prefetch-git --url "$URL" --fetch-lfs 2> $WORK_DIR/nix-prefetch-git.out | grep -v "Git" | sed 's/"deepClone": false,/"deepClone": false/' ) +JSON=$(nix-prefetch-git --url "$URL" --fetch-lfs 2> $WORK_DIR/nix-prefetch-git.out | grep -v "Git") REVISION=$(echo $JSON | jq -r .rev) SHA=$(echo $JSON | jq -r .sha256)