ci: cleaned up pipeline
This commit is contained in:
parent
ed6b61e13f
commit
f4bc8ca6f4
1 changed files with 10 additions and 25 deletions
|
@ -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
|
Loading…
Reference in a new issue