0
votes

Well, I created a private runner in my Digital Ocean VPS. This private runner is using shell executor, and this is my gitlab-ci.yml file:

variables:
  VERSION_NAME: ${CI_COMMIT_REF_NAME}-${CI_CONCURRENT_ID}

before_script:
  - docker info

stages:
  - test
  - build
  - deploy
  - delivery

test_project:
  tags: 
    - safepark
  stage: test
  image: mcr.microsoft.com/dotnet/core/sdk:2.1
  script:
    - dotnet test

build_image:
  tags: 
    - safepark
  only:
    - master
  stage: build
  script:
    - docker build -f WebApi/Dockerfile -t myuser/myimage
    - docker tag -t myuser/myimage myuser/myimage:${VERSION_NAME}

push_image:
  tags: 
    - safepark
  only:
    - master
  stage: deploy
  script:
    - docker push myuser/myimage
    - docker push myuser/myimage:${VERSION_NAME}

But in "test" stage the image is never pulled and I got "dotnet command not found". But If I change to a shared runner everything works fine. Seems like "image" is ignored by gitlab runner. How can I solve it ?

1

1 Answers

1
votes

When you want to use a Gitlab Runner with docker, you have to use the docker executor instead of a shell executor.

You can only run commands locally on the machine that runs the executor when using the shell executor.

I assume that it's working on the shared runner as it might have a docker executor.