All Projects → jenkinsci → artifact-promotion-plugin

jenkinsci / artifact-promotion-plugin

Licence: other
A simple Jenkins plugin to promote artifacts.

Programming Languages

java
68154 projects - #9 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to artifact-promotion-plugin

custom-tools-plugin
A generic tool installer for Jenkins
Stars: ✭ 25 (-13.79%)
Mutual labels:  jenkins, jenkins-plugin, adopt-this-plugin
pipeline-as-yaml-plugin
Jenkins Pipeline As Yaml Plugin
Stars: ✭ 111 (+282.76%)
Mutual labels:  jenkins, pipeline, jenkins-plugin
bitbucket-push-and-pull-request-plugin
Plugin for Jenkins v2.138.2 or later, that triggers job builds on Bitbucket's push and pull request events.
Stars: ✭ 47 (+62.07%)
Mutual labels:  jenkins, pipeline, jenkins-plugin
parameterized-trigger-plugin
Jenkins parameterized-trigger plugin
Stars: ✭ 63 (+117.24%)
Mutual labels:  jenkins, jenkins-plugin, adopt-this-plugin
osf-builder-suite-for-sfcc-deploy-plugin
OSF Builder Suite For Salesforce Commerce Cloud :: Deploy
Stars: ✭ 14 (-51.72%)
Mutual labels:  jenkins, jenkins-plugin, jenkins-ci
Jira Steps Plugin
Jenkins pipeline steps for integration with JIRA.
Stars: ✭ 88 (+203.45%)
Mutual labels:  jenkins, pipeline, jenkins-plugin
Jenkins Os
Groovy pipeline jobs that build and test Container Linux with Jenkins
Stars: ✭ 43 (+48.28%)
Mutual labels:  jenkins, pipeline, jenkins-plugin
Delivery Pipeline Plugin
Jenkins plugin for pipeline visualisation, perfect for Continuous Delivery
Stars: ✭ 122 (+320.69%)
Mutual labels:  jenkins, continuous-delivery, jenkins-plugin
Nevergreen
🐤 A build monitor with attitude
Stars: ✭ 170 (+486.21%)
Mutual labels:  jenkins, continuous-delivery
Performance Plugin
Performance Test Running and Reporting for Jenkins CI
Stars: ✭ 176 (+506.9%)
Mutual labels:  jenkins, jenkins-plugin
Ssh Steps Plugin
Jenkins pipeline steps which provides SSH facilities such as command execution or file transfer for continuous delivery.
Stars: ✭ 183 (+531.03%)
Mutual labels:  jenkins, pipeline
build-user-vars-plugin
Set of environment variables that describe the user who started the build
Stars: ✭ 40 (+37.93%)
Mutual labels:  jenkins, jenkins-plugin
Stashnotifier Plugin
A Jenkins Plugin to notify Atlassian Stash|Bitbucket of build results
Stars: ✭ 157 (+441.38%)
Mutual labels:  jenkins, jenkins-plugin
Jenkinsdocs
Jenkins实践文档 最新站点地址: http://www.idevops.site
Stars: ✭ 200 (+589.66%)
Mutual labels:  jenkins, pipeline
Sonar Scanner Jenkins
SonarQube Scanner for Jenkins
Stars: ✭ 155 (+434.48%)
Mutual labels:  jenkins, jenkins-plugin
Hashicorp Vault Plugin
Jenkins plugin to populate environment variables from secrets stored in HashiCorp's Vault.
Stars: ✭ 191 (+558.62%)
Mutual labels:  jenkins, jenkins-plugin
Fabric8
fabric8 is an open source microservices platform based on Docker, Kubernetes and Jenkins
Stars: ✭ 1,783 (+6048.28%)
Mutual labels:  jenkins, continuous-delivery
Jenkinsfiles
Examples for jenkins pipelines, comparing scripted and declarative syntax
Stars: ✭ 187 (+544.83%)
Mutual labels:  jenkins, continuous-delivery
ebook-continuous-delivery-with-kubernetes-and-jenkins
Continuous Delivery for Java Apps: Build a CD Pipeline Step by Step Using Kubernetes, Docker, Vagrant, Jenkins, Spring, Maven and Artifactory
Stars: ✭ 39 (+34.48%)
Mutual labels:  jenkins, continuous-delivery
configuration-as-code-groovy-plugin
Extension for Jenkins Configuration-as-Code plugin that allows running Groovy scripts
Stars: ✭ 39 (+34.48%)
Mutual labels:  jenkins, jenkins-plugin

Artifact Promotion Plugin

This is a simple plugin to promote artifacts. This is done on the artifact repository server and due to this the promotion process is specific to the used repository server.

In the first step, this plugin will support Sonatype Nexus OSS.

Artifact Promotion in Sonatype Nexus OSS

Nexus OSS doesn't support staging repositories like Nexus Pro. And, in addition, it does't support custom metadata. Due to this, an artifact promotion could only be handled by moving or copying an artifact from a staging repository into a 'release' repository (... or however you want to call your stage).

Some guys say this is an anti pattern like in this blog but there is no chance to do it the right way with Nexus OSS.

Usage

