Jeroen Cuvelier
Jeroen Cuvelier

Reputation: 35

Gitlab runner does not seem to load docker image

For a old codebase, we're trying to go from just uploading changes through FTP to using Gitlab CI/CD. However, none of us have extensive Gitlab experience, and I've been trying to set the deployment up by following this guide:

https://savjee.be/2019/04/gitlab-ci-deploy-to-ftp-with-lftp/

I'm running a gitlab-runner on my own mac right now, however, it seems like the docker image in my yml file is not loaded correctly. When using the yml from the article:

image: ubuntu:18.04

before_script:
  - apt-get update -qy
  - apt-get install -y lftp

build:
  script:
    # Sync to FTP
    - lftp -e "open ftp.mywebhost.com; user $FTP_USERNAME $FTP_PASSWORD; mirror -X .* -X .*/ --reverse --verbose --delete local-folder/ destination-folder/; bye"

It tells me apt-get: command not found. I've tried with apk-get as well, but no differences. I've tried to find a different docker image that has lftp installed ahead of time, but then I just get a lftp: command not found:

image: minidocks/lftp:4

before_script:
  # - apt-get update -qy
  #- apt-get install -y lftp

build:
  script:
    - lftp -e "open ftp.mywebhost.com; user $FTP_USERNAME $FTP_PASSWORD; mirror -X .* -X .*/ --reverse --verbose --delete local-folder/ destination-folder/; bye"
    - echo 'test this'

If I comment out the lftp/apt-get bits, I do get to the echo command, however (and it does work).

I can't seem to find any reason for this when searching online. Apologies if this is a duplicate question or I've just been looking in the wrong places.

Upvotes: 0

Views: 1797

Answers (1)

Zeitounator
Zeitounator

Reputation: 44799

From your question, it seems you are executing your tasks on a gitlab-runner using the shell executor.

The shell executor does not handle the image keyword as exposed in the runner compatibility matrix.

Moreover, since you want to deploy on docker containers, you need the docker executor anyway.

Upvotes: 4

Related Questions