jenkinsfile hopefully more like the good working one in test236
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
more changes to come
This commit is contained in:
parent
cd1e610dd3
commit
47f7c9d2b1
54
Jenkinsfile
vendored
54
Jenkinsfile
vendored
@ -7,12 +7,18 @@ pipeline {
|
||||
}
|
||||
stages {
|
||||
stage('build'){
|
||||
steps{
|
||||
//"hey self, what if once in your life you try a *different* language?" "then i'll update this file, moai.emoji."
|
||||
dotnetBuild(outputDirectory: "./dist", project: "$REPO_NAME.csproj")
|
||||
}
|
||||
}
|
||||
stage('test'){
|
||||
steps{
|
||||
//TODO: run tests
|
||||
//TODO: publish tests in some nicely readable format
|
||||
sh """#!/bin/bash
|
||||
"""
|
||||
}
|
||||
}
|
||||
stage ('upload') {
|
||||
when {
|
||||
@ -22,13 +28,12 @@ pipeline {
|
||||
branch "release"
|
||||
}
|
||||
steps{
|
||||
sshagent([linuxServiceAccount])
|
||||
withCredentials([sshUserPrivateKey(credentialsId: env.linuxServiceAccount, keyFileVariable: 'PK')])
|
||||
{
|
||||
ssh ${env.targetHost} 'bash -s' << 'ENDSSH'
|
||||
rm -rf temp_deploy
|
||||
mkdir -p temp_deploy
|
||||
ENDSSH
|
||||
sh 'scp -r dist ${env.targetHost}:temp_deploy'
|
||||
sh """#!/bin/bash
|
||||
ssh -i \"${PK}\" -tt ${linuxServiceAccount_USR}@${targetHost} 'rm -rf temp_deploy & mkdir -p temp_deploy'
|
||||
scp -i \"${PK}\" -r dist ${linuxServiceAccount_USR}@${env.targetHost}:temp_deploy
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -38,16 +43,14 @@ pipeline {
|
||||
branch "release"
|
||||
}
|
||||
steps{
|
||||
script{
|
||||
sshagent([linuxServiceAccount]) {
|
||||
ssh ${env.targetHost} 'bash -s' << 'ENDSSH'
|
||||
systemctl --user stop $REPO_NAME
|
||||
ENDSSH
|
||||
withCredentials([sshUserPrivateKey(credentialsId: env.linuxServiceAccount, keyFileVariable: 'PK')])
|
||||
{
|
||||
sh """#!/bin/bash
|
||||
ssh -i \"${PK}\" -tt ${linuxServiceAccount_USR}@${targetHost} 'systemctl --user stop $REPO_NAME'
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
---dbstart---
|
||||
stage ('backup db')
|
||||
{
|
||||
when {
|
||||
@ -55,6 +58,8 @@ pipeline {
|
||||
}
|
||||
steps{
|
||||
//TODO: backup database
|
||||
sh """#!/bin/bash
|
||||
"""
|
||||
}
|
||||
}
|
||||
stage ('update db')
|
||||
@ -62,18 +67,24 @@ pipeline {
|
||||
when {
|
||||
branch "release"
|
||||
}
|
||||
steps{
|
||||
//TODO: update database
|
||||
//TODO: if updating the db fails, restore the old one
|
||||
sh """#!/bin/bash
|
||||
"""
|
||||
}
|
||||
}
|
||||
---dbend---
|
||||
stage ('replace')
|
||||
{
|
||||
when {
|
||||
branch "release"
|
||||
}
|
||||
steps{
|
||||
sshagent([linuxServiceAccount]) {
|
||||
ssh ${env.targetHost} "rm -rf dist/ && mv temp_deploy/ dist/"
|
||||
withCredentials([sshUserPrivateKey(credentialsId: env.linuxServiceAccount, keyFileVariable: 'PK')])
|
||||
{
|
||||
sh """#!/bin/bash
|
||||
ssh -i \"${PK}\" -tt ${linuxServiceAccount_USR}@${targetHost} 'rm -rf dist/ && mv temp_deploy/ dist/'
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -83,12 +94,11 @@ pipeline {
|
||||
branch "release"
|
||||
}
|
||||
steps{
|
||||
script{
|
||||
sshagent([linuxServiceAccount]) {
|
||||
ssh ${env.targetHost} 'bash -s' << 'ENDSSH'
|
||||
systemctl --user start $REPO_NAME
|
||||
ENDSSH
|
||||
}
|
||||
withCredentials([sshUserPrivateKey(credentialsId: env.linuxServiceAccount, keyFileVariable: 'PK')])
|
||||
{
|
||||
sh """#!/bin/bash
|
||||
ssh -i \"${PK}\" -tt ${linuxServiceAccount_USR}@${targetHost} 'systemctl --user start $REPO_NAME'
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user