Commit 8883f91f authored by Mat's avatar Mat

Add CI script

parent 9912ea86
Pipeline #75401169 passed with stages
in 31 minutes and 2 seconds
image: ubuntu:bionic
stages:
- build
- test
- package
- docker_tag
build:
stage: build
before_script:
- apt-get update
- apt-get install -y openjdk-11-jdk maven
script:
- mvn clean install -DskipTests
test:
stage: test
dependencies:
- build
before_script:
- apt-get update
- apt-get install -y openjdk-11-jdk maven
script:
- mvn test
build:docker:builder:
stage: build
image: docker:stable
services:
- docker:dind
variables:
DOCKER_HOST: tcp://docker:2375
DOCKER_DRIVER: overlay2
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker build -t $CI_REGISTRY_IMAGE/searchitect_builder:$CI_COMMIT_SHORT_SHA .
- docker push $CI_REGISTRY_IMAGE/searchitect_builder:$CI_COMMIT_SHORT_SHA
build:docker:images:
stage: package
dependencies:
- build:docker:builder
- test
image: docker:stable
services:
- docker:dind
variables:
DOCKER_HOST: tcp://docker:2375
DOCKER_DRIVER: overlay2
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker pull $CI_REGISTRY_IMAGE/searchitect_builder:$CI_COMMIT_SHORT_SHA
- docker tag $CI_REGISTRY_IMAGE/searchitect_builder:$CI_COMMIT_SHORT_SHA searchitect_builder
- docker build -t $CI_REGISTRY_IMAGE/searchitect-gate:$CI_COMMIT_REF_SLUG searchitect-gate
- docker build -t $CI_REGISTRY_IMAGE/searchitect-backend-dynrh2lev:$CI_COMMIT_REF_SLUG searchitect-backend-dynrh2lev
- docker build -t $CI_REGISTRY_IMAGE/searchitect-backend-dynrh2levrocks:$CI_COMMIT_REF_SLUG searchitect-backend-dynrh2levrocks
- docker build -t $CI_REGISTRY_IMAGE/searchitect-backend-sophos:$CI_COMMIT_REF_SLUG searchitect-backend-sophos
- docker build -t $CI_REGISTRY_IMAGE/searchitect-backend-template:$CI_COMMIT_REF_SLUG searchitect-backend-template
- docker push $CI_REGISTRY_IMAGE/searchitect-gate:$CI_COMMIT_REF_SLUG
- docker push $CI_REGISTRY_IMAGE/searchitect-backend-dynrh2lev:$CI_COMMIT_REF_SLUG
- docker push $CI_REGISTRY_IMAGE/searchitect-backend-dynrh2levrocks:$CI_COMMIT_REF_SLUG
- docker push $CI_REGISTRY_IMAGE/searchitect-backend-sophos:$CI_COMMIT_REF_SLUG
- docker push $CI_REGISTRY_IMAGE/searchitect-backend-template:$CI_COMMIT_REF_SLUG
push_docker_tag:
stage: docker_tag
image: docker:stable
services:
- docker:dind
variables:
DOCKER_HOST: tcp://docker:2375
DOCKER_DRIVER: overlay2
dependencies:
- build:docker:images
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker pull $CI_REGISTRY_IMAGE/searchitect-gate:$CI_COMMIT_REF_SLUG
- docker pull $CI_REGISTRY_IMAGE/searchitect-backend-dynrh2lev:$CI_COMMIT_REF_SLUG
- docker pull $CI_REGISTRY_IMAGE/searchitect-backend-dynrh2levrocks:$CI_COMMIT_REF_SLUG
- docker pull $CI_REGISTRY_IMAGE/searchitect-backend-sophos:$CI_COMMIT_REF_SLUG
- docker pull $CI_REGISTRY_IMAGE/searchitect-backend-template:$CI_COMMIT_REF_SLUG
- docker tag $CI_REGISTRY_IMAGE/searchitect-gate:$CI_COMMIT_REF_SLUG $CI_REGISTRY_IMAGE/searchitect-gate:$CI_COMMIT_TAG
- docker tag $CI_REGISTRY_IMAGE/searchitect-backend-dynrh2lev:$CI_COMMIT_REF_SLUG $CI_REGISTRY_IMAGE/searchitect-backend-dynrh2lev:$CI_COMMIT_TAG
- docker tag $CI_REGISTRY_IMAGE/searchitect-backend-dynrh2levrocks:$CI_COMMIT_REF_SLUG $CI_REGISTRY_IMAGE/searchitect-backend-dynrh2levrocks:$CI_COMMIT_TAG
- docker tag $CI_REGISTRY_IMAGE/searchitect-backend-sophos:$CI_COMMIT_REF_SLUG $CI_REGISTRY_IMAGE/searchitect-backend-sophos:$CI_COMMIT_TAG
- docker tag $CI_REGISTRY_IMAGE/searchitect-backend-template:$CI_COMMIT_REF_SLUG $CI_REGISTRY_IMAGE/searchitect-backend-template:$CI_COMMIT_TAG
- docker push $CI_REGISTRY_IMAGE/searchitect-gate:$CI_COMMIT_TAG
- docker push $CI_REGISTRY_IMAGE/searchitect-backend-dynrh2lev:$CI_COMMIT_TAG
- docker push $CI_REGISTRY_IMAGE/searchitect-backend-dynrh2levrocks:$CI_COMMIT_TAG
- docker push $CI_REGISTRY_IMAGE/searchitect-backend-sophos:$CI_COMMIT_TAG
- docker push $CI_REGISTRY_IMAGE/searchitect-backend-template:$CI_COMMIT_TAG
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