diff --git a/Jenkinsfile b/Jenkinsfile index bddce1c..f5c912c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -99,7 +99,7 @@ pipeline { stage("Prepare") { steps { - script{ + script { if (_bFullRebuilt) { // start by cleaning the workspace (not using cleanWs() because we want to keep the directory itself) // => this is needed to fetch it again with custom options @@ -108,8 +108,7 @@ pipeline { else { sh("find ~/. -name . ! -path './TEST_ENV/*' ! -path './BUILD_ENV/*' -o -prune -exec rm -rf -- {} +") } - if(_GIT_BRANCH!="master") - { + if(_GIT_BRANCH!="master") { _bPreRelease = true } } @@ -138,7 +137,7 @@ pipeline { } } - + stage("GetCode") { steps { dir("gitrepo") { @@ -148,7 +147,7 @@ pipeline { branches: [[name: GIT_BRANCH]], extensions: [[$class: "CloneOption", noTags: false, shallow: false, depth: 0, reference: '']], userRemoteConfigs: [[credentialsId: _SCMCredentials, url: GIT_URL]]]) - script{ + script { withCredentials([usernamePassword(credentialsId: _SCMCredentials, passwordVariable: 'GIT_PASSWORD', usernameVariable: 'GIT_USERNAME')]) { sh("git remote set-url origin https://${GIT_USERNAME}:${GIT_PASSWORD}@chacha.ddns.net/gitea/${_PROJECT_USER_NAME}/${_PROJECT_NAME}.git") @@ -174,10 +173,8 @@ pipeline { |__EOWRAPPER__ """.stripMargin()) - if(_GIT_BRANCH=="master") - { - if(sh(returnStdout: true, script: "git tag --points-at HEAD").trim().isEmpty()) - { + if(_GIT_BRANCH=="master") { + if(sh(returnStdout: true, script: "git tag --points-at HEAD").trim().isEmpty()) { BUMPED_VERSION = sh(script: """#!/bin/sh - |. ~/TOOLS_ENV/bin/activate |exec python - << '__EOWRAPPER__' @@ -194,13 +191,11 @@ pipeline { |__EOWRAPPER__ """.stripMargin(), returnStdout: true).trim() - if(BUMPED_VERSION.isEmpty()) - { + if(BUMPED_VERSION.isEmpty()) { echo "master push/merge must have an explicit tag release number, stopping pipeline" currentBuild.getRawBuild().getExecutor().doStop() } - else - { + else { echo "new-tag requested in commit message: $BUMPED_VERSION" sh("git tag $BUMPED_VERSION") @@ -255,16 +250,14 @@ pipeline { // Manually pushing a new tag with version string guessed by gitversionhelper // because setuptools-git-versioning cant fing tag on other branches, so will guess a wring version without this tag. - if(latestTag!=PY_PROJECT_VERSION) - { + if(latestTag!=PY_PROJECT_VERSION) { sh("git tag $PY_PROJECT_VERSION") sh("git push origin --tags") } // specific handling to test the template itself // => little hacky... creating a new git repo with a commit/tag corresponding to HEAD of the official one - if(_PROJECT_NAME=="pyChaChaDummyProject") //specific case to test the template itself - { + if(_PROJECT_NAME=="pyChaChaDummyProject") { //specific case to test the template itself sh("rm -Rf ~/_gitrepo || true") sh(script: """#!/bin/sh - @@ -325,7 +318,7 @@ pipeline { steps { // no need for a build-env: setuptools is already creating one dir("gitrepo") { - script{ + script { // actually doing the package build sh(". ~/BUILD_ENV/bin/activate && python -m build .") } @@ -354,16 +347,16 @@ pipeline { } } post { - always { - dir("gitrepo") { - publishHTML([ - reportDir: "helpers-results/quality_check", - reportFiles: "report.html", - reportName: "quality-report", - allowMissing: false, - alwaysLinkToLastBuild: true, - keepAll: true]) - } + always { + dir("gitrepo") { + publishHTML([ + reportDir: "helpers-results/quality_check", + reportFiles: "report.html", + reportName: "quality-report", + allowMissing: false, + alwaysLinkToLastBuild: true, + keepAll: true]) + } } } } @@ -476,8 +469,7 @@ pipeline { dir("gitrepo") { script { def CurrentDateTime=java.time.LocalDateTime.now() - withCredentials([string( credentialsId: _MkDocsWebCredentials,variable: 'MKDOCSTOKEN' )]) - { + withCredentials([string( credentialsId: _MkDocsWebCredentials,variable: 'MKDOCSTOKEN' )]) { sh(script: """#!/bin/sh - |. ~/TOOLS_ENV/bin/activate |exec python - << '__EOWRAPPER__'