Skip to content
Snippets Groups Projects
Commit 5059f42e authored by Lene Wasskog's avatar Lene Wasskog
Browse files

build: Attempt to include external gitlab-ci config

Fetched from repo vips-common-config
parent c199c7be
No related branches found
No related tags found
No related merge requests found
Pipeline #1323 passed
image: openjdk:11-jdk include:
stages: - project: 'VIPS/vips-common-config'
- build file: '/gitlab-ci-vips-models.yml'
- test ref: main
- deploy
variables:
MAVEN_CLI_OPTS: "-s ci_settings.xml --batch-mode"
MAVEN_OPTS: "-Dmaven.repo.local=.m2/repository -Dmaven.artifact.threads=10"
MAIN_BRANCH: "main"
RELEASE_BRANCH: "release"
cache:
paths:
- .m2/repository/
build:
stage: build
script:
- env
- ./mvnw $MAVEN_CLI_OPTS $MAVEN_OPTS package
tags:
- vips-java
rules:
- if: '$CI_PIPELINE_SOURCE != "trigger"'
test:
stage: test
script:
- ./mvnw $MAVEN_CLI_OPTS $MAVEN_OPTS test
tags:
- vips-java
rules:
- if: '$CI_PIPELINE_SOURCE != "trigger"'
deploy-snapshot:
stage: deploy
script:
- export VERSION=$(./mvnw --batch-mode --no-transfer-progress --non-recursive help:evaluate -Dexpression=project.version | grep -v "\[.*")
- if ! [[ $VERSION =~ .*SNAPSHOT ]]; then exit 1; fi
- ./mvnw $MAVEN_CLI_OPTS $MAVEN_OPTS deploy -DskipTests
tags:
- vips-java
rules:
- if: '$CI_PIPELINE_SOURCE != "trigger" && $CI_COMMIT_REF_NAME == $MAIN_BRANCH'
deploy-release:
stage: deploy
script:
# For debugging git interaction
#- export GIT_TRACING=2
#- export GIT_CURL_VERBOSE=1
- git config --global user.name "${GITLAB_USER_NAME}"
- git config --global user.email "${GITLAB_USER_EMAIL}"
# Use access token given by CI/CD variable ACCESS_TOKEN to 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, set release version and deploy. Commit, tag and push.
- git checkout $RELEASE_BRANCH
- git status
- git reset --hard origin/$RELEASE_BRANCH
- ./mvnw $MAVEN_CLI_OPTS $MAVEN_OPTS validate -DremoveSnapshot
- ./mvnw $MAVEN_CLI_OPTS $MAVEN_OPTS deploy -DskipTests
- export RELEASE_VERSION=$(./mvnw --batch-mode --no-transfer-progress --non-recursive help:evaluate -Dexpression=project.version | grep -v "\[.*")
- export RELEASE_TAG="v${RELEASE_VERSION}"
- 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, merge release branch. Push commit.
- git fetch
- git checkout $MAIN_BRANCH
- git reset --hard origin/$MAIN_BRANCH
- git merge -m "[ci skip] Merge ${RELEASE_BRANCH}" --no-ff $RELEASE_BRANCH
- git push origin $MAIN_BRANCH
tags:
- vips-java
rules:
- if: '$CI_PIPELINE_SOURCE != "trigger" && $CI_COMMIT_REF_NAME == $RELEASE_BRANCH'
# This job is triggered by the VIPSCommon pipeline, and builds the model with the given version of VIPSCommon
test_after_vips_common_changes:
stage: test
script:
- echo $VERSION
- ./mvnw versions:use-dep-version -Dincludes=no.nibio.vips:VIPSCommon -DdepVersion=$VERSION -DforceVersion=true
- echo "Build model with no.nibio.vips:VIPSCommon:${VERSION}"
- ./mvnw $MAVEN_CLI_OPTS $MAVEN_OPTS package
tags:
- vips-java
rules:
- if: '$CI_PIPELINE_SOURCE == "trigger"'
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment