firecow / gitlab-ci-local

Tired of pushing to test your .gitlab-ci.yml?
MIT License
2.28k stars 128 forks source link

Challenges with Local File Inclusion from Other Projects in Latest Version #1179

Closed finduspedersen closed 5 months ago

finduspedersen commented 5 months ago

Hello gitlab-ci-local maintainers,

First, I express my sincere gratitude for developing and maintaining gitlab-ci-local. This tool has been precious in enhancing my development workflows, and your efforts are greatly appreciated.

I've encountered a limitation with the recent version changes to how local file inclusions are handled. Previously, I could use the following setup in my .gitlab-ci.yml:

include:
  - local: "../otherproject/file.yml"
    rules:
      - if: ${GITLAB_CI} == "false"
  - project: "otherproject"
    file: "file.yml"
    rules:
      - if: ${GITLAB_CI} == "true"

This configuration allowed me to include a file from another GitLab project cloned to a local folder in my local development environment. However, the stricter implementation in the latest version no longer supports this method.

While I fully understand and respect the efforts to align gitlab-ci-local's functionality closely with GitLab, it introduces challenges for utilizing gitlab-ci-local in a multi-repository inner development loop. This setup is critical as it allows developers like myself to maintain a very rapid code-build-test cycle locally, which is exactly what gitlab-ci-local excels at facilitating.

I attempted to use the --volume option to make the file from the other project's local folder accessible within this project. As expected, this does not work because include:local processes files before the Docker container starts.

Ideally, the most straightforward solution would be to eliminate the include:local variation altogether, relying solely on include:project and include:file as I would in a GitLab environment. However, this would require configuring gitlab-ci-local to access other GitLab projects at different local paths. Is there a way to accomplish this, or are there any plans to support such a feature?

Any suggestions or guidance on better handling this situation would be greatly appreciated.

Thank you for your support, and I look forward to any possible solutions!

firecow commented 5 months ago

image

Is your example even passing gitlab lint ? @finduspedersen

ANGkeith commented 5 months ago

@finduspedersen, sorry for the breaking changes introduced

Do you think this workaround is sufficient ? image

ANGkeith commented 5 months ago

@firecow

i believe the author is aware that it does'nt pass the gitlab-lint,

But he wants to be able to include: local from another directory for quicker local iteration ?

How should we proceed from here though..

Is the proposed workaround good enough ? or should we introduce yet another cli flag to allow the "directory traversal"

firecow commented 5 months ago

I don't like the idea, that gitlab-ci-local should facilitate what can be done via a symlink.