Commit 5fe8b618 authored by LAVENIER's avatar LAVENIER
Browse files

[fix] CI: Fix deploy repository

parent 2ae9ecd1
......@@ -27,11 +27,12 @@ variables:
MAVEN_LOCAL_REPO: /root/.m2/repository/
MAVEN_REPO_URL: https://gitlab.ifremer.fr/api/v4/projects/1272/packages/maven
APP_NAME: sumaris
APP_CORE_MODULE: ${APP_NAME}-core
APP_DB_MODULE: ${APP_NAME}-db
APP_WAR_MODULE: ${APP_NAME}-server
ARTIFACT_WAR_FILE: ${APP_WAR_MODULE}/target/*.war
ARTIFACT_CONFIG_FILES: ${APP_WAR_MODULE}/target/classes/*.properties
APP_CORE_MODULE: sumaris-core
APP_DB_MODULE: sumaris-db
APP_WAR_MODULE: sumaris-server
ARTIFACT_WAR_FILE: "${APP_WAR_MODULE}/target/*.war"
ARTIFACT_CONFIG_FILES: "${APP_WAR_MODULE}/target/classes/*.properties"
ENV_FILE: target/variables.env
# Must be defined into pipelines variables :
# CI_REGISTRY_USER:
......@@ -60,12 +61,12 @@ variables:
.build:
stage: build
tags: [sih_public_runner]
script:
- echo "Test dev build in progress"
- mvn -s ./ci_settings.xml -q clean install -DskipTests
before_script:
- echo "Building from sources..."
- mvn clean install -s ./ci_settings.xml -q -DskipTests
# Get project version
- APP_VERSION=$(mvn org.apache.maven.plugins:maven-help-plugin:3.2.0:evaluate -Dexpression=project.version -q -DforceStdout)
- echo "APP_VERSION=$APP_VERSION" >> variables.env
- APP_VERSION=$(mvn org.apache.maven.plugins:maven-help-plugin:3.2.0:evaluate -Dexpression=project.version -q -DforceStdout --non-recursive)
- echo "APP_VERSION=${APP_VERSION}" > ${ENV_FILE}
environment:
name: test
artifacts:
......@@ -73,12 +74,12 @@ variables:
- ${ARTIFACT_WAR_FILE}
- ${ARTIFACT_CONFIG_FILES}
reports:
dotenv: variables.env
dotenv: ${ENV_FILE}
expire_in: 60 minutes
only:
- develop
fast-build:
build:
extends: .build
image: ${CONTAINER_BUILD_IMAGE}
......@@ -166,18 +167,16 @@ sonarqube:
- git remote set-url origin ${CI_REPOSITORY_URL}
- git config --global user.email "${GITLAB_USER_EMAIL}"
- git config --global user.name "${GITLAB_USER_NAME}"
- git reset --hard develop
- git fetch origin
- git pull origin develop
- echo "RELEASE_VERSION=${RELEASE_VERSION}" >> variables.env
# - git reset --hard develop
# - git fetch origin
# - git pull origin develop
script:
- echo "Preparing release..."
- git branch -D release/$RELEASE_VERSION || true
- git status
- mvn -s ./ci_settings.xml -B gitflow:release-start --batch-mode -DreleaseVersion="$RELEASE_VERSION"
- echo "Performing release..."
# - mvn -s ./ci_settings.xml clean deploy --batch-mode -DperformRelease -DskipTests -Drelease.server=job-maven -Phsqldb,gitlab-profile
- mvn -s ./ci_settings.xml clean install --batch-mode -DperformRelease -DskipTests -Phsqldb,gitlab-profile
- mvn clean install -s ./ci_settings.xml --batch-mode -DperformRelease -DskipTests
- echo "Creating test DB..."
- mvn -pl ${APP_CORE_MODULE} -q -Prun,hsqldb -DskipTests --batch-mode
- cd ${APP_CORE_MODULE}/target && tar -cf "${APP_DB_MODULE}-${RELEASE_VERSION}.tar.gz" db && cd ../..
......@@ -185,6 +184,8 @@ sonarqube:
- git commit -a -m "Release $RELEASE_VERSION"
- git status
- mvn gitflow:release-finish
after_script:
- echo "APP_VERSION=${RELEASE_VERSION}" > ${ENV_FILE}
artifacts:
paths:
- ${ARTIFACT_WAR_FILE}
......@@ -192,12 +193,12 @@ sonarqube:
- ${APP_WAR_MODULE}/target/*.tar.gz
- ${APP_WAR_MODULE}/target/*.zip
reports:
dotenv: variables.env
dotenv: ${ENV_FILE}
only:
- develop
when: manual
fast-release:
release:
extends: .release
image: ${CONTAINER_BUILD_IMAGE}
needs:
......@@ -266,7 +267,7 @@ gitlab-release:
paths:
- DockerFile
docker:dev:
docker:
extends: .docker-build
script:
- docker push ${CONTAINER_SNAPSHOT_IMAGE}
......@@ -281,8 +282,6 @@ docker:release:
script:
- docker tag ${CONTAINER_SNAPSHOT_IMAGE} ${CI_REGISTRY_IMAGE}:${CI_COMMIT_TAG}
- docker push ${CI_REGISTRY_IMAGE}:${IMAGE_TAG}
#- docker tag ${CONTAINER_SNAPSHOT_IMAGE} ${CI_REGISTRY_IMAGE}:latest
#- docker push ${CI_REGISTRY_IMAGE}:latest
only:
- tags
......
Markdown is supported
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