feat(Docker Compose): Test Docker Compose

This commit is contained in:
Marcel Feix 2022-06-14 16:09:17 +02:00
parent d4b2c3b735
commit a96c62fb3d
No known key found for this signature in database
GPG Key ID: 04D016E104A25F03
3 changed files with 32 additions and 2 deletions

View File

@ -6,6 +6,7 @@ stages:
include: include:
- local: 'templates/releasing/release.gitlab-ci.yml' - local: 'templates/releasing/release.gitlab-ci.yml'
- local: 'templates/releasing/release-gitlab.gitlab-ci.yml' - local: 'templates/releasing/release-gitlab.gitlab-ci.yml'
- local: 'templates/IaC/docker-compose.gitlab-ci.yml'
- local: 'templates/documentations/documentation.gitlab-ci.yml' - local: 'templates/documentations/documentation.gitlab-ci.yml'
Test-Java-Backend: Test-Java-Backend:
@ -19,6 +20,27 @@ Test-Java-Backend:
branch: "Templates2.0" branch: "Templates2.0"
strategy: depend strategy: depend
Test-Docker-compose:
stage: verify
rules:
- if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
when: always
- when: manual
extends: .docker-compose-deploy
variables:
SCP_DESTINATION: "/tmp"
SCP_SOURCE: "$CI_PROJECT_DIR/test/docker-compose.yml"
COMPOSE_EXTRA_ARGS: "-f test/docker-compose.yml"
SSH_URL: "ci-cd.dev.exxcellent.de"
SSH_USER: "user"
SSH_PORT: "22"
DOCKER_REGISTRY: "$CI_REGISTRY"
ENV_SETUP_FILE: "setup_env.sh"
SSH_PRIVATE_KEY_DEPLOY: $SSH_PRIVATE_KEY
after_script:
- ssh $SSH_USER@$SSH_URL "if [ -f test.log ]; then exit 1; rm test.log; fi"
- ssh $SSH_USER@$SSH_URL "if [ -f docker-compose.yml ]; then exit 1; rm docker-compose.yml; fi"
check_confluence_validity: check_confluence_validity:
extends: .documentation-check-confluence-validity extends: .documentation-check-confluence-validity
variables: variables:

View File

@ -2,7 +2,7 @@
image: docker:20.10.16-alpine3.15 image: docker:20.10.16-alpine3.15
stage: deploy stage: deploy
variables: variables:
DOCKER_COMPOSE_VERSION: v2.5.1 DOCKER_COMPOSE_VERSION: v2.6.0
SCP_DESTINATION: "" SCP_DESTINATION: ""
SCP_SOURCE: $CI_PROJECT_DIR SCP_SOURCE: $CI_PROJECT_DIR
COMPOSE_EXTRA_ARGS: "" COMPOSE_EXTRA_ARGS: ""
@ -51,7 +51,7 @@
image: docker:20.10.16-alpine3.15 image: docker:20.10.16-alpine3.15
stage: verify stage: verify
variables: variables:
DOCKER_COMPOSE_VERSION: v2.5.1 DOCKER_COMPOSE_VERSION: v2.6.0
before_script: before_script:
#Install docker Compose, from release directly #Install docker Compose, from release directly
- wget https://github.com/docker/compose/releases/download/$DOCKER_COMPOSE_VERSION/docker-compose-linux-x86_64 -O /usr/local/bin/docker-compose - wget https://github.com/docker/compose/releases/download/$DOCKER_COMPOSE_VERSION/docker-compose-linux-x86_64 -O /usr/local/bin/docker-compose

8
test/docker-compose.yml Normal file
View File

@ -0,0 +1,8 @@
services:
hello_world:
image: alpine:latest
command: [ touch, "/tmp/test.log" ]
volumes:
- type: bind
source: /tmp
target: /tmp