Jenkins Artifactory Plugin Option - jenkins

I am not able to discard the old artifacts using artifactory plugin in Jenkins. Is there a way that, we can discard the old artifacts from Jenkins itself.
Note :- I am already using Jenkins artifactory plugin but I am not able to discard it via that.
Jenkins Version: 2.3
I tried deleting from Jenkins but I am not able to delete that.
I am expecting that old artifacts gets deleted because we are having discard old builds option available in Jenkins artifactory plugin.

Related

Jenkins Artifactory Plugin: upload custom files in the middle of the a build

How can I upload files to an Artifactory by Jenkins Artifactory Plugin in the middle of the build? After uploading, the job will trigger another job which will download the artifact from the Artifactory. Arching artifacts in the Jenkins jobs is not an option for me because we should keep artifacts in Artifactory.
I could use curl to upload to the Artifactory, but I need to have old builds discarding (by Jenkins Artifactory Plugin). I could use "Generic-Artifactory Integration" in the jobs configuration, but it uploads only at the end of the job build.
We have used the jfrog cli to do this on generic jobs. Be sure to include the —build-name and —build-number options to have your artifacts collected correctly when the Artifactory plugin publishes the build info.

How to check which jenkins job is responsible for an artifact upload in artifactory

We have a lot of jenkins jobs (400+). A lot of them are uploading new artifacts to our Artifactory. Most of them are using the Artifactory plugin.
When we use that plugin we can check the 'build browser' in Artifactory.
This will show the jenkins jobs which are uploading artifacts with that plugin. It's clear.
The problem is that we also have some jobs in which case it isn't useful for us to implement the artifactory plugin. Is there a way in Artifactory we can check those jobs?
We want to see from an artifact which is uploaded WITHOUT the artifactory plugin from which jenkins job it's coming from.
Jenkins jobs that use the jfrog cli to upload artifacts can now also publish build info.
From the jfrog cli help
JFROG_CLI_BUILD_NAME
Build name to be used by commands which expect a build name, unless sent as a command argument or option.
JFROG_CLI_BUILD_NUMBER
Build number to be used by commands which expect a build number, unless sent as a command argument or option.
JFROG_CLI_BUILD_PROJECT
Artifactory project key.
JFROG_CLI_BUILD_URL
Sets the CI server build URL in the build-info. The "jfrog rt build-publish" command uses the value of this environment variable, unless the --build-url command option is sent.
Setting these environment vars during the Jenkins job and then calling
jfrog rt build-publish will allow you to connect the jobs to the artifacts.

Jenkins Artifactory Integration

I am using the Jenkins Artifactory plugin to publish build artifacts.
I renamed my job on Jenkins but I still see the old name of the job under Artifactory "Builds".
I am new to Artifactory (used Nexus in the past) and I am not sure if there's anything I need to do on Artifactory side to make the necessary name change.
Thanks,
Bella
Artifactory does not discard old builds unless you specifically instruct to do so by deleting those builds so what you're seeing is just the builds from the 'old' job.
Now that you have renamed the job new builds (with the new name) will start showing in the Builds pane once you've started the job.
If you'd like to discard the old builds (from the old jenkins job) you can simply do it from the Builds pane or with the REST api

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

Publish to Artifactory copied from another project artifacts in Jenkins

So I got few separated jobs in Jenkins. The first one gets the project from a Git repository, builds it and produces artifacts. And another one has to copy certificates from the first job and publish them to Artifactory (tried to make it using the Artifactory plugin). But the thing is that the Artifactory plugin's available only in the Build job, there's nothing like "Generic-Artifactory integration" in second job's configuration.
Does anyone know what are the requirements for making the plugin work in the Publish job?
You can write a small shell script leveraging Artifactory REST API and execute it in your second, non-build job.
I have done a similar thing with maven and a zip file. I have deployed a zip with a build step in maven calling a deploy:deploy-file and setting my Artifactory repository in settings.xml and deploying directly on my artifactory repository.

Resources