Hi all,
i am totally new to CI, decided to try it actually just to build a small cortex-m4 firmware.
Found some examples, using “dind”, and not sure if it’s the right way, but at least this solution seems not requiring to install anything on a server.
Issues i am having now are:
- once docker in docker is executed (docker run) gitlab project files are located in /builds/spectrum70/zion-firmware but seems i can access them only after a “ls -al /”
(so have to do something like docker run image ls -al /; /builds/spectrum70/zion-firmware/script.sh), otherwise i get a file not found. This seems strange.
- even if make command should be installed in the final docker, seems it’s not there
/builds/spectrum70/zion-firmware/scripts/test.sh: line 13: make: not found
Every help really appreciated. Thanks !
You can check dockerfile and https://gitlab.com/spectrum70/zion-firmware/-/blob/master/.gitlab-ci.yml
Job error;
(https://gitlab.com/spectrum70/zion-firmware/-/jobs/558305471)
Regards,
angelo
Hi,
interesting project Can you share which example you’ve used to chime into GitLab CI/CD? I’m curious on the recommendations.
Looking into the job output, it mentions the error. make
is a build tool the container must provide. This is not the case for the DinD container.
I’m wondering about the steps you have taken thus far, this commit adds a Docker image build:
The missing make
can be fixed with adding it into the dind container, but imho this script gets executed in the wrong place.
build:
stage: build
script:
- docker build -t $IMAGE_TAG .
- apk add make
- docker run -v "$MOUNT_POINT:/mnt" $IMAGE_TAG /mnt/scripts/test.sh
- docker push $IMAGE_TAG
The build and clean steps should happen in a new container which is is run from the previous build. Took me a while to figure out what the content of test.sh
is actually supposed to do.
cd /mnt/libc
make clean
make
cd ../lib
make clean
make
cd ../thermo
make clean
make
CI/CD Pipeline
At that point I had forked the repository already, and have been playing around. Long story short:
- 2 stages are needed:
- First, build the container image and push it to the registry
- Second, pull the image and run a container with it, build the source in there
- The path logic with
cd
inside the build script needed fixes. I’ve also renamed test.sh
into build.sh
to have a better name.
- The generated artifacts were not uploaded, I have now added an example for
thermo/*.bin
. Reverse engineering Makefiles is not fun
I’ve fixed the CI/CD pipeline and made it work. You just need to look into the merge request and merge it then
And while at it, I have blogged about my analysis and how I did go there. Hope it helps!
Cheers,
Michael
Hi Michael,
really thanks a lot for the help and the time you spent on solving this. I have read your reply now, and i already could solve the issues, but checking now your way, likely, more correct way to do the things.
Thanks,
Angelo
1 Like