Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

gitlab-ci-local sometimes update original sources file when artifacts requested #1034

Open
airone-x1 opened this issue Nov 14, 2023 · 7 comments
Labels
elaborate Further elaboration is needed

Comments

@airone-x1
Copy link

I use marmail-cli in my CI.
When using gitlab-ci-local 馃憤

  • 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.

@firecow
Copy link
Owner

firecow commented Nov 14, 2023

This must be a bug.

gitlab-ci-local is not supposed to change project specific file permissions.

@firecow firecow added the bug Something isn't working label Nov 14, 2023
@airone-x1
Copy link
Author

I don't know if it matters, my docker is rootless.

@drAlberT
Copy link

drAlberT commented Nov 15, 2023

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.

@firecow
Copy link
Owner

firecow commented Nov 24, 2023

---
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?

@firecow firecow added elaborate Further elaboration is needed and removed bug Something isn't working labels Nov 24, 2023
@airone-x1
Copy link
Author

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_ ?

@firecow
Copy link
Owner

firecow commented Nov 28, 2023

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.

@airone-x1
Copy link
Author

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
elaborate Further elaboration is needed
Projects
None yet
Development

No branches or pull requests

3 participants