use parallelism and nix images

This commit is contained in:
Charlotte 🦝 Delenk 2022-06-25 20:52:37 +01:00
parent 147efb74fd
commit 6635c5fc9d
Signed by: darkkirb
GPG key ID: AB2BD8DAF2E37122
2 changed files with 64 additions and 18 deletions

View file

@ -7,19 +7,59 @@ steps:
- name: Update flake - name: Update flake
image: nixos/nix image: nixos/nix
commands: 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 - echo "experimental-features = nix-command flakes" >> /etc/nix/nix.conf
- nix flake update - nix flake update
- (cd minecraft && ./update.sh) - name: Update minecraft
- (cd mastodon && ./update.sh) image: nixery.dev/shell/curl/jq
- (cd matrix/matrix-media-repo && ./update.sh) commands:
- (cd art && ./update.sh) - (cd minecraft && ./update.sh)
- nix fmt depends_on:
- name: Push git - Update flake
image: alpine:latest - 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: commands:
- apk add git openssh git-lfs
- mkdir ~/.ssh - mkdir ~/.ssh
- echo "$SSH_KEY" > ~/.ssh/id_ed25519 - echo "$SSH_KEY" > ~/.ssh/id_ed25519
- chmod 600 ~/.ssh/id_ed25519 - chmod 600 ~/.ssh/id_ed25519
@ -34,20 +74,26 @@ steps:
environment: environment:
SSH_KEY: SSH_KEY:
from_secret: SSH_KEY from_secret: SSH_KEY
depends_on: Format nix
- name: Create pull request - name: Create pull request
image: alpine:latest image: nixery.dev/shell/curl
commands: 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: environment:
AUTHORISATION: AUTHORISATION:
from_secret: GITEA_KEY from_secret: GITEA_KEY
depends_on: Push git
#trigger:
# event:
# - cron
# cron:
# - updater
trigger: trigger:
event: event:
- cron - push
cron: branch:
- updater - main
--- ---
kind: pipeline kind: pipeline
type: docker type: docker
@ -55,7 +101,7 @@ name: notify-hydra
steps: steps:
- name: Notify hydra - name: Notify hydra
image: curlimages/curl:latest image: nixery.dev/shell/curl
commands: commands:
- curl --get --data-urlencode "jobsets=darkkirb:nix-packages" https://hydra.chir.rs/api/push - curl --get --data-urlencode "jobsets=darkkirb:nix-packages" https://hydra.chir.rs/api/push
trigger: trigger:

View file

@ -12,7 +12,7 @@ function cleanup {
trap cleanup EXIT trap cleanup EXIT
echo "Fetching source code $REVISION from $URL" 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) REVISION=$(echo $JSON | jq -r .rev)
SHA=$(echo $JSON | jq -r .sha256) SHA=$(echo $JSON | jq -r .sha256)