firecow / gitlab-ci-local

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

CI_REGISTRY has local-registry prefix #1119

Closed avoidik closed 6 months ago

avoidik commented 6 months ago

Minimal .gitlab-ci.yml illustrating the issue

# .gitlab-ci-local/variables.yml
---
global:
  CI_REGISTRY: "valid.url.here:1234"
# .gitlab-ci.yml
cool_job_here:
  stage: build
  image: ${CI_REGISTRY}/some.path.here/docker:cli
  services:
    - alias: docker
      name: ${CI_REGISTRY}/some.path.here/docker:dind
  script:
    - whoami
$ export GCL_FILE='.gitlab-ci.yml' 
$ gcl cool_job_here
parsing and downloads finished in 35 ms
cool_job_here starting local-registry.valid.url.here/some.path.here/docker:cli (build)
cool_job_here > still running...
cool_job_here copied to docker volumes in 17 s
Error: Command failed with exit code 1: docker pull local-registry.valid.url.here/some.path.here/docker:dind
Error response from daemon: Get "https://local-registry.valid.url.here/v2/": dial tcp: lookup local-registry.valid.url.here on 127.0.0.53:53: no such host
    at makeError (/Users/user.name/.nvm/versions/node/v18.16.0/lib/node_modules/gitlab-ci-local/node_modules/execa/lib/error.js:60:11)
    at handlePromise (/Users/user.name/.nvm/versions/node/v18.16.0/lib/node_modules/gitlab-ci-local/node_modules/execa/index.js:118:26)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at Job.pullImage (/Users/user.name/.nvm/versions/node/v18.16.0/lib/node_modules/gitlab-ci-local/src/job.ts:784:13)
    at /Users/user.name/.nvm/versions/node/v18.16.0/lib/node_modules/gitlab-ci-local/src/job.ts:456:21
    at async Promise.all (index 0)
    at Job.start (/Users/user.name/.nvm/versions/node/v18.16.0/lib/node_modules/gitlab-ci-local/src/job.ts:453:13)
    at /Users/user.name/.nvm/versions/node/v18.16.0/lib/node_modules/gitlab-ci-local/node_modules/p-map/index.js:57:22

Expected behavior

I would like to be able to control CI_REGISTRY variable so that no prefixes will be added

Host information

$ gcl --version
4.46.1

Containerd binary

$ docker --version
Docker version 25.0.3, build 4debf411d1

Additional context

culprit: https://github.com/firecow/gitlab-ci-local/commit/5ecafe0ba32fe5bdf71392dcdda13698efd1b098#diff-a66bffdb979d130e04df61edb944cc04d2fdedf8117ca2732cb6d119d5f5e7b2R136

avoidik commented 6 months ago

it seems CI_REGISTRY is just ignored if I set it as a global variable

avoidik commented 6 months ago

disregard, I should've been set --home "$(cwd)"