Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Maven
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SmartDataLab
public
CI-CD components
Maven
Commits
58320afa
Commit
58320afa
authored
1 year ago
by
Pierre Smeyers
Browse files
Options
Downloads
Patches
Plain Diff
fix(release): fix and clarify Git config in release process
parent
23d2be3f
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
templates/gitlab-ci-maven.yml
+6
-7
6 additions, 7 deletions
templates/gitlab-ci-maven.yml
with
6 additions
and
7 deletions
templates/gitlab-ci-maven.yml
+
6
−
7
View file @
58320afa
...
...
@@ -175,6 +175,10 @@ stages:
}
function configure_scm_auth() {
log_info "Preparing Git repository for release..."
# set user info
git config --global user.email "${GITLAB_USER_EMAIL}"
git config --global user.name "${GITLAB_USER_NAME}"
# shellcheck disable=SC2086
scm_url=$(mvn $MAVEN_CLI_OPTS $mvn_settings_opt $java_proxy_args org.apache.maven.plugins:maven-help-plugin:3.2.0:evaluate -Dexpression=project.scm.developerConnection -q -DforceStdout | tail -n 1)
if [[ $scm_url == "scm:git:https"* ]]; then
...
...
@@ -198,8 +202,6 @@ stages:
else
echo "${GIT_PRIVATE_KEY}" | tr -d '\r' | ssh-add -
fi
git config --global user.email "${GITLAB_USER_EMAIL}"
git config --global user.name "${GITLAB_USER_LOGIN}"
else
log_error "--- project scm.developerConnection is using SSH protocol but no SSH key configured."
log_error "--- Please either specify the \$GIT_PRIVATE_KEY variable or change to https protocol with username/password credentials."
...
...
@@ -559,9 +561,6 @@ mvn-release:
stage
:
publish
before_script
:
-
!reference
[
.mvn-base
,
before_script
]
-
log_info "Preparing Git repository for release..."
-
git config --global user.name $GITLAB_USER_ID
-
git config --global user.email $GITLAB_USER_EMAIL
-
git checkout -B "$CI_COMMIT_REF_NAME"
script
:
-
configure_scm_auth
...
...
@@ -571,10 +570,10 @@ mvn-release:
then
if [ -z "${SEMREL_INFO_NEXT_VERSION}" ]
then
log_info "
n
o ne
w version to release
"
log_info "
N
o ne
xt release version determined by semantic-release info: skip
"
exit 0
else
log_info "se
mantic-
release
info is activated, using computed next version for
release \\e[1;94m${SEMREL_INFO_NEXT_VERSION}\\e[0m"
log_info "
U
se
next
release
version determined by semantic-
release
info:
\\e[1;94m${SEMREL_INFO_NEXT_VERSION}\\e[0m"
semrel_args="-DreleaseVersion=${SEMREL_INFO_NEXT_VERSION}"
fi
fi
...
...
This diff is collapsed.
Click to expand it.
Benguria Elguezabal, Gorka
@gorka.benguria
mentioned in commit
36054c44
·
9 months ago
mentioned in commit
36054c44
mentioned in commit 36054c4413a9b57d2607cd55a294ac5f9a68657b
Toggle commit list
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment