Nagarjuna D N
Nagarjuna D N

Reputation: 561

How to ssh into GitLab default shared runner?

I am using GitLab.com and default shared runner and below is my .gitlab-ci.yml file:

 image: maven:3.3.9-jdk-8
 build:
  script: 
  - mvn -X clean install

Here I am making use of docker image "maven:3.3.9-jdk-8". Do I have any possible way so that i can ssh into default runner with docker image and do any further configuration for the same image. This is required for me in the future if I want to install other packages like nodejs, mongodb or any other.

I can achieve this by setting up custom Runner but is there any way I can accomplish the same from default runner with docker image. Thanks

Upvotes: 3

Views: 3372

Answers (1)

Hui Wang
Hui Wang

Reputation: 1983

As far as I understand, you can't because for one job you can use only one runner of a given type. In your case,the job is executed by the docker runner.

If you want to use docker and to perform some shell tasks, i would recommend using the shell executor.

Instead of specifying the maven image, you can use docker to run the maven command(docker must be installed).

docker -i --rm -v "$(pwd)":/usr/src/myproject -w /usr/src/myproject maven:latest mvn -X clean install

Since the shell executor runs scripts locally on the host where the runner runs, you can run other scripts without ssh.

Upvotes: 1

Related Questions