gpt4 book ai didi

git - Jenkins for Scala (SBT) Git master => Build => Test => Build Docker => Push into hub.docker

转载 作者:行者123 更新时间:2023-12-02 19:34:55 25 4
gpt4 key购买 nike

我想在 Jenkins 上使用持续交付堆栈:
git
斯卡 pull (SBT)
docker

Jenkins 文件:

pipeline {
agent any

stages {
stage('Build') {
steps {
echo "Compiling..."
sh "${tool name: 'sbt', type: 'org.jvnet.hudson.plugins.SbtPluginBuilder$SbtInstallation'}/bin/sbt compile"
}
}

stage('Docker Publish') {
steps {
// Generate Jenkinsfile and prepare the artifact files.
sh "${tool name: 'sbt', type: 'org.jvnet.hudson.plugins.SbtPluginBuilder$SbtInstallation'}/bin/sbt docker:stage"

// Run the Docker tool to build the image
script {
docker.withTool('docker') {
docker.build('my-app:latest', 'target/docker/stage')
}
}
}
}
}
}

我在步骤“Docker Publish”上有下一条消息:
[job1] Running shell script

+ /var/jenkins_home/tools/org.jvnet.hudson.plugins.SbtPluginBuilder_SbtInstallation/sbt/bin/sbt docker:stage

[info] Set current project to job1 (in build file:/var/jenkins_home/workspace/job1/)

[error] Not a valid key: stage (similar: state, target, tags)

[error] docker:stage

[error] ^

script returned exit code 1

我不知道这个麻烦的原因。

最佳答案

添加 build.sbt 文件:

import com.typesafe.sbt.packager.archetypes.JavaAppPackaging 
//enablePlugins(JavaAppPackaging)
enablePlugins(JavaServerAppPackaging)

添加项目/plugin.sbt 文件:
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.2.0") 

刷新 SBT 项目。

它在 SBT 版本 0.13.16 中

关于git - Jenkins for Scala (SBT) Git master => Build => Test => Build Docker => Push into hub.docker,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46638852/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com