git (itself) allow you to create rewrite rules that let you replace URL
prefixes, for either host mapping, or shorthands:

[url "https://github.com"/]
   insteadOf = gh:

[url "https://newhost.com";]
  insteadOf: https://oldhost.com/

[url "https://firewallhost.com";]
  insteadOf: https://publichost.com/

Then: git clone gh:org/repo => https://github.com/org/repo
or: git clone https://oldhost.com/repo => https://newhost.com/repo
or: git clone https://publichost.com/repo => https://firewallhost.com/repo

If Jenkins is using cmd-line git on the client, then it should observe
these config settings if in $HOME/.gitconfig (config --global).



On Tue, Jan 23, 2018 at 1:17 AM, Stephen Connolly <
stephen.alan.conno...@gmail.com> wrote:

>
> On Tue 23 Jan 2018 at 01:32, Guy Knights <guy.knig...@gmail.com> wrote:
>
>> I have a bit of an issue I've run into. I've set up git mirrors in
>> separate subnets and would like my pipeline jobs to use these mirrors as
>> the pipeline job source. Until now, we've had a central gitlab repo which
>> we allowed access to through our firewall for each remote subnet.
>>
>> I changed the url to the mirror url but hit a problem immediately. The
>> job is started on the master, which clones/pulls the repo source in order
>> to access the jenkinsfile. Inside the jenkinsfile is an agent definition
>> that transfers the pipeline execution to a jenkins agent in the remote
>> subnet. The problem is that the master accesses our local gitlab, while the
>> agent nodes are blocked from gitlab and need to instead access the git
>> mirror (which is on the same server, for the record).
>>
>> I will probably have to add a mirror to the jenkins server so both master
>> and agents can use a local file:// type url to access it, but I thought I'd
>> check here first and see if there's a way to set different repo urls for
>> the jenkins master vs the agent nodes. Is this possible?
>>
>
> It’s all 1’s and 0’s so anything is possible... the real question is
> whether it is easy...
>
> If you are using pipeline, you can override the default checkout and
> replace it with a checkout of the git mirror... with a NODE_NAME ==
> ‘master’ ? “Gitlab url” : “git mirror url” expression for the repository
> URL.
>
> You will need to play some dancing games to get the revision and branch to
> be selected if using multibranch type projects.
>
> HTH
>
>>
>>
>> Thanks,
>> Guy
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Jenkins Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to jenkinsci-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit https://groups.google.com/d/
>> msgid/jenkinsci-users/CANNH9msyOU1BWTGz%2BZnLJ%2B%
>> 3DufRupgAY1ptqF3Fa1oFodo2GcEQ%40mail.gmail.com
>> <https://groups.google.com/d/msgid/jenkinsci-users/CANNH9msyOU1BWTGz%2BZnLJ%2B%3DufRupgAY1ptqF3Fa1oFodo2GcEQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> Sent from my phone
>
> --
> You received this message because you are subscribed to the Google Groups
> "Jenkins Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to jenkinsci-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/jenkinsci-users/CA%2BnPnMxRSDPWYopfwppn2qX9VO9Lk0
> PzLr9rfsXuaCEH%2BheXDw%40mail.gmail.com
> <https://groups.google.com/d/msgid/jenkinsci-users/CA%2BnPnMxRSDPWYopfwppn2qX9VO9Lk0PzLr9rfsXuaCEH%2BheXDw%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
-Justin

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/CAGvUWmERhe1RuEOOOU2-sdTKgHAiRBZnxuL7aUFL01b-P7%3D45g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to