stages: - compose - verify include: - local: 'templates/IaC/docker-compose.gitlab-ci.yml' - local: 'templates/IaC/ssh-transfer-data.gitlab-ci.yml' #This files tests if Docker Compose template is working correctly. #to test scp It pushes the docker compose file with to the remove maschine. #to test docker-compose up over ssh it startes a simple docker compose file on the remote maschine. #to verify the functionality an ssh connection tests if the files exist on the server. Docker-compose: stage: compose rules: - when: always extends: .docker-compose-deploy variables: SCP_DESTINATION: "/home/user" SCP_SOURCE: "$CI_PROJECT_DIR/test/docker/docker-compose.yml" COMPOSE_EXTRA_ARGS: "-f test/docker/docker-compose.yml" SSH_PORT: "22" SSH_URL: "ci-cd.dev.exxcellent.de" SSH_USER: "user" DOCKER_REGISTRY: "$CI_REGISTRY" DOCKER_REGISTRY_PASS: "$CI_REGISTRY_PASSWORD" DOCKER_REGISTRY_USER: "$CI_REGISTRY_USER" ENV_SETUP_FILE: "setup_env.sh" SSH_PRIVATE_KEY_DEPLOY: $SSH_PRIVATE_KEY Test-Files: stage: verify variables: SSH_URL: "ci-cd.dev.exxcellent.de" SSH_USER: "user" rules: - when: always extends: .ssh-transfer-data script: - ssh-keyscan $SSH_URL >> ~/.ssh/known_hosts - ssh $SSH_USER@$SSH_URL "if [ -f test.log ]; then rm test.log; else exit 255; fi" - ssh $SSH_USER@$SSH_URL "if [ -f docker-compose.yml ]; then rm docker-compose.yml; else exit 255; fi"