Publish generic file as ivy artifact - jenkins

I want to publish a generic file to our Artifactory as a ivy artifact, and I have tried using the "Generic-Artifactory Integration" option in the job configuration.
The deployment works, but the file is deployed as a straight up file in the Artifactory repository root, e.g.
<artifactory url>/artifactory/ivy-repo/my.file
How can I the plugin publish the artifact as an Ivy dependency instead?

When working with Generic Artifactory Integration you should define deployment patterns (as described in the tool-tip in Jenkins:
Since there is no way for Artifactory to determine the org path for a file without metadata (ivy.xml or pom.xml), you have to provide it manually in the right-hand part of the pattern expression, e.g. my.file=>my/org/*

Related

Is there any way to get Jenkins artifacts in Gitlab pipeline?

Basically the opposite of this question: Is there any way to get Gitlab pipeline artifacts in Jenkins?
My project is built on Jenkins. It generates a JavaDoc.
I want to publish this JavaDoc as a Gitlab Pages.
So I would need my gitlab-yml to be able to retrieve the produced javadoc from Jenkins.
Alternatively, my artifacts are stored on a network drive, so an access to this network drive would work too
I think that this plugin could be helpful to you...
There is a plugin called Archived Artifact Url Viewer. It seems to be like you needs.
"Jenkins plugin to view contents of a file inside a zip or jar file under a subdirectory of artifacts directory of a build The url to access a file inside a zip or jar archive within the artifact folder of a build is as follows"
/archivedArtifacts/artifact/<job_name>/<build_number/<relative location of zip or jarfile within artifact folder>/<location of file within archive>
Ex:
http://<jenkins_url>/archivedArtifacts/artifact/Build%20-%20Dev/10526/junit-logs.zip/junit.log
https://plugins.jenkins.io/archived-artifact-url-viewer/

How can I use Artifact Deployer to copy from the archived artifacts, instead of the workspace?

We've been using Jenkins for a while, now, and have used the ArtifactDeployer plugin to copy build artifacts out of the working directory to our artifact repository fileshares.
I'm working on a new deployment promotion job, that needs to obtain the artifacts of a given build, and I thought I might use the Copy Artifact plugin. But that expects that the artifacts be saved using Jenkin's artifact archive feature, which we've not been using.
There are some nice features, in the Copy Artifact plugin - we can configure it to specify the upstream build that triggered the job, rather than having to pass a specific build number as a parameter. But to use it, we'd need to configure archive.
But we still need to copy artifacts to our artifact repository fileshares, which means we have to specify the files we want to archive twice - once in the archive config and once in the ArtifactDeployer config.
Unless we can configure the ArtifactDeployer plugin to copy the contents of the archive directory.
Is this possible?
What would be the path?

How to update Artifact Build Module ID

I am using Jenkins CI(single pipeline Job) to push different files to JFrog Artifactory.
For each and every build I am publishing the build info to Artifactory. But every build has same Module ID.
for example: In Artifactory Repository Browser select any artifact then go to Build tab, then it is showing all builds instead of respective artifact build information
So I would like to know how to modify the Artifact Module ID while publishing the artifact information to Artifactory
The build information and Artifact storage are to different mechanisms. The build information is only associated with artifacts in the sense that you can define what artifacts are produced from a build and what artifacts are a dependency of a build. The module ID has no association with the build info. The module ID is defined by the repository layout where the Artifact is stored. See the jfrog documentation here: https://www.jfrog.com/confluence/display/RTF/Repository+Layouts
You cannot change the module ID. Artifactory assigns a module ID based on the repository layout. This means the path to the artifact matters for defining the module ID.
For example the repository layout
[org]/[module]/[module]_[base_rev].[ext] will give module IDs to any artifact stored following that pattern as [org]:[module]:[base_rev].
Artifacts are associated to builds by both a build.name, build.number property on the artifact and publishing a build info from a .json file. The .json must include a section denoting what artifacts were produced from the build.
In general, it sounds like you need to ensure each artifact is being deployed to a unique path in artifactory with the build.name and build.number property being set. The other thing to look at is the file hash. it must match in the build info being published. So if the file hash is not different that means there is no change to the artifact from the previous build.
I don't know how much this will help, but there is a lot of nuances that go into getting the artifacts and builds to line up. You mentioned using Jenkins, have you looked into using the Jenkins Artifactory plugin. It should take care of a lot of this work for you, although we use Bamboo, so I am not as familiar with how it differs.

Resolving Artifacts using Jenkins job with the parent directory

I am looking to download the artifacts using Jenkins job to resolve the artifacts from Artifactory. Specifying the file type and the path to the artifact works, However, unable to resolve all artifacts from the root directory.
Actual Artifactory Path:
repo_key:Group/Artifact/Version/path/to/artifact1/file.zip
repo_key:Group/Artifact/Version/path/to/artifact2/file.zip
Below Configuration in Jenkins job to Resolved Artifacts doesn't works:
repo_key:Group/Artifact/*=>Output
How do I download all files under the Artifact directory to the Output directory.
You need to use the format JBaruch mentioned and add the build metadata as matrix params, to support wildcard resolution for multiple files.
For instance:
repo_key:Group/Artifact/**/*#publishing_build_name#LATEST
Will get you the latest artifacts published by the job "publishing_build_name".
There's some helpful information and examples when clicking on the Question Mark next to the "Resolved Artifacts" field.
Artifact/* will resolve files, directly located under Artifact directory (and there are none). What you need is Artifact/**/*.

Grails - How to make ivy-cache folder structure the same as maven repository folder structure? [duplicate]

The ivy local repository is in ~/.ivy2, and I'd like to use it as my local maven respoitory. Is there any easy way like setting to do it ?
I suspect what you're trying to do is share ivy's cache, not it's local repository. Files are placed in ivy's repository by calling the publish task. Ivy has a clear storage distinction between these file types:
~/.ivy2/cache
~/.ivy2/local
Maven on the other hand mixes up both file types under the following directory:
~/.m2/repository
It would be a lot simpler to optimize your caching by installing a Maven repository manager like Nexus and configuring Maven and Ivy to use it. Nexus is a very efficient java process and simple to setup on your development machine.
Finally if you are determined to share caches, you could attempt to use the caches directive in the ivy settings file. It has "ivyPattern" and "artifactPattern" directives which suggest one can customize how the cached files are stored. To make this work you'll have to customize ivy. Maven has no flexibility in this area.

Resources