Configurer nom et adresse de l’utilisateur pour les interactions avec les dépôts git

This commit is contained in:
Benjamin Bohard 2022-09-26 08:44:28 +02:00
parent bf7e3cf9b9
commit 8f33a8a4c9
1 changed files with 13 additions and 0 deletions

View File

@ -1,6 +1,8 @@
// Pipeline de construction des images Docker des services Zéphir // Pipeline de construction des images Docker des services Zéphir
def call() { def call() {
def buildTag def buildTag
def gitEmail = params.gitEmail ? params.gitEmail : 'jenkins@cadoles.com'
def gitUsername = params.gitUsername ? params.gitUsername : 'Jenkins'
pipeline { pipeline {
@ -106,6 +108,9 @@ def call() {
def projectName = env.project_name def projectName = env.project_name
def destFolder = "${projectName}/${docProfile}" def destFolder = "${projectName}/${docProfile}"
def result = tamarin.compileDoc(env.buildProfile) def result = tamarin.compileDoc(env.buildProfile)
if(result.size() == 0) {
error('No artefact produced')
}
println(result) println(result)
if(docProfile != 'draft') { if(docProfile != 'draft') {
def publicFolder = "${destFolder}/latest/public" def publicFolder = "${destFolder}/latest/public"
@ -160,6 +165,10 @@ def call() {
sh(script: "chmod +x ./sshForJenkins.sh") sh(script: "chmod +x ./sshForJenkins.sh")
if (docProfile != 'draft') { if (docProfile != 'draft') {
withEnv(["GIT_SSH=./sshForJenkins.sh"]) { withEnv(["GIT_SSH=./sshForJenkins.sh"]) {
// Add git username/email
sh("git config user.email '${gitEmail}'")
sh("git config user.username '${gitUsername}'")
sh """ sh """
git tag -am "paquet" release/v${dateTag} git tag -am "paquet" release/v${dateTag}
""" """
@ -169,6 +178,10 @@ def call() {
} }
} }
withEnv(["GIT_SSH=./sshForJenkins.sh"]) { withEnv(["GIT_SSH=./sshForJenkins.sh"]) {
// Add git username/email
sh("git config user.email '${gitEmail}'")
sh("git config user.username '${gitUsername}'")
sh """ sh """
git tag -d ${env.ref} git tag -d ${env.ref}
git push origin :${env.ref} git push origin :${env.ref}