From 1e74770ea2ac83177a51a0ac894d26c172a212cf Mon Sep 17 00:00:00 2001 From: Sarah Vaupel Date: Sat, 15 Jul 2023 16:24:19 +0000 Subject: [PATCH] chore(gitlab-ci): use flake.nix instead of manually constructing flake url --- .gitlab-ci.yml | 40 +++++++++++-------------------- .gitlab-ci/construct-flake-url.sh | 12 ---------- 2 files changed, 14 insertions(+), 38 deletions(-) delete mode 100755 .gitlab-ci/construct-flake-url.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4122e4001..e505066d0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -34,8 +34,7 @@ stages: node dependencies: stage: frontend:build script: - - source .gitlab-ci/construct-flake-url.sh - - nix -L build -o result "${FLAKE}#uniworxNodeDependencies" + - nix -L build -o result ".#uniworxNodeDependencies" - nix-store --export $(nix-store -qR result) | xz -T0 -2 > node-dependencies.nar.xz before_script: &nix-before - git config --global init.defaultBranch master @@ -56,8 +55,7 @@ well known: stage: frontend:build script: - xzcat node-dependencies.nar.xz | nix-store --import - - source .gitlab-ci/construct-flake-url.sh - - nix -L build -o result "${FLAKE}#uniworxWellKnown" + - nix -L build -o result ".#uniworxWellKnown" - nix-store --export $(nix-store -qR result) | xz -T0 -2 > well-known.nar.xz before_script: *nix-before needs: @@ -76,8 +74,7 @@ frontend: script: - xzcat node-dependencies.nar.xz | nix-store --import - xzcat well-known.nar.xz | nix-store --import - - source .gitlab-ci/construct-flake-url.sh - - nix -L build -o result "${FLAKE}#uniworxFrontend" + - nix -L build -o result ".#uniworxFrontend" - nix-store --export $(nix-store -qR result) | xz -T0 -2 > frontend.nar.xz before_script: *nix-before needs: @@ -97,8 +94,7 @@ uniworx:lib:uniworx: stage: backend:build script: - xzcat frontend.nar.xz | nix-store --import - - source .gitlab-ci/construct-flake-url.sh - - nix -L build -o result "${FLAKE}#uniworx:lib:uniworx" + - nix -L build -o result ".#uniworx:lib:uniworx" - nix-store --export $(nix-store -qR result) | xz -T0 -2 > uniworx:lib:uniworx.nar.xz before_script: *nix-before needs: @@ -120,8 +116,7 @@ uniworx:exe:uniworx: stage: backend:build script: - xzcat uniworx:lib:uniworx.nar.xz | nix-store --import - - source .gitlab-ci/construct-flake-url.sh - - nix -L build -o result "${FLAKE}#uniworx:exe:uniworx" + - nix -L build -o result ".#uniworx:exe:uniworx" - nix-store --export $(nix-store -qR result) | xz -T0 -2 > uniworx:exe:uniworx.nar.xz before_script: *nix-before needs: @@ -145,8 +140,7 @@ uniworx:exe:uniworxdb: stage: backend:build script: - xzcat uniworx:lib:uniworx.nar.xz | nix-store --import - - source .gitlab-ci/construct-flake-url.sh - - nix -L build -o result "${FLAKE}#uniworx:exe:uniworxdb" + - nix -L build -o result ".#uniworx:exe:uniworxdb" - nix-store --export $(nix-store -qR result) | xz -T0 -2 > uniworx:exe:uniworxdb.nar.xz before_script: *nix-before needs: @@ -170,8 +164,7 @@ uniworx:exe:uniworxload: stage: backend:build script: - xzcat uniworx:lib:uniworx.nar.xz | nix-store --import - - source .gitlab-ci/construct-flake-url.sh - - nix -L build -o result "${FLAKE}#uniworx:exe:uniworxload" + - nix -L build -o result ".#uniworx:exe:uniworxload" - nix-store --export $(nix-store -qR result) | xz -T0 -2 > uniworx:exe:uniworxload.nar.xz before_script: *nix-before needs: @@ -196,8 +189,7 @@ check: script: - xzcat frontend.nar.xz | nix-store --import - xzcat uniworx:lib:uniworx.nar.xz | nix-store --import - - source .gitlab-ci/construct-flake-url.sh - - nix -L flake check ${FLAKE} + - nix -L flake check . before_script: *nix-before needs: - job: node dependencies # transitive @@ -215,8 +207,7 @@ container: stage: container:build script: - xzcat uniworx:exe:uniworx.nar.xz | nix-store --import - - source .gitlab-ci/construct-flake-url.sh - - cp -pr --reflink=auto -L $(nix build --print-out-paths "${FLAKE}#uniworxDocker") uniworx.tar.gz + - cp -pr --reflink=auto -L $(nix build --print-out-paths ".#uniworxDocker") uniworx.tar.gz before_script: *nix-before needs: - job: node dependencies # transitive @@ -244,8 +235,7 @@ test container: stage: container:build script: - xzcat uniworx:exe:uniworx.nar.xz | nix-store --import - - source .gitlab-ci/construct-flake-url.sh - - cp -pr --reflink=auto -L $(nix build --print-out-paths "${FLAKE}#uniworxTestDocker") uniworx.tar.gz + - cp -pr --reflink=auto -L $(nix build --print-out-paths ".#uniworxTestDocker") uniworx.tar.gz before_script: *nix-before needs: - job: node dependencies # transitive @@ -279,9 +269,8 @@ parse changelog: before_script: *nix-before script: - xzcat node-dependencies.nar.xz | nix-store --import - - source .gitlab-ci/construct-flake-url.sh - - nix -L run "${FLAKE}#jqChangelogJson" -- -r '.versions[0].version' > .current-version - - nix -L run "${FLAKE}#jqChangelogJson" -- -r '.versions[0].body' > .current-changelog.md + - nix -L run ".#jqChangelogJson" -- -r '.versions[0].version' > .current-version + - nix -L run ".#jqChangelogJson" -- -r '.versions[0].body' > .current-changelog.md - echo "VERSION=$(cat .current-version)" >> build.env artifacts: reports: @@ -302,9 +291,8 @@ parse test changelog: before_script: *nix-before script: - xzcat node-dependencies.nar.xz | nix-store --import - - source .gitlab-ci/construct-flake-url.sh - - nix -L run "${FLAKE}#jqChangelogJson" -- -r '.versions[0].version' > .current-version - - nix -L run "${FLAKE}#jqChangelogJson" -- -r '.versions[0].body' > .current-changelog.md + - nix -L run ".#jqChangelogJson" -- -r '.versions[0].version' > .current-version + - nix -L run ".#jqChangelogJson" -- -r '.versions[0].body' > .current-changelog.md - echo "VERSION=$(cat .current-version)" >> build.env artifacts: reports: diff --git a/.gitlab-ci/construct-flake-url.sh b/.gitlab-ci/construct-flake-url.sh deleted file mode 100755 index 18802d34c..000000000 --- a/.gitlab-ci/construct-flake-url.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash - -# SPDX-FileCopyrightText: 2022 Gregor Kleen -# -# SPDX-License-Identifier: AGPL-3.0-or-later - -if [ -n "${CI_COMMIT_TAG}" ]; then - ref="refs/tags/${CI_COMMIT_TAG}" -else - ref="refs/heads/${CI_COMMIT_BRANCH}" -fi -export FLAKE="git+${CI_REPOSITORY_URL}?rev=${CI_COMMIT_SHA}&ref=${ref}"