Add commit flake stage

This commit is contained in:
yuri 2023-07-13 21:42:08 +02:00
parent 8741712649
commit 8d0f890ea7

View file

@ -3,7 +3,6 @@ default:
stages:
- update_flake_lock
- build
- apply
- commit_flake
@ -11,12 +10,9 @@ update_flake_lock:
stage: update_flake_lock
script:
- nix flake update --extra-experimental-features nix-command --extra-experimental-features flakes
build:
stage: build
script:
- nix-env --install colmena
- colmena build
artifacts:
paths:
- ./flake.lock
apply:
stage: apply
@ -26,7 +22,11 @@ apply:
- chmod 600 "$SSH_PRIVATE_KEY"
- ssh-add "$SSH_PRIVATE_KEY"
- git clone https://oauth2:${ACCESS_TOKEN_KNOWN_HOSTS}@git.grzb.de/yuri/known_hosts.git /root/.ssh
- colmena build
- colmena apply --no-keys
artifacts:
paths:
- ./flake.lock
commit_flake:
stage: commit_flake
@ -37,4 +37,5 @@ commit_flake:
GIT_COMMITTER_NAME: $GIT_COMMITTER_NAME
ACCESS_TOKEN: $ACCESS_TOKEN
script:
- nix-env --install git
- git commit -m "Update flake.lock file" -m "Triggered by scheduled pipeline $CI_PIPELINE_ID at $CI_PIPELINE_CREATED_AT." || failure_code=$?
- if [ "$failure_code" == "" ]; then git push https://gitlab-runner-server:${ACCESS_TOKEN}@${CI_SERVER_HOST}/yuri/nix-infra.git HEAD:$CI_COMMIT_BRANCH; fi