From ed6b61e13f3bb7a68945e97d9c1da8579c43c775 Mon Sep 17 00:00:00 2001 From: Brendan Golden Date: Wed, 26 Jul 2023 23:23:55 +0100 Subject: [PATCH] ci: test the deploy --- .gitlab-ci.yml | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index fd40289..762f1a3 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,7 +3,7 @@ stages: - flake - test - #- deploy + - deploy # Passed in from upstream # $PACKAGE_NAME = name of the flake that needs to be updated @@ -49,24 +49,25 @@ build: # use ctrl+/ on intellij to mass uncoment # set up deployment later -#deploy: -# stage: deploy -# # from https://forum.gitlab.com/t/git-push-from-inside-a-gitlab-runner/30554/5 -# before_script: -# # Check for ssh-agent + rsync and install if not present -# #- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )' -# - eval $(ssh-agent -s) -# # Inject the remote's private key -# - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null -# - mkdir -p ~/.ssh -# - chmod 700 ~/.ssh -# # Append keyscan output into known hosts +deploy: + stage: deploy + # from https://forum.gitlab.com/t/git-push-from-inside-a-gitlab-runner/30554/5 + before_script: + # Check for ssh-agent + rsync and install if not present + #- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )' + - eval $(ssh-agent -s) + # Inject the remote's private key + - echo "$DEPLOY_KEY" | tr -d '\r' | ssh-add - > /dev/null + - mkdir -p ~/.ssh + - chmod 700 ~/.ssh + # Append keyscan output into known hosts # - ssh-keyscan $SERVER_IP >> ~/.ssh/known_hosts # - chmod 644 ~/.ssh/known_hosts -# -# script: -# # this will grab a fresh copy of teh repo -# - ssh $SERVER_USER@$SERVER_IP "cd /etc/nixos && git stash && git pull origin main && nixos-rebuild switch" + - . "$HOME/.nix-profile/etc/profile.d/nix.sh" + + script: + # this will grab a fresh copy of teh repo + - nix --experimental-features 'nix-command flakes' run nixpkgs#colmena -- apply --on @active-dns # # only: # refs: