gitlab-ci-local
gitlab-ci-local copied to clipboard
gitlab-ci-local sometimes update original sources file when artifacts requested
I use marmail-cli in my CI. When using gitlab-ci-local :+1:
- original sources files are updated while mermaid-cli run contenairized
- permissions on source directory are also updated
Minimal .gitlab-ci.yml illustrating the issue
marmaid_svg:
image:
name: docker.io/minlag/mermaid-cli
entrypoint: [""]
script:
- MMDC="/home/mermaidcli/node_modules/.bin/mmdc -p /puppeteer-config.json"
- $MMDC -i docs/index.md -o docs/index2.md
artifacts:
paths:
- docs/
expire_in: "30 mins"
Expected behavior updated artifacts in .gitlab-ci-local not in original sources
Host information Ubuntu gitlab-ci-local 4.45.1
Containerd binary Docker
Additional context
Sample project https://github.com/airone-x1/gcl-mermaidcli
After running gitlab-ci-local
-
docs/ source directory become mod 777
-
docs/ contains mermaid-cli output (svg, transformed md).
-
If i remove artifact statement my sources are not updated.
I expect gitlab-ci-local writing only in its own .gitlab-ci-local directory, not in my project files.
This must be a bug.
gitlab-ci-local is not supposed to change project specific file permissions.
I don't know if it matters, my docker is rootless.
I have a similar problem with the artifact from a docker build.
Doing docker save $IMAGE | gzip -c > artifact.tgz
creates the file in the project root, but I can't find a way to remove it after the artifact has been uploaded.
Tried to use $CI_BUILDS_DIR
hoping to operate inside .gitlab-ci-local/build/
dir but no luck.
---
test-job:
image:
name: alpine
script:
- echo "hello" > test.txt
- chmod 777 test.txt
- chown 0:0 text.txt
artifacts:
paths:
- test.txt
Because #NoArtifactsToSource decorator is missing the test.txt
is copied to the hosts cwd with 777 file permissions, but not 0:0 ownership, which is expected.
Can you try to simplify your example, so it's easier for me to reproduce?
OK, thanks , so it's a kind of RTFM bug ;) , I haven't seen https://github.com/firecow/gitlab-ci-local#the-noartifactstosource-decorator
On the other side Docker executor copies artifacts to and from .gitlab-ci-local/artifacts . Your exemple it's a docker executor so artefacts shouldn't have been written in .gitlab-ci-locals/artifacts_ ?
In the very beginning gitlab-ci-local
was pure shell executor without build folder isolating capabilities.
So artifacts to source is a ghost from the past, that will be opt-in in the next 5.x.x release
It will be written to both locations.
opt-in in the next 5.x.x release is perfect, thank you
Until then we can use an alias gcl='gitlab-ci-local --no-artifacts-to-source'
(no success trying to define this option in $HOME/.gitlab-ci-local
)