Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 244
Nagarjuna D N Avatar asked Mar 22 '26 07:03

Nagarjuna D N


1 Answers

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.

like image 164
Hui Wang Avatar answered Mar 24 '26 23:03

Hui Wang



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!