firecow / gitlab-ci-local

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

Includes not working on self-hosted gitlab #1442

Open ojsef39 opened 1 day ago

ojsef39 commented 1 day ago

Minimal .gitlab-ci.yml illustrating the issue

---
stages: [build]
include:
  - project: 'https://git.url.de/group/gitlab-ci-templates'
    file:
      - Jobs/Job.gitlab-ci.yml

Expected behavior Getting includes from correct URL not gitlab.com/self-hosted.url/ (Not public)

Host information macOS 15.1.1 (24B91) gitlab-ci-local 4.55.0

Containerd binary podman

Additional context Logs:

🚀 gitlab-ci-local --stage build --fetch-includes
(node:41459) ExperimentalWarning: Importing JSON modules is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
git remote get-url origin didn't provide valid matches
Project include could not be fetched { project: https://git.url.de/group/gitlab-ci-templates, ref: HEAD, file: Jobs/Job.gitlab-ci.yml }
Error: Command failed with exit code 128: set -eou pipefail; git archive --remote=ssh://git@gitlab.com:22/https://git.url.de/group/gitlab-ci-templates.git HEAD Jobs/Job.gitlab-ci.yml | tar -f - -xC .gitlab-ci-local/includes/gitlab.com/https://git.url.de/group/gitlab-ci-templates/HEAD/
remote:
remote: ========================================================================
remote:
remote: ERROR: The namespace you were looking for could not be found.

remote:
remote: ========================================================================
remote:
fatal: the remote end hung up unexpectedly

🗂  repo on ⚡add_tests
🚀 git remote get-url origin
https://git.url.de/group/group/repo/
ojsef39 commented 1 day ago

Ive also tried using variables to set the HOST and so one but had no luck with that, something like this:

ojsef39 commented 11 hours ago

Pretty ugly but this workaround does the trick:

stages: [build]

include:
  - remote: 'https://git.url.de/group/gitlab-ci-templates/-/raw/main/Jobs/Job.gitlab-ci.yml'

Also had to set NODE_EXTRA_CA_CERTS="$(brew --prefix)/etc/ca-certificates/cert.pem" so it works with on macos with a self-signed cert

ANGkeith commented 11 hours ago
---
stages: [build]
include:
  - project:  'group/gitlab-ci-templates' 
    file:
      - Jobs/Job.gitlab-ci.yml

I don't have a self hosted gitlab to test... but this should work with gitlab-ci-local

though, i am not sure whether your self hosted gitlab will implicitly read the include:project from gitlab.com or git.url.de ?


We currently do not supports this syntax - project: 'https://git.url.de/group/gitlab-ci-templates' ...

wasn't aware that this is supported, since it does'nt seemed to be documented in gitlab.com docs