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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow running CI component locally #1272

Closed
hverlin opened this issue Jun 26, 2024 · 0 comments · Fixed by #1273
Closed

Allow running CI component locally #1272

hverlin opened this issue Jun 26, 2024 · 0 comments · Fixed by #1273
Assignees

Comments

@hverlin
Copy link
Collaborator

hverlin commented Jun 26, 2024

Is your feature request related to a problem? Please describe.

Assuming I have the following component defined in templates/my-component

# templates/my-component.yml
---
component-job:
  script: echo job 1

and I am importing with:

# .gitlab-ci.yml

include:
  - component: $CI_SERVER_HOST/$CI_PROJECT_PATH/my-component@$CI_COMMIT_SHA

or (after GitLab 16.10)

# .gitlab-ci.yml

include:
  - component: $CI_SERVER_FQDN/$CI_PROJECT_PATH/my-component@$CI_COMMIT_SHA

I would like this job to work locally (as shown in the test the component section https://docs.gitlab.com/ee/ci/components/#test-the-component)

image

Currently, it fails with the following error as it tries to resolve it from the server

Error: Error: Command failed with exit code 1: git archive --remote=ssh://git@[....]hverlin/gitlab-ci-testing.git 69a491ee216c917d8a64c14bcea64234e5d4def1 templates/my-component.yml
fatal: sent error to the client: git upload-archive: archiver died with error
remote: fatal: no such ref: 69a491ee216c917d8a64c14bcea64234e5d4def1        
remote: git upload-archive: archiver died with error

Describe the solution you'd like
I think we could make gitlab-ci-local try to import from local when CI_COMMIT_SHA is used, as it will always fail?

Describe alternatives you've considered
Maybe adding a special directive/comment to indicate how to resolve it on local

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

Successfully merging a pull request may close this issue.

1 participant