Commit e7df7e28 authored by Thomas Beermann's avatar Thomas Beermann
Browse files

adapt pipeline for gitlab repository

parent b40ae6a0
Pipeline #85019 failed with stages
in 16 seconds
......@@ -6,8 +6,10 @@ stages:
variables:
MAVEN_OPTS: "-Dmaven.repo.local=.m2/repository"
DOCKER_IMAGE_TAGGED: helmholtzcloudserviceuser/marketplace:$CI_COMMIT_SHA
DOCKER_IMAGE_LATEST: helmholtzcloudserviceuser/marketplace:latest
DOCKER_REGISTRY: registry.hzdr.de
DOCKER_IMAGE_BASE: registry.hzdr.de/hifis-technical-platform/helmholtz-marketplace-server
WEBAPP_PROJECT_VERSION: "0.0.2-SNAPSHOT"
WEBAPP_PROJECT_BRANCH: ""
cache:
key: "$CI_COMMIT_REF_NAME"
......
default:
before_script:
- |
if [[ -n "$WEBAPP_BRANCH" ]]; then
WEBAPP_PROJECT_BRANCH=$WEBAPP_BRANCH
fi
if [[ -n "$WEBAPP_VERSION" ]]; then
WEBAPP_PROJECT_VERSION=$WEBAPP_VERSION
fi
build:
only:
- master
- merge_requests
- tags
stage: build
image: maven:3-jdk-11
script: mvn compile
......@@ -10,6 +21,7 @@ test:
only:
- master
- merge_requests
- tags
stage: test
image: maven:3-jdk-11
script: mvn test
......@@ -18,15 +30,11 @@ package:
only:
- master
- merge_requests
- tags
stage: package
image: maven:3-jdk-11
script:
- >
if [[ $WEBAPP_VERSION == *"-SNAPSHOT"* ]]; then
mvn -DskipTests -Dversion.helmholtz-marketplace-webapp=$WEBAPP_VERSION clean install
else
mvn -DskipTests clean install
fi
- mvn -DskipTests clean install
artifacts:
paths:
- "target/*.tar"
......@@ -37,6 +45,8 @@ package:
docker_push:
only:
- master
- merge_requests
- tags
stage: deploy
image: docker:19.03.11
services:
......@@ -45,9 +55,17 @@ docker_push:
before_script:
- docker info
script:
- docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
- docker build -t $DOCKER_IMAGE_LATEST .
- docker push $DOCKER_IMAGE_LATEST
- docker login -u $GITLAB_DOCKER_USERNAME -p $GITLAB_DOCKER_PASSWORD $DOCKER_REGISTRY
- |-
TAG="latest"
if [[ -n "$WEBAPP_BRANCH" ]]; then
TAG="$WEBAPP_BRANCH"
elif [[ -n "$WEBAPP_VERSION" ]]; then
TAG="$WEBAPP_VERSION"
fi
docker build -t $DOCKER_IMAGE_BASE:$TAG .
docker push $DOCKER_IMAGE_BASE:$TAG
dependencies:
- package
tags:
......
......@@ -27,11 +27,23 @@
<repositories>
<repository>
<id>de.helmholtz.marketplace</id>
<url>https://download.dcache.org/nexus/content/groups/public</url>
<id>gitlab-maven</id>
<url>https://gitlab.hzdr.de/api/v4/projects/1768/packages/maven</url>
</repository>
</repositories>
<distributionManagement>
<repository>
<id>gitlab-maven</id>
<url>https://gitlab.hzdr.de/api/v4/projects/1768/packages/maven</url>
</repository>
<snapshotRepository>
<id>gitlab-maven</id>
<url>https://gitlab.hzdr.de/api/v4/projects/1768/packages/maven</url>
</snapshotRepository>
</distributionManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
......@@ -79,8 +91,8 @@
<dependency>
<groupId>de.helmholtz.marketplace</groupId>
<artifactId>helmholtz-marketplace-webapp</artifactId>
<version>${version.helmholtz-marketplace-webapp}</version>
<artifactId>helmholtz-marketplace-webapp${env.WEBAPP_PROJECT_BRANCH}</artifactId>
<version>${env.WEBAPP_PROJECT_VERSION}</version>
</dependency>
</dependencies>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment