I have a very simple Micronaut application with Java 14 in gitlab.com and a .gitlab-ci.yml
file that looks like follows
variables:
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"
MAVEN_CLI_OPTS: "--batch-mode --errors --fail-at-end --show-version -DinstallAtEnd=true -DdeployAtEnd=true"
image: maven:3.6.1-jdk-14
stages:
- package
- release
- run
maven-package:
stage: package
script:
- ./mvnw verify -Dmaven.repo.local=$MAVEN_USER_HOME
artifacts:
paths:
- target/*.jar
expire_in: 1 day
docker-push:
only:
- master
- develop
image: docker:latest
services:
- docker:dind
variables:
REGISTRY_URL: registry.gitlab.com
DOCKER_HOST: tcp://docker:2375
DOCKER_DRIVER: overlay2
IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
stage: release
dependencies:
- maven-package
before_script:
- docker info
- cp target/*.jar .
script:
- docker login -u "gitlab-ci-token" -p "$CI_BUILD_TOKEN" $REGISTRY_URL
- docker build -t $IMAGE_TAG .
- docker push $IMAGE_TAG
docker-run:
only:
- master
stage: run
dependencies:
- docker-push
script:
- ssh root@$DEPLOYMENT_SERVER_IP "./restart"
The first 2 jobs finish successfully, but the run
job fails with
/usr/bin/bash: line 109: ssh: command not found
.
Is there something I’m missing? am I overdoing the pipelines?
Thanks!