gitignore
Some checks failed
gitea.arg.rip/_template-service/pipeline/head There was a failure building this commit

This commit is contained in:
adam 2024-12-13 16:51:18 -05:00
parent 063a8fd945
commit 7875b9ecb8
2 changed files with 16 additions and 16 deletions

2
.gitignore vendored
View File

@ -1,3 +1,5 @@
appsettings.json
# ---> VisualStudio # ---> VisualStudio
## Ignore Visual Studio temporary files, build results, and ## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons. ## files generated by popular Visual Studio add-ons.

30
Jenkinsfile vendored
View File

@ -2,6 +2,7 @@ pipeline {
agent any agent any
environment { environment {
linuxServiceAccount=creds linuxServiceAccount=creds
linuxServiceAccountID=string
productiondatabase_connectionString=creds productiondatabase_connectionString=creds
targetHost=string targetHost=string
} }
@ -28,7 +29,7 @@ pipeline {
branch "release" branch "release"
} }
steps{ steps{
withCredentials([sshUserPrivateKey(credentialsId: env.linuxServiceAccount, keyFileVariable: 'PK')]) withCredentials([sshUserPrivateKey(credentialsId: env.linuxServiceAccountID, keyFileVariable: 'PK')])
{ {
sh """#!/bin/bash sh """#!/bin/bash
ssh -i \"${PK}\" -tt ${linuxServiceAccount_USR}@${targetHost} 'rm -rf temp_deploy & mkdir -p temp_deploy' ssh -i \"${PK}\" -tt ${linuxServiceAccount_USR}@${targetHost} 'rm -rf temp_deploy & mkdir -p temp_deploy'
@ -43,7 +44,7 @@ pipeline {
branch "release" branch "release"
} }
steps{ steps{
withCredentials([sshUserPrivateKey(credentialsId: env.linuxServiceAccount, keyFileVariable: 'PK')]) withCredentials([sshUserPrivateKey(credentialsId: env.linuxServiceAccountID, keyFileVariable: 'PK')])
{ {
sh """#!/bin/bash sh """#!/bin/bash
ssh -i \"${PK}\" -tt ${linuxServiceAccount_USR}@${targetHost} 'systemctl --user stop $REPO_NAME' ssh -i \"${PK}\" -tt ${linuxServiceAccount_USR}@${targetHost} 'systemctl --user stop $REPO_NAME'
@ -51,24 +52,21 @@ pipeline {
} }
} }
} }
stage ('backup db')
{
when {
branch "release"
}
steps{
//TODO: backup database
sh """#!/bin/bash
"""
}
}
stage ('update db') stage ('update db')
{ {
when { when {
branch "release" branch "release"
} }
steps{ steps{
//TODO: update database //TODO: backup database
sh """#!/bin/bash
"""
sh """#!/bin/bash
pushd dist
dotnet ef database update --connection "${env.productiondatabase_connectionString}"
popd
"""
//TODO: if updating the db fails, restore the old one //TODO: if updating the db fails, restore the old one
sh """#!/bin/bash sh """#!/bin/bash
""" """
@ -80,7 +78,7 @@ pipeline {
branch "release" branch "release"
} }
steps{ steps{
withCredentials([sshUserPrivateKey(credentialsId: env.linuxServiceAccount, keyFileVariable: 'PK')]) withCredentials([sshUserPrivateKey(credentialsId: env.linuxServiceAccountID, keyFileVariable: 'PK')])
{ {
sh """#!/bin/bash sh """#!/bin/bash
ssh -i \"${PK}\" -tt ${linuxServiceAccount_USR}@${targetHost} 'rm -rf dist/ && mv temp_deploy/ dist/' ssh -i \"${PK}\" -tt ${linuxServiceAccount_USR}@${targetHost} 'rm -rf dist/ && mv temp_deploy/ dist/'
@ -94,7 +92,7 @@ pipeline {
branch "release" branch "release"
} }
steps{ steps{
withCredentials([sshUserPrivateKey(credentialsId: env.linuxServiceAccount, keyFileVariable: 'PK')]) withCredentials([sshUserPrivateKey(credentialsId: env.linuxServiceAccountID, keyFileVariable: 'PK')])
{ {
sh """#!/bin/bash sh """#!/bin/bash
ssh -i \"${PK}\" -tt ${linuxServiceAccount_USR}@${targetHost} 'systemctl --user start $REPO_NAME' ssh -i \"${PK}\" -tt ${linuxServiceAccount_USR}@${targetHost} 'systemctl --user start $REPO_NAME'