The plugin is in development and you should consider that some parts are subject to change. Future changes can effect the GUI, pipeline code, the Job DSL interface and the configuration file, resulting in breaking changes while upgrading. We'll try to ensure to mark such changes, but you'll use the plugin at your own risk.

Defining a Promotion Job using Job DSL

The plugin adds an extension to the Job DSL plugin to allow defining Artifact Promotion build steps in Job DSL scripts. The extension can be used with the Job DSL plugin version 1.69 or higher.

job {
	steps {
	    artifactPromotion {
	      groupId(String groupId)
	      artifactId(String artifactId)
	      classifier(String classifier)
	      version(String version)
	      extension(String extension = "jar")
	      stagingRepository(String url, String user, String password, boolean skipDeletion = true)
	      releaseRepository(String url, String user, String password)
	      debug(boolean debug)
	    }
	}
}

Creates a build step to promote an artifact from a staging to a release repository, unchecking skipDeletion which causes the deletion of the whole version with all files from the staging repository (this is disabled by default).

job('example') {
	steps {
		// assumes default repo system (NexusOSS)
	    artifactPromotion {
	      groupId("com.example.test")
	      artifactId("my-artifact")
	      version("1.0.0")
	      extension("zip")
	      stagingRepository("http://nexus.myorg.com:8080/content/repositories/release-candidates", "foo", "s3cr3t", false)
	      releaseRepository("http://nexus.myorg.com:8080/content/repositories/releases", "foo", "s3cr3t")
	    }
	}
}

Pipeline

For usage within Pipeline scripts use the snippet generator or see the example below:

Scripted pipeline

stage('example') {
    artifactPromotion (
        promoterClass: 'org.jenkinsci.plugins.artifactpromotion.NexusOSSPromotor',
        groupId: 'com.example.test',
        artifactId: 'my-artifact',
        version: '1.0.0',
        extension: 'zip',
        stagingRepository: 'http://nexus.myorg.com:8080/content/repositories/release-candidates',
        stagingUser: 'foo',
        stagingPW: 's3cr3t',
        skipDeletion: true,
        releaseRepository: 'http://nexus.myorg.com:8080/content/repositories/releases',
        releaseUser: 'foo',
        releasePW: 's3cr3t'
    )
}

Declarative pipeline

stage('example') {
    steps {
        artifactPromotion (
            promoterClass: 'org.jenkinsci.plugins.artifactpromotion.NexusOSSPromotor',
	    debug: false,
            groupId: 'com.example.test',
            artifactId: 'my-artifact',
            version: '1.0.0',
            extension: 'zip',
            stagingRepository: 'http://nexus.myorg.com:8080/content/repositories/release-candidates',
            stagingUser: 'foo',
            stagingPW: 's3cr3t',
            skipDeletion: true,
            releaseRepository: 'http://nexus.myorg.com:8080/content/repositories/releases',
            releaseUser: 'foo',
            releasePW: 's3cr3t'
        )
    }
}

Artifact deletion

When you promote artifacts from the staging to the release repository you may want to remove the artifact from staging. If your artifact only has one associated file, the plugin works as expected. Although if you're using classifiers, deletion removes all files associated with the artifact. The Skip deletion option preserves the files in the staging repository. Untick 'Skip deletion' only after you've promoted all the relevant files in previous steps. Use a promotion step for each classifier.

ATTENTION: Use the possibility to delete files very carefully!

By default, the option Skip deletion is enabled.

Promoting POM artifacts

Starting with version 0.5.2 it is possible to promote POM artifacts, like parent POM or multi module project descriptions, specifying the POM to be promoted and indicating the extension pom.

stage('example') {
    artifactPromotion (
        promoterClass: 'org.jenkinsci.plugins.artifactpromotion.NexusOSSPromotor',
        groupId: 'com.example.test',
        artifactId: 'my-pom-artifact',
        version: '1.0.0',
        extension: 'pom',
        stagingRepository: 'http://nexus.myorg.com:8080/content/repositories/release-candidates',
        stagingUser: 'foo',
        stagingPW: 's3cr3t',
        skipDeletion: true,
        releaseRepository: 'http://nexus.myorg.com:8080/content/repositories/releases',
        releaseUser: 'foo',
        releasePW: 's3cr3t'
    )
}

Contributions

Please feel free to contribute for other repository servers like

  • Nexus Pro
  • Artifactory and Aertifactory Pro
  • Apache Archiva

Additionally, we've don't yet support the Jenkins Credentials Plugin.

Don't hesitate to come up with your suggestions. Pull requests are preferred as I'm limited in my time.

History

  • 0.5.2 - Allow promoting POM artifacts. Fix debug functionality in the delete function.
  • 0.5.1 - Support for Jenkins Pipelines and minor bug fixes; upgrade dependency to Job DSL 1.69, Upgrade used Aether version, fixes some FindBugs findings
  • 0.4.0 - Support for Maven Classifiers
  • 0.3.6 - Support for Job DSL Plugin

Known Issues

[ ] The plugin doesn't supports Jenkins Credentials plugin. Due to this, credentials are written and saved in plain text then using Job DSL oder Pipeline DSL. (Hint: I would very appreciate a pull request implementing this).

Useful links

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].