Open krupis opened 1 week ago
Normally, I run the docker image using --it flag which allows me to wander inside the docker container and see what is going on there
The entrypoint of such an image is probably set to be a shell of some sort. The entrypoint of amake/innosetup is the InnoSetup executable (iscc); thus the result of docker run
is the same as running iscc without any arguments—it prints the help text.
If you want to run a shell, specify the entrypoint to be e.g. /bin/bash
with the --entrypoint flag:
% docker run -it --rm --entrypoint /bin/bash amake/innosetup
xclient@8c35f8675f70:/work$
I tried to use docker executor but since it does not have interactive mode I dont think this is possible?
I've never used a Docker image in CI in "interactive mode". I think you are barking up the wrong tree.
I don't know anything about Gitlab's CI so I can't give any specific advice, but I don't think you wan to run your job/task "in" amake/innosetup; in other words you shouldn't specify amake/innosetup for your job's image
. You want to run docker run --rm -i -v $PWD:/work amake/innosetup work/Create_install.iss
as part of a script executed by your job.
Thanks for some useful insights. Using docker executor in gitlab-runner only works if the default entrypoint is a shell.
For this particular case, since it is not a shell, I have changed to shell executor for my gitlab-runner meaning it will simply start a shell on the VM where the Gitlab-runner is installed.
build_job:
variables:
GIT_SUBMODULE_STRATEGY: normal
rules:
- if: $CI_COMMIT_TAG # Run this job when a tag is created
tags:
- shell
allow_failure: true
stage: build
script:
- echo "Preparing to generate setup"
- ls -l
- ls -l Install
- id
- chmod -R 777 Install
- docker run --rm -i -v $PWD:/work amake/innosetup Install/Create_install.iss
The above seems to work and generate a setup for my application. I also had to make sure gitlab-runner is added to docker group to ensure it has privilleges to run docker command:
sudo usermod -aG docker gitlab-runner
Hope this is helpful for someone else :)
Although there is still one issue:
When a directory Install_executables
is created during the CI/CD setup creation process, I can see that it is has the following permissions:
$ ls -l Install
total 12
-rwxrwxrwx 1 gitlab-runner gitlab-runner 4422 Jun 28 16:03 Create_install.iss
drwxr-xr-x 2 administrator systemd-journal 4096 Jun 28 16:03 Install_executables
So when I try to run a JOB for a second time, it fails the clean up old job artifacts:
Running with gitlab-runner 16.6.1 (f5da3c5a)
on generic shell KbZwcgsRr, system ID: s_1de69ef5[2](https://xxx-xxx.test.lt/kontraktine/test-tool-binaries/-/jobs/1242#L2)8ed
Preparing the "shell" executor
00:00
Using Shell (bash) executor...
Preparing environment
00:00
Running on xxx-xxx...
Getting source from Git repository
00:0[3](https://xxx-xxx.test.lt/kontraktine/test-tool-binaries/-/jobs/1242#L3)
Fetching changes with git depth set to 20...
Reinitialized existing Git repository in /home/gitlab-runner/builds/KbZwcgsRr/0/kontraktine/test-tool-binaries/.git/
Checking out 8[4](https://xxx-xxx.test.lt/kontraktine/test-tool-binaries/-/jobs/1242#L4)8ea069 as detached HEAD (ref is 1.0.1)...
warning: failed to remove Install/Install_executables/ODM026_TestTool_3.0.1.0_Config_0.0.0.1_setup.exe: Permission denied
Removing JOB_ID.txt
Removing release_notes.md
Uploading artifacts for failed job
00:00
Uploading artifacts...
Runtime platform arch=amd64 os=linux pid=64381 revision=f[5](https://xxx-xxx.test.lt/kontraktine/test-tool-binaries/-/jobs/1242#L5)da3c5a version=16.6.1
WARNING: JOB_ID.txt: no matching files. Ensure that the artifact path is relative to the working directory (/home/gitlab-runner/builds/KbZwcgsRr/0/kontraktine/test-tool-binaries)
ERROR: No files to upload
Cleaning up project directory and file based variables
00:00
ERROR: Job failed: exit status 1
I am now trying to understand whether that is an issue from the gitlab-runner or the Create_install.iss side.
Hello. I am quite new at docker. I have previously used some docker images. Normally, I run the docker image using --it flag which allows me to wander inside the docker container and see what is going on there. See example of interactive mode that I use for another docker image:
I have noticed that amake/innosetup docker image does not allow that. For some reason it automatically kicks me out of the docker container after it is run:
I have found a way how to generate a setup if I run the docker via my server VM:
I am now trying to find a way how to generate setup using Gitlab CI/CD. I tried to use docker executor but since it does not have interactive mode I dont think this is possible? I tried the following CI/CD script:
But I get the following error:
I would very much appreciate if someone could shed some light on how I can use this docker image with gitlab-runner with docker executor to generate setup for my project.