名称必须遵循 Jenkins Build 上的模式
Name must follow the pattern on Jenkins Build
我需要你的帮助来解决这个难题。
在我的工作中,我们有一个 Jenkins 管道来构建我们的一个项目,一个用于我们许多项目的库。
该管道在上周之前按预期工作。我做了一些更改并更新了一些依赖项,现在 Jenkins 上的构建无法正常工作。
为了 运行 我们在 Jenkins 上的测试,我们有这个 Docker 我们创建的图像。带有 Java 8、Gradle 6.9.2 和一些证书的映像,用于在 Active Directory 上连接。
问题发生在执行JUnit测试的阶段。
我们使用的镜像名称是gradle692-certs-win-ad:gradle-6.9.2-jdk8
错误:
ERROR: Name must follow the pattern '^[a-zA-Z0-9]+((\.|_|__|-+)[a-zA-Z0-9]+)*$'
18:59:41 at hudson.util.FormValidation._errorWithMarkup(FormValidation.java:266)
18:59:41 at hudson.util.FormValidation.errorWithMarkup(FormValidation.java:252)
18:59:41 at hudson.util.FormValidation.error(FormValidation.java:143)
18:59:41 at hudson.util.FormValidation.error(FormValidation.java:168)
18:59:41 at org.jenkinsci.plugins.docker.commons.credentials.ImageNameValidator.validateName(ImageNameValidator.java:289)
18:59:41 at org.jenkinsci.plugins.docker.commons.credentials.ImageNameValidator.validateUserAndRepo(ImageNameValidator.java:115)
18:59:41 at org.jenkinsci.plugins.docker.commons.credentials.DockerRegistryEndpoint.imageName(DockerRegistryEndpoint.java:317)
18:59:41 at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
18:59:41 at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
18:59:41 at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
18:59:41 at java.base/java.lang.reflect.Method.invoke(Unknown Source)
18:59:41 at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
18:59:41 at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
18:59:41 at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1213)
18:59:41 at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
18:59:41 at org.codehaus.groovy.runtime.callsite.PojoMetaClassSite.call(PojoMetaClassSite.java:47)
18:59:41 at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
18:59:41 at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
18:59:41 at com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:20)
18:59:41 at org.jenkinsci.plugins.docker.workflow.Docker$Image.toQualifiedImageName(Docker.groovy:106)
18:59:41 at org.jenkinsci.plugins.docker.workflow.Docker$Image.imageName(Docker.groovy:110)
18:59:41 at org.jenkinsci.plugins.docker.workflow.Docker$Image.inside(Docker.groovy:115)
18:59:41 at org.jenkinsci.plugins.docker.workflow.Docker.node(Docker.groovy:66)
18:59:41 at org.jenkinsci.plugins.docker.workflow.Docker$Image.inside(Docker.groovy:114)
18:59:41 at org.jenkinsci.plugins.docker.workflow.declarative.DockerPipelineScript.runImage(DockerPipelineScript.groovy:57)
18:59:41 at org.jenkinsci.plugins.docker.workflow.declarative.AbstractDockerPipelineScript.configureRegistry(AbstractDockerPipelineScript.groovy:73)
18:59:41 at org.jenkinsci.plugins.docker.workflow.declarative.AbstractDockerPipelineScript.run(AbstractDockerPipelineScript.groovy:43)
18:59:41 at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.inDeclarativeAgent(ModelInterpreter.groovy:594)
18:59:41 at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.evaluateStage(ModelInterpreter.groovy:272)
18:59:41 at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.stageInput(ModelInterpreter.groovy:356)
18:59:41 at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.stageInput(ModelInterpreter.groovy:355)
18:59:41 at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.evaluateStage(ModelInterpreter.groovy:261)
18:59:41 at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.inWrappers(ModelInterpreter.groovy:618)
18:59:41 at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.inWrappers(ModelInterpreter.groovy:617)
18:59:41 at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.evaluateStage(ModelInterpreter.groovy:259)
18:59:41 at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.withEnvBlock(ModelInterpreter.groovy:443)
18:59:41 at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.withEnvBlock(ModelInterpreter.groovy:442)
18:59:41 at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.evaluateStage(ModelInterpreter.groovy:254)
18:59:41 at ___cps.transform___(Native Method)
18:59:41 at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:86)
18:59:41 at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:113)
18:59:41 at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:83)
18:59:41 at jdk.internal.reflect.GeneratedMethodAccessor354.invoke(Unknown Source)
18:59:41 at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
18:59:41 at java.base/java.lang.reflect.Method.invoke(Unknown Source)
18:59:41 at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
18:59:41 at com.cloudbees.groovy.cps.impl.LocalVariableBlock$LocalVariable.get(LocalVariableBlock.java:39)
18:59:41 at com.cloudbees.groovy.cps.LValueBlock$GetAdapter.receive(LValueBlock.java:30)
18:59:41 at com.cloudbees.groovy.cps.impl.LocalVariableBlock.evalLValue(LocalVariableBlock.java:28)
18:59:41 at com.cloudbees.groovy.cps.LValueBlock$BlockImpl.eval(LValueBlock.java:55)
18:59:41 at com.cloudbees.groovy.cps.LValueBlock.eval(LValueBlock.java:16)
18:59:41 at com.cloudbees.groovy.cps.Next.step(Next.java:83)
18:59:41 at com.cloudbees.groovy.cps.Continuable.call(Continuable.java:174)
18:59:41 at com.cloudbees.groovy.cps.Continuable.call(Continuable.java:163)
18:59:41 at org.codehaus.groovy.runtime.GroovyCategorySupport$ThreadCategoryInfo.use(GroovyCategorySupport.java:129)
18:59:41 at org.codehaus.groovy.runtime.GroovyCategorySupport.use(GroovyCategorySupport.java:268)
18:59:41 at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:163)
18:59:41 at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.access[=10=]1(SandboxContinuable.java:18)
18:59:41 at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.run0(SandboxContinuable.java:51)
18:59:41 at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:185)
18:59:41 at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:403)
18:59:41 at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access0(CpsThreadGroup.java:97)
18:59:41 at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.call(CpsThreadGroup.java:315)
18:59:41 at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.call(CpsThreadGroup.java:279)
18:59:41 at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService.call(CpsVmExecutorService.java:67)
18:59:41 at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
18:59:41 at hudson.remoting.SingleLaneExecutorService.run(SingleLaneExecutorService.java:139)
18:59:41 at jenkins.util.ContextResettingExecutorService.run(ContextResettingExecutorService.java:28)
18:59:41 at jenkins.security.ImpersonatingExecutorService.run(ImpersonatingExecutorService.java:68)
18:59:41 at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
18:59:41 at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
18:59:41 at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
18:59:41 at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
18:59:41 at java.base/java.lang.Thread.run(Unknown Source)
18:59:41 Finished: FAILURE
PS:我 运行 在我的本地机器上 gradle 使用相同的基础 docker 图像构建。一切顺利。
又是我
我在 Jenkins 论坛上找到了一个 ticket,它帮助我解决了这个问题。
只是为了解释我做了什么。
在我们的 Jenkinsfile 中,我们有一个名为 NOME_BASE_IMAGEM 的环境,我们在舞台上使用它来执行 Junit 测试并使用 sonarQube
进行分析
NOME_BASE_IMAGEM = "registry.rancher.tcu.gov.br/public-images/gradle/gradle6-certs-win-ad:gradle-6.8.3-jdk8
stage('Analisa com sonarqube (inclui testes JUnit)') {
agent {
docker {
image '${NOME_BASE_IMAGEM}'
reuseNode true
}
}
steps {
sh 'gradle sonarqube -PmavenUser=usr_repo_maven -PmavenPassword=mvndeploy'
}
}
我想问题出在环境值的双引号上。
我已经将舞台上的调用更改为单引号中图像的完整路径。
stage('Analisa com sonarqube (inclui testes JUnit)') {
agent {
docker {
image 'registry.rancher.tcu.gov.br/public-images/gradle/gradle6-certs-win-ad:gradle-6.8.3-jdk8'
reuseNode true
}
}
steps {
sh 'gradle sonarqube -PmavenUser=usr_repo_maven -PmavenPassword=mvndeploy'
}
}
Ps²:我连这个想法都不好表达,以后有什么不好意思的。 :D
我需要你的帮助来解决这个难题。 在我的工作中,我们有一个 Jenkins 管道来构建我们的一个项目,一个用于我们许多项目的库。
该管道在上周之前按预期工作。我做了一些更改并更新了一些依赖项,现在 Jenkins 上的构建无法正常工作。 为了 运行 我们在 Jenkins 上的测试,我们有这个 Docker 我们创建的图像。带有 Java 8、Gradle 6.9.2 和一些证书的映像,用于在 Active Directory 上连接。 问题发生在执行JUnit测试的阶段。
我们使用的镜像名称是gradle692-certs-win-ad:gradle-6.9.2-jdk8
错误:
ERROR: Name must follow the pattern '^[a-zA-Z0-9]+((\.|_|__|-+)[a-zA-Z0-9]+)*$'
18:59:41 at hudson.util.FormValidation._errorWithMarkup(FormValidation.java:266)
18:59:41 at hudson.util.FormValidation.errorWithMarkup(FormValidation.java:252)
18:59:41 at hudson.util.FormValidation.error(FormValidation.java:143)
18:59:41 at hudson.util.FormValidation.error(FormValidation.java:168)
18:59:41 at org.jenkinsci.plugins.docker.commons.credentials.ImageNameValidator.validateName(ImageNameValidator.java:289)
18:59:41 at org.jenkinsci.plugins.docker.commons.credentials.ImageNameValidator.validateUserAndRepo(ImageNameValidator.java:115)
18:59:41 at org.jenkinsci.plugins.docker.commons.credentials.DockerRegistryEndpoint.imageName(DockerRegistryEndpoint.java:317)
18:59:41 at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
18:59:41 at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
18:59:41 at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
18:59:41 at java.base/java.lang.reflect.Method.invoke(Unknown Source)
18:59:41 at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
18:59:41 at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
18:59:41 at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1213)
18:59:41 at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
18:59:41 at org.codehaus.groovy.runtime.callsite.PojoMetaClassSite.call(PojoMetaClassSite.java:47)
18:59:41 at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
18:59:41 at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
18:59:41 at com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:20)
18:59:41 at org.jenkinsci.plugins.docker.workflow.Docker$Image.toQualifiedImageName(Docker.groovy:106)
18:59:41 at org.jenkinsci.plugins.docker.workflow.Docker$Image.imageName(Docker.groovy:110)
18:59:41 at org.jenkinsci.plugins.docker.workflow.Docker$Image.inside(Docker.groovy:115)
18:59:41 at org.jenkinsci.plugins.docker.workflow.Docker.node(Docker.groovy:66)
18:59:41 at org.jenkinsci.plugins.docker.workflow.Docker$Image.inside(Docker.groovy:114)
18:59:41 at org.jenkinsci.plugins.docker.workflow.declarative.DockerPipelineScript.runImage(DockerPipelineScript.groovy:57)
18:59:41 at org.jenkinsci.plugins.docker.workflow.declarative.AbstractDockerPipelineScript.configureRegistry(AbstractDockerPipelineScript.groovy:73)
18:59:41 at org.jenkinsci.plugins.docker.workflow.declarative.AbstractDockerPipelineScript.run(AbstractDockerPipelineScript.groovy:43)
18:59:41 at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.inDeclarativeAgent(ModelInterpreter.groovy:594)
18:59:41 at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.evaluateStage(ModelInterpreter.groovy:272)
18:59:41 at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.stageInput(ModelInterpreter.groovy:356)
18:59:41 at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.stageInput(ModelInterpreter.groovy:355)
18:59:41 at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.evaluateStage(ModelInterpreter.groovy:261)
18:59:41 at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.inWrappers(ModelInterpreter.groovy:618)
18:59:41 at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.inWrappers(ModelInterpreter.groovy:617)
18:59:41 at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.evaluateStage(ModelInterpreter.groovy:259)
18:59:41 at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.withEnvBlock(ModelInterpreter.groovy:443)
18:59:41 at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.withEnvBlock(ModelInterpreter.groovy:442)
18:59:41 at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.evaluateStage(ModelInterpreter.groovy:254)
18:59:41 at ___cps.transform___(Native Method)
18:59:41 at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:86)
18:59:41 at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:113)
18:59:41 at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:83)
18:59:41 at jdk.internal.reflect.GeneratedMethodAccessor354.invoke(Unknown Source)
18:59:41 at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
18:59:41 at java.base/java.lang.reflect.Method.invoke(Unknown Source)
18:59:41 at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
18:59:41 at com.cloudbees.groovy.cps.impl.LocalVariableBlock$LocalVariable.get(LocalVariableBlock.java:39)
18:59:41 at com.cloudbees.groovy.cps.LValueBlock$GetAdapter.receive(LValueBlock.java:30)
18:59:41 at com.cloudbees.groovy.cps.impl.LocalVariableBlock.evalLValue(LocalVariableBlock.java:28)
18:59:41 at com.cloudbees.groovy.cps.LValueBlock$BlockImpl.eval(LValueBlock.java:55)
18:59:41 at com.cloudbees.groovy.cps.LValueBlock.eval(LValueBlock.java:16)
18:59:41 at com.cloudbees.groovy.cps.Next.step(Next.java:83)
18:59:41 at com.cloudbees.groovy.cps.Continuable.call(Continuable.java:174)
18:59:41 at com.cloudbees.groovy.cps.Continuable.call(Continuable.java:163)
18:59:41 at org.codehaus.groovy.runtime.GroovyCategorySupport$ThreadCategoryInfo.use(GroovyCategorySupport.java:129)
18:59:41 at org.codehaus.groovy.runtime.GroovyCategorySupport.use(GroovyCategorySupport.java:268)
18:59:41 at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:163)
18:59:41 at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.access[=10=]1(SandboxContinuable.java:18)
18:59:41 at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.run0(SandboxContinuable.java:51)
18:59:41 at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:185)
18:59:41 at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:403)
18:59:41 at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access0(CpsThreadGroup.java:97)
18:59:41 at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.call(CpsThreadGroup.java:315)
18:59:41 at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.call(CpsThreadGroup.java:279)
18:59:41 at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService.call(CpsVmExecutorService.java:67)
18:59:41 at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
18:59:41 at hudson.remoting.SingleLaneExecutorService.run(SingleLaneExecutorService.java:139)
18:59:41 at jenkins.util.ContextResettingExecutorService.run(ContextResettingExecutorService.java:28)
18:59:41 at jenkins.security.ImpersonatingExecutorService.run(ImpersonatingExecutorService.java:68)
18:59:41 at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
18:59:41 at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
18:59:41 at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
18:59:41 at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
18:59:41 at java.base/java.lang.Thread.run(Unknown Source)
18:59:41 Finished: FAILURE
PS:我 运行 在我的本地机器上 gradle 使用相同的基础 docker 图像构建。一切顺利。
又是我
我在 Jenkins 论坛上找到了一个 ticket,它帮助我解决了这个问题。
只是为了解释我做了什么。 在我们的 Jenkinsfile 中,我们有一个名为 NOME_BASE_IMAGEM 的环境,我们在舞台上使用它来执行 Junit 测试并使用 sonarQube
进行分析NOME_BASE_IMAGEM = "registry.rancher.tcu.gov.br/public-images/gradle/gradle6-certs-win-ad:gradle-6.8.3-jdk8
stage('Analisa com sonarqube (inclui testes JUnit)') {
agent {
docker {
image '${NOME_BASE_IMAGEM}'
reuseNode true
}
}
steps {
sh 'gradle sonarqube -PmavenUser=usr_repo_maven -PmavenPassword=mvndeploy'
}
}
我想问题出在环境值的双引号上。 我已经将舞台上的调用更改为单引号中图像的完整路径。
stage('Analisa com sonarqube (inclui testes JUnit)') {
agent {
docker {
image 'registry.rancher.tcu.gov.br/public-images/gradle/gradle6-certs-win-ad:gradle-6.8.3-jdk8'
reuseNode true
}
}
steps {
sh 'gradle sonarqube -PmavenUser=usr_repo_maven -PmavenPassword=mvndeploy'
}
}
Ps²:我连这个想法都不好表达,以后有什么不好意思的。 :D