admin管理员组文章数量:1279178
The JFrog Artifactory plugin for Jenkins supports separating the creation and deploying of attached maven artifacts.
For example, I can write a Jenkinsfile that builds the artifacts, and will only publish those artifacts if the required code scans and security scans are successful:
// Build and test without deploying.
stage('Setup') {
// Create maven instance, that will not deploy artifacts.
maven = Artifactory.newMavenBuild()
maven.deployer.deployArtifacts = false
// Create jfrog build info instance.
build = Artifactory.newBuildInfo()
}
stage('Build Artifacts') {
// Perform maven build that will not deploy artifacts but will update build info.
maven.run(goals:"clean verify", buildInfo: build)
}
stage('Code Analysis) {
...
}
stage('Security Analysis') {
...
}
stage('Publish Artifacts') {
// Deploy the artifacts contained in the build info.
maven.deployer.deployArtifacts(build)
}
Note that I do not need to specify any particular artifact here: all attached artifacts of the build are deployed.
I am developing pipelines in Azure Devops now, and wondering if there is an equivalent concept of performing a separate artifact publishing step using JFrog CLI, or JFrogMaven@1 task? I can't see it, but maybe I am overlooking something.
Edit: it seems to me that the plugin's deployArtifacts() operation is simply uploading the artifacts that are stored in the jfrog build info object, rather than performing a separate mvn deploy
step, based on the output:
[Pipeline] deployArtifacts
[pool-9-thread-3] Deploying artifact: /artifactory/maven-releases-local/foo/bar/widget/1.0.0/widget-1.0.0.pom
[pool-9-thread-1] Deploying artifact: /artifactory/maven-releases-local/foo/bar/widget/1.0.0/widget-1.0.0.jar
...
If mvn deploy
was called under the hood then there would be maven output from the intermediate phases (initialize, install, etc) before the deploy phase is run. If it is, then that output is suppressed?
Edit 2 Clarification: the artifactory plugin will deploy build artifacts without rebuilding those artifacts. I was wondering if JFrog CLI or the Azure Devops JFrogMaven@1 task had a similar option to "deploy without rebuilding". I'm guessing that the CLI / Azure Devops task only support calling mvn verify
then mvn deploy
, which results in possible side effects of the maven build lifecycle?
The JFrog Artifactory plugin for Jenkins supports separating the creation and deploying of attached maven artifacts.
For example, I can write a Jenkinsfile that builds the artifacts, and will only publish those artifacts if the required code scans and security scans are successful:
// Build and test without deploying.
stage('Setup') {
// Create maven instance, that will not deploy artifacts.
maven = Artifactory.newMavenBuild()
maven.deployer.deployArtifacts = false
// Create jfrog build info instance.
build = Artifactory.newBuildInfo()
}
stage('Build Artifacts') {
// Perform maven build that will not deploy artifacts but will update build info.
maven.run(goals:"clean verify", buildInfo: build)
}
stage('Code Analysis) {
...
}
stage('Security Analysis') {
...
}
stage('Publish Artifacts') {
// Deploy the artifacts contained in the build info.
maven.deployer.deployArtifacts(build)
}
Note that I do not need to specify any particular artifact here: all attached artifacts of the build are deployed.
I am developing pipelines in Azure Devops now, and wondering if there is an equivalent concept of performing a separate artifact publishing step using JFrog CLI, or JFrogMaven@1 task? I can't see it, but maybe I am overlooking something.
Edit: it seems to me that the plugin's deployArtifacts() operation is simply uploading the artifacts that are stored in the jfrog build info object, rather than performing a separate mvn deploy
step, based on the output:
[Pipeline] deployArtifacts
[pool-9-thread-3] Deploying artifact: https://foo.bar/artifactory/maven-releases-local/foo/bar/widget/1.0.0/widget-1.0.0.pom
[pool-9-thread-1] Deploying artifact: https://foo.bar/artifactory/maven-releases-local/foo/bar/widget/1.0.0/widget-1.0.0.jar
...
If mvn deploy
was called under the hood then there would be maven output from the intermediate phases (initialize, install, etc) before the deploy phase is run. If it is, then that output is suppressed?
Edit 2 Clarification: the artifactory plugin will deploy build artifacts without rebuilding those artifacts. I was wondering if JFrog CLI or the Azure Devops JFrogMaven@1 task had a similar option to "deploy without rebuilding". I'm guessing that the CLI / Azure Devops task only support calling mvn verify
then mvn deploy
, which results in possible side effects of the maven build lifecycle?
2 Answers
Reset to default 0You can achieve this by utilizing the tasks available through the JFrog - Azure DevOps Marketplace Extension.
Please note that these tasks are part of a third-party extension, so they will need to be installed before they can be used in your pipelines, as they are not included among the built-in tasks provided by Azure DevOps.
Behind the scenes, the different wrappers (JFrog Jenkins Plugin, Maven Integration in JFrog CLI, JFrog Maven Task in Azure DevOps) use the same building blocks - relying on Maven goals, and instead of running the install
goal, they enable you to use verify
and deploy
separately.
In the Build Artifacts stage -
- JFrog Jenkins Plugin
maven.run(goals:"clean verify", buildInfo: build)
- JFrog CLI
jf mvn clean verify
- JFrog Maven Task in Azure DevOps
- task: JFrogMaven@1 inputs: goals: 'clean verify'
In the Publish Artifacts (deploy) stage -
- JFrog Jenkins Plugin
maven.deployer.deployArtifacts(build)
- JFrog CLI
jf mvn deploy
- JFrog Maven Task in Azure DevOps
- task: JFrogMaven@1 inputs: goals: 'deploy'
(additional details were dropped for simplicity but are needed / recommended, including: build-info, tool configuration, etc. )
本文标签: mavenSeparate artifact deploy step using JFrog CLI or JFrogMaven1 taskStack Overflow
版权声明:本文标题:maven - Separate artifact deploy step using JFrog CLI or JFrogMaven@1 task? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741240776a2363934.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论