前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Jenkins Pipeline 动态指定 gitUrl 和 gitBranch

Jenkins Pipeline 动态指定 gitUrl 和 gitBranch

原创
作者头像
特特
发布2022-03-18 14:04:27
8180
发布2022-03-18 14:04:27
举报

0. 本次只针对jenkins 流水线和多分支流水线的job类型讲解动态指定git的问题

在这里插入图片描述
在这里插入图片描述

1. 错误的配置如下图

在这里插入图片描述
在这里插入图片描述

执行报错

15:29:43  Started by user admin
15:29:43  Rebuilds build #18
15:29:43  hudson.plugins.git.GitException: Command "git fetch --tags --progress --prune -- origin +refs/heads/master:refs/remotes/origin/master" returned status code 128:
15:29:43  stdout: 
15:29:43  stderr: fatal: '${PIPELINE_GIT_URL}' does not appear to be a git repository
15:29:43  fatal: Could not read from remote repository.
15:29:43  
15:29:43  Please make sure you have the correct access rights
15:29:43  and the repository exists.
15:29:43  
15:29:43  	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2450)
15:29:43  	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:2051)
15:29:43  	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$500(CliGitAPIImpl.java:84)
15:29:43  	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:573)
15:29:43  	at jenkins.plugins.git.GitSCMFileSystem$BuilderImpl.build(GitSCMFileSystem.java:365)
15:29:43  	at jenkins.scm.api.SCMFileSystem.of(SCMFileSystem.java:197)
15:29:43  	at jenkins.scm.api.SCMFileSystem.of(SCMFileSystem.java:173)
15:29:43  	at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:115)
15:29:43  	at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:69)
15:29:43  	at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:309)
15:29:43  	at hudson.model.ResourceController.execute(ResourceController.java:100)
15:29:43  	at hudson.model.Executor.run(Executor.java:433)
15:29:43  Finished: FAILURE

2. 正确的配置如下图

在这里插入图片描述
在这里插入图片描述

3.轻量级检查的名词解释

英文描述

If selected, try to obtain the Pipeline script contents directly from the SCM without performing a full checkout. The advantage of this mode is its efficiency; however, you will not get any changelogs or polling based on the SCM. (If you use checkout scm during the build, this will populate the changelog and initialize polling.) Also build parameters will not be substituted into SCM configuration in this mode. Only selected SCM plugins support this mode.

中文描述

如果选中,请尝试直接从SCM获取管道脚本内容,而不执行完全签出。这种模式的优点是效率高;但是,您不会得到任何基于SCM的变更日志或轮询。(如果在构建期间使用checkout scm,这将填充变更日志并初始化轮询。)在这种模式下,构建参数也不会被替换到SCM配置中。只有选定的SCM插件支持此模式。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 0. 本次只针对jenkins 流水线和多分支流水线的job类型讲解动态指定git的问题
  • 1. 错误的配置如下图
  • 2. 正确的配置如下图
  • 3.轻量级检查的名词解释
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档