Artifactory Jenkins Plugin - jenkins

I'm using the Artifactory plugin for my Java projects and also for some RPMs that I'm building (c++).
Some of Jenkins jobs are pushing artifacts using the REST API via CURL.
Is there any way via the plugin and/or via REST, to prevent overriding of an existing artifact (sometimes our versioning mechanism is not working properly, so I need to prevent this scenario)?

You should leverage the permissions for that. In Artifactory "add" and "override" are different permissions. Just prevent the user which pushes from Jenkins from overriding, and you're done.

Related

How to use AWS Parameter Store Build Wrapper Jenkins plugin

I want to use the AWS Parameter Store Build Wrapper Jenkins plugin in my build.
https://plugins.jenkins.io/aws-parameter-store/
Above is the link to that plugin. The issue is I didn't find any proper source on how to use that plugin in the jenkinsfile.
When I installed that plugin to my local Jenkins, I couldn't see how to configure that plugin in any jenkins build configuration page as well.
If anyone can shed some light on this issue, that would be great.
My ultimate goal is to access some things from the AWS Parameter store. If there's any other way that I can achieve this, I'm more than happy to use that way instead of this plugin as well.

Migrate Jenkins jobs from Cloud Bees to another Jenkins server

I have a Jenkins server at CloudBees server and it has a lot of jobs.
I have created new Jenkins server at AWS Ec2 instance.
Now, I need to migrate all Jenkins jobs from CloudBees to New Jenkins Server(AWS EC2instance)
How can I do this task? Is there any way to migrate all jobs by CLI?
Use Backup Plugin or thinBackup
You first need to ensure that you do not use proprietary CloudBees features (RBAC, Folders+ plugins). This is the only thing that's really specific to migrating from a CloudBees Jenkins.
After that, standard steps for migrating Jenkins apply:
ensure that you have same plugins installed on the new Jenkins
align credentials and credentials-IDS
API tokens need special handling
After that, you can just copy all $JENKINS_HOME/jobs/*/config.xml files (if using folders, copy recursively).
You can also copy job configs via CLI or REST API, but usually the fastest way is to copy directly on filesystem level.

Jenkins setup from code

Is there a way to setup a Jenkins from code (eg. AWS userscript) doing
configurations like setting up a user, configuring GIT and slack
plugins?
So far I can install the Jenkins and even add plugins but I'm not able to configure it. This is only possible doing manually afterwards.
I heard about the Jenkins-CLI but don't know how to obtain it, if I just setup the system? Is it also enough to configure the system as I would access it via the UI?

Configuring Jenkins plugins with Puppet

I'm using the rtyler/jenkins Puppet module to deploy my Jenkins instance. One thing I can't seem to find documentation on is how to use Puppet to configure the Jenkins plugins once I've installed them. Can someone point me to some documentation and/or write a quick example? Thanks.
the module he provides is only for managing/configuring jenkins and managing plugins. All plugins are vastly different, there is no possibility his scripts would be able to manage the wide breadth of jenkins plugins out there. You would want to try to capture that using jenkins backups or by looking into how each module allows configuration.
For anyone interested in how to pull this off, I'm using the Jenkins SCM plugin available here: https://wiki.jenkins-ci.org/display/JENKINS/SCM+Sync+configuration+plugin
This requires manually setting up Jenkins and having the plugin sync all the configuration settings to a repository. All future Jenkins instances provisioned by Puppet will need to have all the necessary plugins installed, but the SCM plugin will automatically download all the necessary settings. However, do note that some of the plugins will require you to manually add includes into the SCM to begin tracking them: https://wiki.jenkins-ci.org/display/JENKINS/SCM+Sync+Config+shared+additionnal+includes

How to trigger a Jenkins build on a new artifact in Artifactory?

Can Artifactory be used as "SCM" or source in Jenkins to trigger the builds on an particular artifact deploy?
Don't see (or miss it) anything similar in the Artifactory Jenkis plugin description (and on Jenkins side)
This could be needed for instance if there is only access to the Artifactory repository and not to the SCM with code the binaries are coming from.
Such functionality looks to be availble for Nexus (via nexus-webhook-plugin). Hard to believe that this feature is missing for Artifactory.
It's maybe not as elegant as a hook, but I believe the URLTrigger Plugin will achieve what you're looking for. Listed in their use cases:
This plugin enables users to check if new artifacts (such as binaries) have been deployed in a repository (managed for example by a repository manager such as Sonatype Nexus, JFrog Artifactory, Apache Archiva and so on).
It allows you to check the last modification date and inspect the contents of the response for changes.
You would have to use a polling interval instead of relying on Artifactory to notify Jenkins via a hook, but in my experience polling is relatively innocuous even with lots of polls at high intervals.
Now you can use Enable Artifactory trigger in a newer version.
Go to Build Triggers and check the Enable Artifactory trigger checkbox.
More Detail on GitHub Support for Artifactory trigger

Resources