Make package in Gitlab CI with docker

(Duarte Ferreira) #1

I'm creating a test beat and after following the code generator every thing seems to work of.
Working with a Gitlab based CI system I tried to run the "make package" inside docker.
The docker has the docker socket in a volume inside the container so it can create new containers.

Everything runs fine until it tries to run the container:

# cross compile on ubuntu
docker run --rm \
-v /go/src/local/testbeat/vendor/ \
-v /go/src/local/testbeat/vendor/ \
-v /go/src/local:/source \
-v /go/src/local/testbeat/build:/build \
-e PACK=testbeat \
-e \
-e SOURCE=/source \
-e TARGETS="windows/amd64 windows/386 darwin/amd64"  \
-e BUILDID=7a6d7ef0f149ea8ce6c2a87a5c8b749d2b3c0262  \
-e ES_BEATS=./vendor/ \
-e BEAT_PATH=local/testbeat \
-e BEAT_NAME=piwikbeat \
Working directory=/go/src/local/
Copying main source folder /source to folder /go/src/local/
Fetching dependencies...
chmod: cannot access '/scripts/': 

The problem is that the path /go/src/local/testbeat/ exists inside the first container and not on the host machine.
I don't know enough about the package process or docker to find a way to fix this.
Does anyone have an idea on how I could fix this problem without running the "make package" on a linux machine on the host machine or a VM?


(Andrew Kroh) #2

Probably the only way to get those paths correct is for you to tell it what the proper mount points are on the host. The build container doesn't have knowledge of the paths on the host so I think you'll need to patch the Makefile so that it knows what the correct mounts are. These are the Makefile lines:

(Duarte Ferreira) #3

Hi Andrew,
I already looked at the make files but the problem is that the files that this container is trying to access are inside another container, not on the host filesystem.

I'm precisely trying to avoid leaving code on the host machine.

(Andrew Kroh) #4

Then maybe you can share the data volume containing the files with the new container that you are launcher so that both have a consistent filesystem.

(Duarte Ferreira) #5

I'm going to try it.

(system) #6

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.