feat(ci): enhance debug output in SemanticReleasingExecutor by adding user context

Signed-off-by: zhenyus <zhenyus@mathmast.com>
This commit is contained in:
zhenyus 2025-03-06 17:42:35 +08:00
parent 540161eac0
commit af9d31c028
3 changed files with 13 additions and 5 deletions

View File

@ -46,6 +46,8 @@ class ArgoApplicationVersionUpdater {
// echo "Done."
// """
steps.sh """
#!/bin/bash
echo "Set ${workspace} as a safe directory..."
git config --global --add safe.directory ${workspace}

View File

@ -30,7 +30,11 @@ class CommitMessageLinter {
steps.dir(steps.env.workroot) {
// commit lint cli requires a git repository to lint commit messages, so we need make sure the workspace is a trusted git repository
steps.sh "git config --global --add safe.directory ${steps.env.workroot}"
steps.sh "commitlint --verbose -g ${rules} -f HEAD^"
steps.sh """
#!/bin/bash
commitlint --verbose -g ${rules} -f HEAD^
"""
}
}
}

View File

@ -26,15 +26,17 @@ class SemanticReleasingExecutor {
steps.dir(steps.env.workroot) {
steps.withCredentials([steps.usernamePassword(credentialsId: credentialsId, passwordVariable: 'GIT_PASSWORD', usernameVariable: 'GIT_USERNAME')]) {
steps.env.GIT_CREDENTIALS = "${steps.env.GIT_USERNAME}:${steps.env.GIT_PASSWORD}"
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.writeFile file: '.releaserc.json', text: steps.libraryResource(config)
steps.log.info("SemanticReleasingExecutor", "Installing semantic-release plugins...")
// steps.log.info("SemanticReleasingExecutor", "Installing semantic-release plugins...")
// steps.sh "npm install -g ${plugins.join(' ')}"
steps.sh "git config --global --add safe.directory ${steps.env.workroot}"
steps.env.GIT_LOCAL_BRANCH = "${branch}"
steps.sh "whoami && whereis semantic-release"
steps.sh "semantic-release --debug"
steps.sh """
#!/bin/bash
semantic-release
"""
steps.log.info("SemanticReleasingExecutor", "Semantic release completed, read latest version from VERSION file")
def released = steps.sh(script: 'test -f "VERSION"', returnStatus: true) == 0
if (released) {