jenkins-cli icon indicating copy to clipboard operation
jenkins-cli copied to clipboard

when use "jcli cwp", can use mirror to download plugins?

Open usernameisnull opened this issue 2 years ago • 4 comments

Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

I am in China, so I always encounter network problems and download plugins are too slow or fail. Is it possible to use mirror sources in China, such as Tsinghua or Tencent, when using the "jcli cwp" command. Or this feature needs to be supported by the "cwp" project .

Or specify the mirror source like the "jcli center download -m tencent" command

Describe the solution you'd like A clear and concise description of what you want to happen.

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Additional context Add any other context or screenshots about the feature request here.

usernameisnull avatar Jun 11 '22 18:06 usernameisnull

may be I just need to specify maven mirror? I saw the console output,sorry I am just a rookie

usernameisnull avatar Jun 11 '22 19:06 usernameisnull

The command jcli cwp downloads plugins from the center Maven repository, so I think it should be hard to specific a maven mirror.

See also https://github.com/jenkins-zh/jenkins-cli/blob/a8a75cc3daac587456f410232f52ae2fd5fca05f/app/cmd/cwp.go#L142

I'm not sure about this. But you can try to add a mirror to ~/.m2/config

LinuxSuRen avatar Jun 12 '22 00:06 LinuxSuRen

我用jcli cwp指定--mvn-settings-file /usr/local/apache-maven-3.6.3/conf/settings.xml ,但是从jcli的执行日志来看,并没有从我自己settings.xml里配置的mirror去下载依赖

SsLaLal avatar Jul 26 '23 08:07 SsLaLal

我用jcli cwp指定--mvn-settings-file /usr/local/apache-maven-3.6.3/conf/settings.xml ,但是从jcli的执行日志来看,并没有从我自己settings.xml里配置的mirror去下载依赖

确实是的,这个参数没有被用到。

https://github.com/search?q=repo%3Ajenkins-zh%2Fjenkins-cli%20MvnSettingsFile&type=code

感兴趣的话,在下面的代码处增加参数引用应该能解决这个问题:

  • https://github.com/jenkins-zh/jenkins-cli/blob/c4a03f2200f3d091dfe1a3d6f7821e4df4e98ca5/app/cmd/cwp.go#L173C43-L173C57
  • https://github.com/jenkinsci/custom-war-packager/blob/a7c94fa271ca7084acad725f4799944573a65dbf/custom-war-packager-cli/src/main/java/io/jenkins/tools/warpackager/cli/CliOptions.java#L15C21-L15C36

LinuxSuRen avatar Jul 26 '23 08:07 LinuxSuRen