清理Docker镜像版本的版本。 nebula.release

时间:2019-04-29 22:00:56

标签: java docker gradle jib

每次向git存储库中的特定分支推送时,我都有一条管道来构建Docker映像。问题在于语义版本控制使用“ +”字符在版本名称中指定元数据部分。我需要用镜像名称替换Docker支持的另一个字符。是否可以替换该字符或使用自定义版本名称?

我正在使用nebula.release来推断项目版本。

id 'nebula.release' version '10.1.1'

jib {
    to {
        image = "registry.gitlab.com.uy:5005/project/app:$version"
        auth {
            username = System.getenv('CI_REGISTRY_USER')
            password = System.getenv('CI_REGISTRY_PASSWORD')
        }
        tags = ['latest']
    }
    container {
        ports = ['8080']
        environment = [
                SPRING_OUTPUT_ANSI_ENABLED: 'ALWAYS',
        ]
        useCurrentTimestamp = true
    }
    allowInsecureRegistries = true
}

jibDockerBuild.dependsOn bootJar

这是错误:

  
      
  • 出了什么问题:任务':jib'的执行失败。      
        

    com.google.cloud.tools.jib.image.InvalidImageReferenceException:图片参考无效:     Registry.gitlab.com.uy:5005/project/app:1.0.0-rc.1.dev.0+108db18

      
  •   

我在build.gradle文件中创建了此任务,有什么办法可以重复使用它?

task cleanVersion {

    ext.sanitizeVersion = { version ->
        return version.toString().replace('+', '_')
    }
    doLast {
        println sanitizeVersion("$version")
    }
} 

我可以使用一些帮助。预先感谢您的宝贵时间。

1 个答案:

答案 0 :(得分:1)

由于构建脚本是代码,并且public function sendResetLinkEmail(Request $request) { $this->validateEmail($request); // We will send the password reset link to this user. Once we have attempted // to send the link, we will examine the response then see the message we // need to show to the user. Finally, we'll send out a proper response. $response = $this->broker()->sendResetLink( $request->only('email') ); return back()->with('status', "If you've provided registered e-mail, you should get recovery e-mail shortly."); } 是扩展名,jib是检索属性(与任务输出或生成的内容相比),因此可以使用与您当前的project.version任务来配置扩展名。

cleanVersion
相关问题