I have the following jenkins work flow :
I'm using a Build Flow to orchestrate several jobs.
Job 1 -> publish artifacts to artifactory
Job 2 -> publish artifacts to artifactory
Job 3 -> uses artifacts from artifactory
(I actually have several more jobs, with parallelization, that's why the Build Flow is particularly useful)
Now Job 3 might have used the artifact from Job1Build1 and from Job2Build2
I'd like to install a promotion on Job 1 and Job 2.
For instance, after Job3 has run, it should detect that it retrieved artifacts from Artifactory from J1B1 and J2B2, and therefore apply a promotion on these builds.
Is it possible to record such link without explicitly recording fingerprints in Jenkins (only relying on the fingerprints of the artifacts published to / retrieved from Artifactory) ?
Related
Is this possible? Suppose I have 2 jobs. One for building artifact and upload it to artifactory with latest version. And another job to deploy the artifact to the server. But I would like to choose the artifact version. Supose A deploy was made and not working , so I redeploy and choose previous artifact (or the one I want to choose). Is this posible in jenkins in a pipleine project? Like a parametrized build or something like that.
Thanks
It will work with the pipelin job . I am it in pipeline job only.
Example: https://wiki.jenkins.io/display/JENKINS/Maven+Metadata+Plugin
Assume that you have 2 jobs .
Job A & Job B. (Both pipeline jobs.)
Job A -> Build and push the artifacts to Artifactory.
Job B -> Fetch the artifact from Artifactory and deploy.
Install the Maven Meta Plugin . https://wiki.jenkins.io/display/JENKINS/Maven+Metadata+Plugin
go to Job B
"This build is parametrerized" checkbox, from the drop-down that appears select the "List maven artifact versions",
configure the artifact you want to retrieve the versions
Name the parameter as deploy_version
In Job B - > Select the version & Click Build.
In pipeline script receive the selected version as param.deploy_version.
Since you know the artifact version and artifact URLs . You can use CURL/httprequest plugin in Jenkisn to download the necessary
artifact from Artifactory (I am using Maven Ansible artifactory
plugin to download)
Continue with your deployment.
According to this answer :
https://stackoverflow.com/a/34781604/3957754
The artifactory plugin for Jenkins has the option to "resolve" artifacts, i.e. download them from Artifactory. But this may require the Pro version with payment $_$
Download artifact using artifactory jenkins plugin (With Payment)
Configure your artifactory plugin
https://medium.com/#anusha.sharma3010/integrating-jenkins-with-artifactory-6d18974d163d
https://www.jfrog.com/confluence/display/RTF/Jenkins+Artifactory+Plug-in
In resolve section, you could download your artifacts
Download artifact using commandline and maven
configure maven and artifactory authentication
https://docs.gitlab.com/ee/ci/examples/artifactory_and_gitlab/
https://blog.bosch-si.com/developer/setting-up-maven-and-artifactory/
download artifact from artifactory
mvn org.apache.maven.plugins:maven-dependency-plugin:2.1:get \
-DrepoUrl=http://my_artifactory-url.com \
-Dartifact=groupId:artifactId:version
Source: How can I download a specific Maven artifact in one command line?
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.
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.
I want to setup a job which promotes an artifact from say integration repo in artifactory to staging repo in artifactory based on the result of another job. Even if there is a solution to promote as a post build action based on result of the current job, it would suffice my requirement.
You can use Artifactory's Build Promotion API and promote a build into a different repository each time with a different status.
So basically have a downstream Jenkins job that calls this API after a build has met your quality requirements (i.e. tests completed successfully).
The Jenkins Artifactory plugin has very extensive functionality for promotion by itself as well.
I have two Jenkins jobs.
Job 1: Uploads build to artifactory
Job 2: Downloads build from artifactory and does some stuff with it
Right now, Job 1 triggers Job 2 using the Parameterized Build Plugin (Job 2 is shared amongst many teams at my company, so I don't want to change it too much - it's a parameterized job that takes an artifactory URL)
The problem is, it seems like the artifact doesn't always finish uploading to artifactory before Job 2 is triggered. Sometimes Job 2 gets a 404 when it tries to download the artifact. Is there some way to 1) prevent triggering Job 2 until the artifact has uploaded? or 2) pass the artifact directly from Job 1 to Job 2 w/out needing to do an upload and a download? (the former would be preferable, since option 2 would require changing Job 2)
Regarding your option 1, you can use the Naginator plugin to reschedule a job 2 if it fails.
Regarding the option 2, you can use the Copy Artifact plugin. It will allow the job 2 to copy the artifacts from the job 1.
Personally, I prefer the option 1. Artifactory is the right place to store binaries :)
There is a 3rd solution by using the quiet period setting on the job 2 to delay the start (Jenkins: build one job after another with some delay).