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
|
- test
|
||||||
- deploy
|
- deploy
|
||||||
|
|
||||||
|
# Update the flake for any changes upstream
|
||||||
# Passed in from upstream
|
# Passed in from upstream
|
||||||
# $PACKAGE_NAME = name of the flake that needs to be updated
|
# $PACKAGE_NAME = name of the flake that needs to be updated
|
||||||
# $UPDATE_FLAKE = flag to update the flake
|
# $UPDATE_FLAKE = flag to update the flake
|
||||||
|
|
||||||
update:
|
update:
|
||||||
stage: flake
|
stage: flake
|
||||||
# from https://forum.gitlab.com/t/git-push-from-inside-a-gitlab-runner/30554/5
|
# from https://forum.gitlab.com/t/git-push-from-inside-a-gitlab-runner/30554/5
|
||||||
before_script:
|
before_script:
|
||||||
#- 'which ssh-agent || ( apt-get update -qy && apt-get install openssh-client -qqy )'
|
|
||||||
- eval `ssh-agent -s`
|
- eval `ssh-agent -s`
|
||||||
# for the deploy
|
# set teh ssh key for the commit
|
||||||
- echo "${CI_KEY}" | tr -d '\r' | ssh-add - > /dev/null
|
- echo "${CI_KEY}" | tr -d '\r' | ssh-add - > /dev/null
|
||||||
- mkdir -p ~/.ssh
|
- mkdir -p ~/.ssh
|
||||||
- chmod 700 ~/.ssh
|
- chmod 700 ~/.ssh
|
||||||
|
@ -32,7 +31,6 @@ update:
|
||||||
# we have a custom domain
|
# we have a custom domain
|
||||||
- git remote rm origin && git remote add origin ssh://git@gitlab.skynet.ie:2222/compsoc/skynet/nixos.git
|
- 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
|
- git push origin HEAD:$CI_COMMIT_REF_NAME
|
||||||
|
|
||||||
only:
|
only:
|
||||||
refs:
|
refs:
|
||||||
- main
|
- main
|
||||||
|
@ -40,39 +38,26 @@ update:
|
||||||
- $UPDATE_FLAKE == "yes"
|
- $UPDATE_FLAKE == "yes"
|
||||||
|
|
||||||
build:
|
build:
|
||||||
# image: nixos/nix
|
|
||||||
stage: test
|
stage: test
|
||||||
before_script:
|
before_script:
|
||||||
- . "$HOME/.nix-profile/etc/profile.d/nix.sh"
|
- . "$HOME/.nix-profile/etc/profile.d/nix.sh"
|
||||||
script:
|
script:
|
||||||
- nix --experimental-features 'nix-command flakes' run nixpkgs#colmena -- build
|
- nix --experimental-features 'nix-command flakes' run nixpkgs#colmena -- build
|
||||||
|
|
||||||
# use ctrl+/ on intellij to mass uncoment
|
# every commit on main will build and deploy
|
||||||
# set up deployment later
|
|
||||||
deploy:
|
deploy:
|
||||||
stage: deploy
|
stage: deploy
|
||||||
# from https://forum.gitlab.com/t/git-push-from-inside-a-gitlab-runner/30554/5
|
|
||||||
before_script:
|
before_script:
|
||||||
# Check for ssh-agent + rsync and install if not present
|
# setup ssh key
|
||||||
#- '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
|
- echo "$DEPLOY_KEY" | tr -d '\r' | ssh-add - > /dev/null
|
||||||
- mkdir -p ~/.ssh
|
- mkdir -p ~/.ssh
|
||||||
- chmod 700 ~/.ssh
|
- chmod 700 ~/.ssh
|
||||||
# Append keyscan output into known hosts
|
# load nix environment
|
||||||
# - ssh-keyscan $SERVER_IP >> ~/.ssh/known_hosts
|
|
||||||
# - chmod 644 ~/.ssh/known_hosts
|
|
||||||
- . "$HOME/.nix-profile/etc/profile.d/nix.sh"
|
- . "$HOME/.nix-profile/etc/profile.d/nix.sh"
|
||||||
|
|
||||||
script:
|
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
|
- nix --experimental-features 'nix-command flakes' run nixpkgs#colmena -- apply --on @active-dns
|
||||||
#
|
- nix --experimental-features 'nix-command flakes' run nixpkgs#colmena -- apply --on @active
|
||||||
# only:
|
only:
|
||||||
# refs:
|
refs:
|
||||||
# - main
|
- main
|
||||||
|
|
||||||
|
|
||||||
# only run on $UPDATE_FLAKE
|
|
||||||
|
|
Loading…
Reference in a new issue