gitlab-ci-local icon indicating copy to clipboard operation
gitlab-ci-local copied to clipboard

Under PopOS, docker run works, while gitlab-ci-local doesn't

Open jg-cantaa opened this issue 2 years ago • 36 comments

TL;DR: This Issue happens under PopOS. The cause could not be pinpointed despite intensive debugging, so this Issue will stay unfixed. Currently the only workaround is to run kaniko with the --force flag. Using gitlab-ci-local --privileged will not work.

2022-01-14_10-30

Minimal Project Structure Archive: Issue.zip

Expected behavior Like run.sh: the container builds successfully

Host information Linux: Pop!_OS 20.04 LTS gitlab-ci-local 4.27.1

Note This issue requires the same setup like #341, however the error is a new one.

jg-cantaa avatar Jan 14 '22 10:01 jg-cantaa

@jg-cantaa https://github.com/firecow/gitlab-ci-local/releases/tag/4.28.1 Can you try out this version please, and reopen if the bug still persists. Works on my machine, with 4.28.1

firecow avatar Jan 15 '22 12:01 firecow

Sadly the Issue persists, even with 4.28.1. 2022-01-18_11-38

I have tried removing the dockerimages to redownload them. However I don't know what else I could try in order to get it working. Please let me know if you want me to test other workarounds/fixes.

jg-cantaa avatar Jan 18 '22 10:01 jg-cantaa

@jg-cantaa Hmm.. Why the hell can't I reproduce this... What docker version are you running ?

firecow avatar Jan 18 '22 11:01 firecow

Docker version 20.10.7, build 20.10.7-0ubuntu5.1

jg-cantaa avatar Jan 18 '22 11:01 jg-cantaa

Hello 😊

I may try to reproduce to help the cause, if I find time.

Does it work with the --force flag ?

bcouetil avatar Jan 18 '22 13:01 bcouetil

@jg-cantaa

---
test:
  needs: []
  image:
    name: gcr.io/kaniko-project/executor:debug
    entrypoint: [""]
  script:
    - |
      cat <<EOF >> ${CI_PROJECT_DIR}/Dockerfile
      FROM ubuntu
      EOF
    - >-
      /kaniko/executor
      --context "${CI_PROJECT_DIR}"
      --dockerfile "${CI_PROJECT_DIR}/Dockerfile"
      --no-push

Can you try this out, real quick...

firecow avatar Jan 18 '22 13:01 firecow

Yes it does, but that kind of defeats the purpose of using gitlab-ci-local. It should just work. It should not require --force, since a normal docker container also does not require --force. Now, It could also be the case, that it's not worth it to fix this, simply because Kaniko requires some obscure thing to indicate it running in a container, which might not be that easy to reproduce.

jg-cantaa avatar Jan 18 '22 13:01 jg-cantaa

Yes it does, but that kind of defeats the purpose of using gitlab-ci-local. It should just work. It should not require --force, since a normal docker container also does not require --force. Now, It could also be the case, that it's not worth it to fix this, simply because Kaniko requires some obscure thing to indicate it running in a container, which might not be that easy to reproduce.

This must be fixed, lots of people use Kaniko.

Can you try my example real quick.

firecow avatar Jan 18 '22 13:01 firecow

Still... 2022-01-18_14-29

I used this gitlab-ci-local test with this ci yml:

stages:
  - build_dockerfile
  - test
Construct_Docker_Image:
  stage: build_dockerfile
  image:
    name: gcr.io/kaniko-project/executor:debug
    entrypoint: [""]
  script:
    - >-
      /kaniko/executor
      --context "${CI_PROJECT_DIR}"
      --dockerfile "${CI_PROJECT_DIR}/Dockerfile"
      --no-push

test:
  stage: test
  needs: []
  image:
    name: gcr.io/kaniko-project/executor:debug
    entrypoint: [""]
  script:
    - |
      cat <<EOF >> ${CI_PROJECT_DIR}/Dockerfile
      FROM ubuntu
      EOF
    - >-
      /kaniko/executor
      --context "${CI_PROJECT_DIR}"
      --dockerfile "${CI_PROJECT_DIR}/Dockerfile"
      --no-push

jg-cantaa avatar Jan 18 '22 13:01 jg-cantaa

image

