Closed stiv-pro closed 1 month ago
Using b723ffd (which is tagged as 4.49.0) I cannot reproduce the same issue locally (maybe there is more to the remote URL than the ssh prefix?)
---
job:
script:
- echo "Heya"
$ git remote show
origin
$ git remote get-url origin
ssh://git@github.com:firecow/gitlab-ci-local.git
$ gitlab-ci-local
git remote get-url origin didn't provide valid matches
parsing and downloads finished in 71 ms
job starting shell (test)
job $ echo "Heya"
job > Heya
job finished in 19 ms
PASS job
pipeline finished in 184 ms
You can create a second remote called gcl-origin
which is preferred over origin
. So in this case
$ git remote add gcl-origin https://github.com/firecow/gitlab-ci-local.git
$ git remote show
gcl-origin
origin
$ gitlab-ci-local
parsing and downloads finished in 42 ms
job starting shell (test)
job $ echo "Heya"
job > Heya
job finished in 28 ms
PASS job
pipeline finished in 164 ms
You can see that the warning about no valid matches has disappeared. So I think this is fixed on master, and you can work around it in your local installation by setting the gcl-origin
remote to a https://
address.
First, thank you for the answer.
I should have been more precise in my description, I forgot to mention I had to comment the component part of my gitlab-ci file
to be able to downgrade in 4.48.2
But in fact , in 4.49
, it works well without component
...
When I uncomment the line, I get the ssh not supported!
error.
include:
- component: gitlab.mycompany.com/ci-templates/workflow@~latest
I followed guidelines here to write the component location : https://docs.gitlab.com/ee/ci/components/#use-a-component
Sounds more related to the last commit :D
Tried to play with location syntax but all I got is : This GitLab CI configuration is invalid: component: <various URLs> should not contain protocol
I probably can't fully reproduce your use case (since I don't know how gitlab.yourcompany.com
is set up with regards to authentication), but on 4.49 I was at least able to do the following
# .gitlab-ci.yml
---
include:
- component: gitlab.com/PigeonF/tests/foo@main
Note that gitlab.com/PigeonF/tests
is a private repository which I assume your company repositories are as well.
# gitlab.com/PigeonF/tests repository, templates/foo.yml file
spec:
inputs:
stage:
default: test
---
example:
stage: $[[ inputs.stage ]]
script: echo Hello, World
$ git remote get-url origin
ssh://git@github.com:firecow/gitlab-ci-local.git
$ git remote get-url gcl-origin
git@gitlab.com:PigeonF/tests.git
As far as I can tell the gcl-origin
can be whatever, so long as it has the gitlab.com
(which in your case would have to be gitlab.yourcompany.com
and user/project.git
format.
$ gitlab-ci-local
parsing and downloads finished in 1.57 s
example starting shell (test)
example $ echo Hello, World
example > Hello, World
example finished in 51 ms
PASS example
pipeline finished in 1.74 s
I am not sure why you need to prefix your origin with ssh://
, for me it works even without. But regardless, you can keep your origin as is and just change gcl-origin
. I dont think it needs to point to a valid repository, just make sure to have the domain and make sure to end it in .git
so it is recognized properly (I was able to repeat the above with gcl-origin set to git@gitlab.com:foo/bar.git
.
If that does not work (i.e. the implicit ssh://
does not work), you can set your credentials in the https URL see stackoverflow). So you would git remote add gcl-origin https://user:pass@gitlab.yourcompany.com/som/repo.git
.
Let me know how it goes
@PigeonF thanks for looking into it,
i missed out a case in my switch statement 😅
@stiv-pro thanks for the bug report
OS ubuntu 24.04 No need to tell more than that I think ? By the way, thank you mainteners and contributors for this project !