From f4bc8ca6f4ec7f3f987d4df022f94558e16d6a85 Mon Sep 17 00:00:00 2001 From: Brendan Golden Date: Wed, 26 Jul 2023 23:32:20 +0100 Subject: [PATCH] ci: cleaned up pipeline --- .gitlab-ci.yml | 35 ++++++++++------------------------- 1 file changed, 10 insertions(+), 25 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 762f1a3..05b97ef 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,17 +5,16 @@ stages: - test - deploy +# Update the flake for any changes upstream # Passed in from upstream # $PACKAGE_NAME = name of the flake that needs to be updated # $UPDATE_FLAKE = flag to update the flake - update: stage: flake # from https://forum.gitlab.com/t/git-push-from-inside-a-gitlab-runner/30554/5 before_script: - #- 'which ssh-agent || ( apt-get update -qy && apt-get install openssh-client -qqy )' - eval `ssh-agent -s` - # for the deploy + # set teh ssh key for the commit - echo "${CI_KEY}" | tr -d '\r' | ssh-add - > /dev/null - mkdir -p ~/.ssh - chmod 700 ~/.ssh @@ -32,7 +31,6 @@ update: # we have a custom domain - git remote rm origin && git remote add origin ssh://git@gitlab.skynet.ie:2222/compsoc/skynet/nixos.git - git push origin HEAD:$CI_COMMIT_REF_NAME - only: refs: - main @@ -40,39 +38,26 @@ update: - $UPDATE_FLAKE == "yes" build: - # image: nixos/nix stage: test before_script: - . "$HOME/.nix-profile/etc/profile.d/nix.sh" script: - nix --experimental-features 'nix-command flakes' run nixpkgs#colmena -- build -# use ctrl+/ on intellij to mass uncoment -# set up deployment later +# every commit on main will build and deploy 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 + # setup ssh 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 + # load nix environment - . "$HOME/.nix-profile/etc/profile.d/nix.sh" - script: - # this will grab a fresh copy of teh repo + # dns is always deployed first - nix --experimental-features 'nix-command flakes' run nixpkgs#colmena -- apply --on @active-dns -# -# only: -# refs: -# - main - - - # only run on $UPDATE_FLAKE - + - nix --experimental-features 'nix-command flakes' run nixpkgs#colmena -- apply --on @active + only: + refs: + - main \ No newline at end of file