more elaboration, still full of todo's
Some checks failed
gitea.arg.rip/_template-service/pipeline/head There was a failure building this commit
Some checks failed
gitea.arg.rip/_template-service/pipeline/head There was a failure building this commit
This commit is contained in:
parent
5e0cd5e63a
commit
50842128ad
69
Jenkinsfile
vendored
69
Jenkinsfile
vendored
@ -1,11 +1,70 @@
|
|||||||
pipeline {
|
pipeline {
|
||||||
agent any
|
agent any
|
||||||
stages {
|
stages {
|
||||||
stage (‘Deploy’) {
|
stage('build'){
|
||||||
sh ‘ssh user@server rm -rf temp_deploy’
|
//TODO: dotnet build
|
||||||
sh ‘ssh user@server mkdir -p temp_deploy’
|
}
|
||||||
sh ‘scp -r dist user@server:temp_deploy’
|
stage('test'){
|
||||||
sh ‘ssh user@server “rm -rf dist/ && mv temp_deploy/ dist/”’
|
//TODO: run tests
|
||||||
|
//TODO: publish tests in some nicely readable format
|
||||||
|
}
|
||||||
|
stage ('upload') {
|
||||||
|
when {
|
||||||
|
//now my CI/CD is no longer continuous, it's just... automatic.
|
||||||
|
//(which is what I actually want tbh)
|
||||||
|
//but that does mean I have to put this condition in every single branch
|
||||||
|
branch "release"
|
||||||
|
}
|
||||||
|
steps{
|
||||||
|
sh 'ssh user@server rm -rf temp_deploy'
|
||||||
|
sh 'ssh user@server mkdir -p temp_deploy'
|
||||||
|
sh 'scp -r dist user@server:temp_deploy'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage ('stop')
|
||||||
|
{
|
||||||
|
when {
|
||||||
|
branch "release"
|
||||||
|
}
|
||||||
|
script{
|
||||||
|
//user is the service user
|
||||||
|
ssh user@host 'bash -s' << 'ENDSSH'
|
||||||
|
systemctl --user stop $svcname
|
||||||
|
ENDSSH
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage ('backup db')
|
||||||
|
{
|
||||||
|
when {
|
||||||
|
branch "release"
|
||||||
|
}
|
||||||
|
//TODO: backup database
|
||||||
|
}
|
||||||
|
stage ('update db')
|
||||||
|
{
|
||||||
|
when {
|
||||||
|
branch "release"
|
||||||
|
}
|
||||||
|
//TODO: update database
|
||||||
|
//TODO: if updating the db fails, restore the old one
|
||||||
|
}
|
||||||
|
stage ('replace')
|
||||||
|
{
|
||||||
|
when {
|
||||||
|
branch "release"
|
||||||
|
}
|
||||||
|
sh 'ssh user@server “rm -rf dist/ && mv temp_deploy/ dist/”'
|
||||||
|
}
|
||||||
|
stage ('spin up')
|
||||||
|
{
|
||||||
|
when {
|
||||||
|
branch "release"
|
||||||
|
}
|
||||||
|
script{
|
||||||
|
ssh user@host 'bash -s' << 'ENDSSH'
|
||||||
|
systemctl --user start $svcname
|
||||||
|
ENDSSH
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user