This is mine @jg-cantaa

@bcouetil Can you try running the test: job from above as well

firecow avatar Jan 18 '22 13:01 firecow

Are there any other programs with specific versions or packages that could influence this kind of behavior?

jg-cantaa avatar Jan 18 '22 13:01 jg-cantaa

@jg-cantaa That's what I'm wondering

firecow avatar Jan 18 '22 13:01 firecow

Do you have .gitlab-ci-local-env or .gitlab-ci-local.yml located in CWD @jg-cantaa ?

firecow avatar Jan 18 '22 13:01 firecow

Nope, using the plain directory as mentioned in:

Minimal Project Structure Archive: Issue.zip

2022-01-18_14-41

(the plain node thing was just autocomplete)

Edit: and this:

$ ts-node -v
v10.3.0

jg-cantaa avatar Jan 18 '22 13:01 jg-cantaa

@jg-cantaa Ok, make a new dir, and only put a .gitlab-ci.yml with the test: inside and call gitlab-ci-local test Just so we are 2000% sure nothing file/folder specific is fucking us.

firecow avatar Jan 18 '22 13:01 firecow

Why are we talking about ts-node -v now ? @jg-cantaa

firecow avatar Jan 18 '22 13:01 firecow

You need to have gitlab-ci-local installed in /usr/local/bin/gitlab-ci-local don't run it from a checkout or anything.

firecow avatar Jan 18 '22 13:01 firecow

Why are we talking about ts-node -v now ? @jg-cantaa

I just thought it might be useful. I installed as usual via npm install -g gitlab-ci-local.

jg-cantaa avatar Jan 18 '22 13:01 jg-cantaa

@jg-cantaa Yes, it could become useful later on.

Right now, we just need to see output similar to this. When moving to a new non-git folder

image

firecow avatar Jan 18 '22 13:01 firecow

2022-01-18_14-57

jg-cantaa avatar Jan 18 '22 13:01 jg-cantaa

mjn@mjn-laptop:~$ cat /etc/docker/daemon.json 
{
  "metrics-addr" : "127.0.0.1:9323",
  "experimental" : true,
  "registry-mirrors": ["https://mirror.gcr.io"]
}

Here is mine, what's yours :laughing:

firecow avatar Jan 18 '22 14:01 firecow

this file does not exist on my machine.

jg-cantaa avatar Jan 18 '22 15:01 jg-cantaa

It might be a PopOS issue...

bcouetil avatar Jan 18 '22 15:01 bcouetil

Hmm.... I'm pretty sure I have a dev that uses PopOS, I'll try his machine in the morrow 😁

Its Ubuntu/Debian based, so I find it unlikely, but lets eliminate that.

firecow avatar Jan 18 '22 17:01 firecow

image

It really looks like something todo with PopOS now :smile:

My PopOS co-worker is getting it.

firecow avatar Jan 27 '22 09:01 firecow

@jg-cantaa Can you print your bash version please

bash --version

firecow avatar Jan 29 '22 11:01 firecow

~$ bash --version
GNU bash, Version 5.1.8(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2020 Free Software Foundation, Inc.
Lizenz GPLv3+: GNU GPL Version 3 oder jünger <http://gnu.org/licenses/gpl.html>

Dies ist freie Software.  Sie darf verändert und verteilt werden.
Es wird keine Garantie gewährt, soweit das Gesetz es zulässt.

jg-cantaa avatar Feb 01 '22 11:02 jg-cantaa

@jg-cantaa Would you by any chance have selinux installed ?

firecow avatar Feb 02 '22 07:02 firecow

No.

~$ selinux
selinux: Befehl nicht gefunden.

~$ apt list selinux
Auflistung… Fertig

Edit: Maybe?

~$ apt list *selinux
Auflistung… Fertig
android-libselinux/impish 10.0.0+r36-1 amd64
python3-selinux/impish 3.1-3build2 amd64
python3-selinux/impish 3.1-3build2 i386
ruby-selinux/impish 3.1-3build2 amd64
ruby-selinux/impish 3.1-3build2 i386

jg-cantaa avatar Feb 02 '22 09:02 jg-cantaa

Try apt list *selinux*

Also does gitlab-ci-local --priviledged get rid of the warning?

firecow avatar Feb 02 '22 15:02 firecow