Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
V
VIPSCore
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VIPS
VIPSCore
Commits
3db297b1
Commit
3db297b1
authored
1 year ago
by
Lene Wasskog
Browse files
Options
Downloads
Patches
Plain Diff
build: Set up ci/cd jobs for deploy of snapshot and release
parent
7d1b2663
No related branches found
No related tags found
1 merge request
!7
Gnuaffero
Pipeline
#2171
failed
1 year ago
Stage: build
Stage: test
Stage: deploy
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
.gitlab-ci.yml
+63
-5
63 additions, 5 deletions
.gitlab-ci.yml
with
63 additions
and
5 deletions
.gitlab-ci.yml
+
63
−
5
View file @
3db297b1
...
@@ -9,7 +9,7 @@ variables:
...
@@ -9,7 +9,7 @@ variables:
COMMON_CONFIG_LOCAL
:
"
vips-common-config"
COMMON_CONFIG_LOCAL
:
"
vips-common-config"
SETTINGS_XML
:
"
ci_settings.xml"
SETTINGS_XML
:
"
ci_settings.xml"
POM_WITH_MODELS
:
"
pom_with_models.xml"
POM_WITH_MODELS
:
"
pom_with_models.xml"
MAVEN_CLI_OPTS
:
"
-s
$SETTINGS_XML
--batch-mode"
MAVEN_CLI_OPTS
:
"
-s
$SETTINGS_XML
-f
$POM_WITH_MODELS
--batch-mode"
MAVEN_OPTS
:
"
-Dmaven.repo.local=.m2/repository
-Dmaven.artifact.threads=10"
MAVEN_OPTS
:
"
-Dmaven.repo.local=.m2/repository
-Dmaven.artifact.threads=10"
MAIN_BRANCH
:
"
main"
MAIN_BRANCH
:
"
main"
RELEASE_BRANCH
:
"
release"
RELEASE_BRANCH
:
"
release"
...
@@ -33,20 +33,78 @@ before_script:
...
@@ -33,20 +33,78 @@ before_script:
build
:
build
:
stage
:
build
stage
:
build
script
:
script
:
-
'
./mvnw
-f
$POM_WITH_MODELS
$MAVEN_CLI_OPTS
$MAVEN_OPTS
package'
-
'
./mvnw
$MAVEN_CLI_OPTS
$MAVEN_OPTS
package
-DskipTests
'
tags
:
tags
:
-
vips-java
-
vips-java
test
:
test
:
stage
:
test
stage
:
test
script
:
script
:
-
'
./mvnw
-f
$POM_WITH_MODELS
$MAVEN_CLI_OPTS
$MAVEN_OPTS
test'
-
'
./mvnw
$MAVEN_CLI_OPTS
$MAVEN_OPTS
test'
tags
:
tags
:
-
vips-java
-
vips-java
deploy-snapshot
:
deploy-snapshot
:
stage
:
deploy
stage
:
deploy
script
:
script
:
-
'
./mvnw
-f
$POM_WITH_MODELS
$MAVEN_CLI_OPTS
$MAVEN_OPTS
deploy'
-
export VERSION=$(./mvnw $MAVEN_CLI_OPTS $MAVEN_OPTS --batch-mode --no-transfer-progress --non-recursive help:evaluate -Dexpression=project.version | grep -v "\[.*")
-
if ! [[ $VERSION =~ .*SNAPSHOT ]]; then
echo "Version '$VERSION' is not SNAPSHOT"; exit 1;
fi
-
'
./mvnw
$MAVEN_CLI_OPTS
$MAVEN_OPTS
deploy
-DskipTests'
tags
:
tags
:
-
vips-java
-
vips-java
\ No newline at end of file
rules
:
-
if
:
'
$CI_COMMIT_REF_NAME
==
$MAIN_BRANCH'
deploy-release
:
stage
:
deploy
script
:
# Use access token given by CI/CD variable ACCESS_TOKEN to authenticate
-
&authenticate
-
export NEW_REPO_URL=https://root:$ACCESS_TOKEN@$CI_SERVER_HOST/$CI_PROJECT_PATH.git
-
git remote set-url --push origin $NEW_REPO_URL
-
git fetch origin --prune --prune-tags
# Checkout release branch
-
&checkout_release
-
git stash -a
-
git checkout $RELEASE_BRANCH
-
git reset --hard origin/$RELEASE_BRANCH
-
git stash pop
# Set release version and deploy. Commit, tag and push.
-
&release_and_tag
-
'
./mvnw
$MAVEN_CLI_OPTS
$MAVEN_OPTS
validate
-DremoveSnapshot'
-
export RELEASE_VERSION=$(./mvnw $MAVEN_CLI_OPTS $MAVEN_OPTS --batch-mode --no-transfer-progress --non-recursive help:evaluate -Dexpression=project.version | grep -v "\[.*")
-
export RELEASE_TAG="v${RELEASE_VERSION}"
-
export EXISTING_TAGS=$(git ls-remote --tags origin | cut -f 2 | grep "refs/tags/$RELEASE_TAG$")
-
if [ -n "$EXISTING_TAGS" ]; then
echo "Tag $RELEASE_TAG already exists"; exit 1;
fi
-
'
./mvnw
$MAVEN_CLI_OPTS
$MAVEN_OPTS
deploy
-DskipTests'
-
git add pom.xml
-
git commit -m "[ci skip] Set release version ${RELEASE_VERSION}"
-
git tag -a $RELEASE_TAG -m "Tag release ${RELEASE_TAG}"
-
git push origin $RELEASE_TAG
-
git push origin $RELEASE_BRANCH
# Checkout main branch
-
&checkout_main
-
git stash -a
-
git checkout $MAIN_BRANCH
-
git reset --hard origin/$MAIN_BRANCH
-
git stash pop
# Merge release branch, bump patch version, push commits.
-
&merge_and_bump
-
git merge -m "[ci skip] Merge branch '${RELEASE_BRANCH}' into ${MAIN_BRANCH}" --no-ff $RELEASE_BRANCH
-
'
./mvnw
$MAVEN_CLI_OPTS
$MAVEN_OPTS
validate
-DbumpPatch'
-
export SNAPSHOT_VERSION=$(./mvnw $MAVEN_CLI_OPTS $MAVEN_OPTS --batch-mode --no-transfer-progress --non-recursive help:evaluate -Dexpression=project.version | grep -v "\[.*")
-
git add pom.xml
-
git commit -m "[ci skip] Set snapshot version ${SNAPSHOT_VERSION}"
-
git push origin $MAIN_BRANCH
tags
:
-
vips-java
rules
:
-
if
:
'
$CI_COMMIT_REF_NAME
==
$RELEASE_BRANCH'
\ No newline at end of file
This diff is collapsed.
Click to expand it.
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