Commit 5fcdda18 authored by Anna Foix's avatar Anna Foix 🦇
Browse files

new gitlab pipeline for data API

parent d35cd2f2
Pipeline #113332 failed
# Keep this file in sync with docker-compose.yml.
# Build JAVA applications using Apache Maven (http://maven.apache.org)
# For docker image tags see https://hub.docker.com/_/maven/
#
# For general lifecycle information see https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html
variables:
# This will suppress any download for dependencies and plugins or upload messages which would clutter the console log.
# `showDateTime` will show the passed time in milliseconds. You need to specify `--batch-mode` to make this work.
MAVEN_OPTS: "-Dhttps.protocols=TLSv1.2 -Dmaven.repo.local=$CI_PROJECT_DIR/.m2/repository -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN -Dorg.slf4j.simpleLogger.showDateTime=true -Djava.awt.headless=true"
# As of Maven 3.3.0 instead of this you may define these options in `.mvn/maven.config` so the same config is used
# when running from the command line.
MAVEN_CLI_OPTS: "--batch-mode --errors --show-version --settings $CI_PROJECT_DIR/.m2/settings-for-gitlab.xml --activate-profiles ega-ingestion-local-test -DtrimStackTrace=false -Dmaven.javadoc.skip=true"
# The wnameless/oracle-xe-11g-r2 Docker image threw an "ORA-01882: timezone region not found" exception.
# The easiest solution, according to https://stackoverflow.com/a/26616140/1003471, was to set the timezone:
TZ: "GMT"
POSTGRES_DB: "file_manager"
POSTGRES_USER: "file_manager_user"
POSTGRES_PASSWORD: "file_manager_password"
MYSQL_ROOT_PASSWORD: "root_password"
MYSQL_DATABASE: "ega_audit_ve_vault_archive_test"
MYSQL_USER: "audit_user"
MYSQL_PASSWORD: "audit_password"
image: maven:3.6.3-openjdk-8-slim
## List of jobs:
list:
- unitTest
- integrationTest
- imageBuild
services:
script:
- mvn dependency:purge-local-repository install -DskipTests=true -P production -Dmaven.javadoc.skip=true -B -V -DskipDockerPush
# Cache downloaded dependencies and plugins between builds.
# To keep cache across branches add 'key: "$CI_JOB_NAME"'
cache:
paths:
- .m2/repository
## Diffent stages for the CICD of Data API
unitTest:
stage: unitTest
script: mvn test
integrationTest:
stage: integrationTest
before_script:
- sudo service postgresql stop
- sudo mkdir -p /usr/local/share/ca-certificates/ca/
- sudo cp extras/certificate/rootCA.pem /usr/local/share/ca-certificates/ca/CA.crt
- sudo chmod 644 /usr/local/share/ca-certificates/ca/CA.crt
- sudo update-ca-certificates
- docker build -t ega-data-api/ega-dataedge --file Dockerfile.dataedge .
- docker build -t ega-data-api/ega-res --file Dockerfile.res .
- docker build -t ega-data-api/ega-keyserver --file Dockerfile.keyserver .
- docker build -t ega-data-api/ega-filedatabase --file Dockerfile.filedatabase .
- docker build -t ega-data-api/ega-postgres --file extras/postgresdb/Dockerfile .
- cd extras && source ./variables.sh
- docker-compose up -d
- sleep 90
- cd ../ega-data-api-it
script:
- mvn test
imageBuild:
stage: imageBuild
only: master
script: ./extras/travis_push_docker_hub.sh
language: java
services: docker
jdk: oraclejdk8
dist: trusty
install:
# installing dependencies and skipping docker push
- mvn dependency:purge-local-repository install -DskipTests=true -P production -Dmaven.javadoc.skip=true -B -V -DskipDockerPush
cache:
directories:
- $HOME/.m2
stages:
- name: unit test
if: type IN (push, pull_request)
- name: integ test
if: type IN (push, pull_request)
- name: image build
if: type = push AND branch = master
jobs:
include:
- stage: unit test
script: mvn test
- stage: integ test
before_script:
- sudo service postgresql stop
- sudo mkdir -p /usr/local/share/ca-certificates/ca/
- sudo cp extras/certificate/rootCA.pem /usr/local/share/ca-certificates/ca/CA.crt
- sudo chmod 644 /usr/local/share/ca-certificates/ca/CA.crt
- sudo update-ca-certificates
- docker build -t ega-data-api/ega-dataedge --file Dockerfile.dataedge .
- docker build -t ega-data-api/ega-res --file Dockerfile.res .
- docker build -t ega-data-api/ega-keyserver --file Dockerfile.keyserver .
- docker build -t ega-data-api/ega-filedatabase --file Dockerfile.filedatabase .
- docker build -t ega-data-api/ega-postgres --file extras/postgresdb/Dockerfile .
- cd extras && source ./variables.sh
- docker-compose up -d
- sleep 90
- cd ../ega-data-api-it
script:
- mvn test
- stage: image build
script: ./extras/travis_push_docker_hub.sh
notifications:
email: false
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