diff --git a/first-class-pipeline/src/com/freeleaps/devops/SemanticReleasingExecutor.groovy b/first-class-pipeline/src/com/freeleaps/devops/SemanticReleasingExecutor.groovy index e9f81197..89bcd8ed 100644 --- a/first-class-pipeline/src/com/freeleaps/devops/SemanticReleasingExecutor.groovy +++ b/first-class-pipeline/src/com/freeleaps/devops/SemanticReleasingExecutor.groovy @@ -19,19 +19,22 @@ class SemanticReleasingExecutor { this.config = 'com/freeleaps/devops/builtins/semantic-release/releaserc.json' } - def release() { + def release(credentialsId) { steps.log.warn("SemanticReleasingExecutor", "Configuration file customization is not supported yet, using builtin release rules as fallback") steps.log.info("SemanticReleasingExecutor", "Releasing with config: ${config}") steps.dir(steps.env.workroot) { - steps.writeFile file: 'releaserc.json', text: steps.libraryResource(config) - steps.log.info("SemanticReleasingExecutor", "Installing semantic-release requirements...") - steps.sh "apt-get -y update && apt-get install -y --no-install-recommends git apt-transport-https ca-certificates curl wget gnupg" - steps.log.info("SemanticReleasingExecutor", "Installing semantic-release plugins...") - steps.sh "npm install -g ${plugins.join(' ')}" - steps.sh "semantic-release" - steps.log.info("SemanticReleasingExecutor", "Semantic release completed, read latest version from VERSION file") - steps.env.LATEST_VERSION = steps.readFile('VERSION').trim() + steps.withCredentials(credentialsId: credentialsId, passwordVariable: 'GIT_PASSWORD', usernameVariable: 'GIT_USERNAME') { + steps.env.GIT_CREDENTIALS = "${steps.env.GIT_USERNAME}:${steps.env.GIT_PASSWORD}" + steps.writeFile file: 'releaserc.json', text: steps.libraryResource(config) + steps.log.info("SemanticReleasingExecutor", "Installing semantic-release requirements...") + steps.sh "apt-get -y update && apt-get install -y --no-install-recommends git apt-transport-https ca-certificates curl wget gnupg" + steps.log.info("SemanticReleasingExecutor", "Installing semantic-release plugins...") + steps.sh "npm install -g ${plugins.join(' ')}" + steps.sh "semantic-release" + steps.log.info("SemanticReleasingExecutor", "Semantic release completed, read latest version from VERSION file") + steps.env.LATEST_VERSION = steps.readFile('VERSION').trim() + } } } } \ No newline at end of file diff --git a/first-class-pipeline/vars/executeFreeleapsPipeline.groovy b/first-class-pipeline/vars/executeFreeleapsPipeline.groovy index 69355ebb..1c7616f0 100644 --- a/first-class-pipeline/vars/executeFreeleapsPipeline.groovy +++ b/first-class-pipeline/vars/executeFreeleapsPipeline.groovy @@ -265,7 +265,7 @@ def generateComponentStages(component, configurations) { def sourceFetcher = new SourceFetcher(this) sourceFetcher.fetch(configurations) - def semanticReleasingExecutor = new SemanticReleasingExecutor(this, env.workroot + "/" + component.root + "/") + def semanticReleasingExecutor = new SemanticReleasingExecutor(this, env.workroot) semanticReleasingExecutor.release() } }