gitlab-ci-local icon indicating copy to clipboard operation
gitlab-ci-local copied to clipboard

`Project include could not be fetched` when remote include is http(s)

Open danstoner opened this issue 5 months ago • 0 comments

Minimal .gitlab-ci.yml illustrating the issue

---
include:
  - project: earthscope/infrastructure/gitlab-ci

Which contains:

include:
# ...
  - local: gitlab-ci/job-template-*.yml

Expected behavior Wildcards in includes are supported.

https://docs.gitlab.com/ci/yaml/includes/#use-includelocal-with-wildcard-file-paths

Host information MacOS 15.6.1 gitlab-ci-local 4.61.1

Containerd binary Docker.

Additional context

I noticed the pipeline works fine if the git checkout uses an SSH remote repository, it only occurs on an HTTPS checkout, which led me to this part of the code which is taking two different code paths depending on the remote scheme:

            if (remote.schema.startsWith("http")) {
...

and seems to be barfing on the wildcard filename.

$ gitlab-ci-local --list
Project include could not be fetched { project: earthscope/infrastructure/gitlab-ci, ref: HEAD, file: job-template-*.yml }
Error: Command failed with exit code 1: cd /private/tmp/sample-python-http/sample-python/.gitlab-ci-local && \git clone  -n --depth=1 --filter=tree:0 https://gitlab.com:443/earthscope/infrastructure/gitlab-ci.git /private/tmp/sample-python-http/sample-python/.gitlab-ci-local/includes/gitlab.com/earthscope/infrastructure/gitlab-ci/HEAD.tmp-0.49170569626555727 && \cd /private/tmp/sample-python-http/sample-python/.gitlab-ci-local/includes/gitlab.com/earthscope/infrastructure/gitlab-ci/HEAD.tmp-0.49170569626555727 && \git sparse-checkout set --no-cone job-template-*.yml && \git checkout && \cd /private/tmp/sample-python-http/sample-python/.gitlab-ci-local && \cp /private/tmp/sample-python-http/sample-python/.gitlab-ci-local/includes/gitlab.com/earthscope/infrastructure/gitlab-ci/HEAD.tmp-0.49170569626555727/job-template-*.yml /private/tmp/sample-python-http/sample-python/.gitlab-ci-local/includes/gitlab.com/earthscope/infrastructure/gitlab-ci/HEAD/job-template-*.yml
Cloning into '/private/tmp/sample-python-http/sample-python/.gitlab-ci-local/includes/gitlab.com/earthscope/infrastructure/gitlab-ci/HEAD.tmp-0.49170569626555727'...
cp: /private/tmp/sample-python-http/sample-python/.gitlab-ci-local/includes/gitlab.com/earthscope/infrastructure/gitlab-ci/HEAD/job-template-release.yml is not a directory
Your branch is up to date with 'origin/main'.

If I use a checkout with an ssh remote and no other changes, the command works fine.

$ gitlab-ci-local --list
parsing and downloads finished in 1.83 s.
json schema validated in 81 ms
name                   description  stage         when        allow_failure  needs
build/rc                            build         on_success  false      
...

danstoner avatar Sep 15 '25 19:09 danstoner