feat(pipeline): add credentials support for semantic release in SemanticReleasingExecutor
Signed-off-by: 孙振宇 <>
This commit is contained in:
parent
80dd57433c
commit
d8f04dda6d
@ -19,11 +19,13 @@ class SemanticReleasingExecutor {
|
|||||||
this.config = 'com/freeleaps/devops/builtins/semantic-release/releaserc.json'
|
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.warn("SemanticReleasingExecutor", "Configuration file customization is not supported yet, using builtin release rules as fallback")
|
||||||
steps.log.info("SemanticReleasingExecutor", "Releasing with config: ${config}")
|
steps.log.info("SemanticReleasingExecutor", "Releasing with config: ${config}")
|
||||||
|
|
||||||
steps.dir(steps.env.workroot) {
|
steps.dir(steps.env.workroot) {
|
||||||
|
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.writeFile file: 'releaserc.json', text: steps.libraryResource(config)
|
||||||
steps.log.info("SemanticReleasingExecutor", "Installing semantic-release requirements...")
|
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.sh "apt-get -y update && apt-get install -y --no-install-recommends git apt-transport-https ca-certificates curl wget gnupg"
|
||||||
@ -35,3 +37,4 @@ class SemanticReleasingExecutor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@ -265,7 +265,7 @@ def generateComponentStages(component, configurations) {
|
|||||||
def sourceFetcher = new SourceFetcher(this)
|
def sourceFetcher = new SourceFetcher(this)
|
||||||
sourceFetcher.fetch(configurations)
|
sourceFetcher.fetch(configurations)
|
||||||
|
|
||||||
def semanticReleasingExecutor = new SemanticReleasingExecutor(this, env.workroot + "/" + component.root + "/")
|
def semanticReleasingExecutor = new SemanticReleasingExecutor(this, env.workroot)
|
||||||
semanticReleasingExecutor.release()
|
semanticReleasingExecutor.release()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user