neutral-old/Jenkinsfile

74 lines
2.4 KiB
Plaintext
Raw Normal View History

2023-03-18 18:20:17 +01:00
pipeline {
agent any
stages {
2023-03-19 18:18:36 +01:00
stage('[Neutral] - Check Version') {
steps {
script {
2023-03-19 18:26:01 +01:00
def commit_name = env.TAG_NAME
if(commit_name) {
2023-03-19 18:18:36 +01:00
echo "[Neutral] - Deployement version reconnu"
} else {
currentBuild.result = 'ABORTED'
2023-03-19 18:26:54 +01:00
echo "[Neutral] - Deployement version non reconnu"
2023-03-19 18:18:36 +01:00
return
}
}
}
}
stage('[Neutral] - Test') {
2023-03-18 22:47:09 +01:00
steps {
2023-03-19 18:28:30 +01:00
script {
def commit_name = env.TAG_NAME
if(commit_name) {
echo "[Neutral] - Deployement version reconnu"
} else {
currentBuild.result = 'ABORTED'
echo "[Neutral] - Deployement version non reconnu"
return
}
2023-03-19 18:29:18 +01:00
echo "[Neutral-Deploy] - Test Stage"
sh "rm -rf neutral"
sh "git clone https://git.raphix.fr/infrastructure/neutral.git"
sh "cd neutral"
sh "npm i"
sh "ENV='TEST' node bin/www"
2023-03-19 18:28:30 +01:00
}
2023-03-19 18:29:18 +01:00
2023-03-19 17:55:09 +01:00
2023-03-18 18:20:17 +01:00
}
2023-03-18 22:57:04 +01:00
}
2023-03-19 18:18:36 +01:00
stage('[Neutral] - Déploiement') {
2023-03-18 18:20:17 +01:00
steps {
2023-03-19 17:56:35 +01:00
script {
2023-03-19 18:28:30 +01:00
2023-03-19 18:32:20 +01:00
2023-03-19 18:28:30 +01:00
def commit_name = env.TAG_NAME
if(commit_name) {
echo "[Neutral] - Deployement version reconnu"
} else {
currentBuild.result = 'ABORTED'
echo "[Neutral] - Deployement version non reconnu"
return
}
2023-03-19 18:03:57 +01:00
def doesJavaRock = input(message: 'Confirmation de Déploiement', ok: 'Déployer')
2023-03-19 18:02:41 +01:00
echo "[Neutral-Deploy] - Deploy Stage"
sh "ssh raphix@raphix.fr sudo apt update -y"
sh "ssh raphix@raphix.fr sudo apt upgrade -y"
sh "ssh raphix@raphix.fr sudo -S -u gitlab-ci /home/gitlab-ci/neutral_deploy.sh"
2023-03-19 17:56:35 +01:00
}
2023-03-19 18:00:57 +01:00
2023-03-18 18:20:17 +01:00
}
}
}
}