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