Got different zip structure from artifacts from Jenkins - jenkins

I have been using Cloudbees Jenkins as a service and I'm trying to setup my local Jenkins which I got different results from Cloudbees Jenkins.
If I use this curl command to get the latest successful artifact.
curl http://endpoint.cloudbees.com/job/jobname/20/artifact/project_name/build/distributions/*zip*/distributions.zip
I got a zip file with this structure.
distributions/my_artifact.zip
But if I do the same command on my local Jenkins
curl http://localhost:8080/job/jobname/20/artifact/project_name/build/distributions/*zip*/distributions.zip
I just got
my_artifact.zip
which one is correct? And why they are different? I actually want my local Jenkins to produce the same results as as cloudbees.
I'm using Jenkins 1.534.

The behavior on the CloudBees hosted Jenkins is the traditional and intended behavior. It looks like you found a bug in development builds of Jenkins, which I filed as JENKINS-19947.

http://jenkins-ci.org/changelog
Read it.
* As of 1.532 download of artifact ZIPs was broken. (issue 19752)

Related

Nuget Push returns 403 after publishing to Artifactory through Jenkins Pipeline

I am trying to push my nuget package to artifactory. The commands to do that are embedded in my msbuild file. When I run the commands directly or through the msbuild file on my local machine / jenkins agent machine, I am able to push the package successfully.
But when the same msbuild file is executed using jenkins pipeline, even though the package get pushed to artifactory, I get the response as "Response status code does not indicate success: 403 (Forbidden)" and the hence the build fails.
Can anyone help here?
Seems a bit strange that you get a 403 and it works but it sounds like an issue with the effective user that the Jenkins job is running under. On Windows you can amend the user by changing it on the Jenkins windows service, I haven't used Jenkins on other OSs but the answer on
Run Jenkins jobs on Linux under a User have some pointers about doing the same for Linux.
Obviously in either case make sure your Jenkins user has necessary permissions to push to Artifactory.

Jenkins & Artifactory

On a server running ubuntu 12.04 I have installed jenkins 1.532.1 and artifactory 2.6.4.
Both of then are running fine separately. I also have maven 2.
With jenkins, I can build maven java project with sources on subversion.
With maven I can use Artifactory.
The problem is with the artifactory plugin for jenkins.
I added an artifactory server with credentials. Using connection check tell me : "Found Artifactory 2.6.4". It seems to be ok.
But when I create a maven job, in post build actions, I choose Deploy artifacts to artifactory. My server is already selected in the artifactory server but nothing is available in the repositories.
What can I do. Do I have to configure something special in Artifactory ?
I had also this issue, the problem comes from a refresh of Jenkins Plugin.
To deal with that issue, you should:
open your job
add a task for artifactory
save your job
Open again your job
Now you should be able to see your repositories.
Conclusion: You should add/save and reload your job to see your list of repo of artifactory.
I also have this problem, when switching from one artifactory server to another and it looks like a bug for me.
But if I save the settings once without a "non-selectable" repository and access the configuration of the job again, the repositories will be shown.
Ok, so after a very long time I tried again and ... I don't know why but now (I'm quite sure it was not working few months ago) the solution given by aorfevre and user3424040 are working.
I have also upgraded jenkins to 1.565.1 and the artifactory plugin to 2.2.3 and now there is a Refresh Repositories button in the Deploy artifacts to Artifactory task.
For the "Generic-Artifactory Integration" I had to configure Artifactory a bit. I added a group 'deployers' and a user 'deploy' in that group. Also I added a Permission Target for the LOCAL repositories where the group was granted deploy permissions.

Show list of released artifactory versions for deploy build in Jenkins

I have a release build that compiles and publishes the war file to Artifactory. I'd like to have a manually run parameterized build where I can choose among the release builds that it will then pull that artifact from Artifactory and deploy it. Deployment works fine, it's the choosing I'm having trouble figuring out how to do.
Is there a straightforward way to do something like this?
The closest thing I found was Promoted Build Parameter, but this doesn't seem to give me what I need as I don't know how to translate from what it gives to the file in Artifactory.
Use one script based on Artifactory REST API to fetch the needed artifacts from artifactory server.
In jenkins job, the Choice parameter can be used.
Then in the executed shell script, you pass the parameter to the script to download the artifacts.
It works fine for us.

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.

how to publish sonar result in jenkins server, or do we have sonar-report jenkins plugin

There is a sonar plugin for jenkins, it triggers the sonar build inside CI (jenkins), it is useful.
While now I want to see the sonar result inside jenkins without jumping to sonar websites, it is useful if I just want to see some key data for this job.
It could be sonar-report plugin in jenkins.
Do you have similar needs ?
One ugly solution I used so far is to use Sonar Web API.
I add one curl command in the end of job (build steps) to fetch the needed metrics like
curl http://sonar.sh.cn.ao.ericsson.se//api/resources?metrics=qi-quality-index,coverage,test_success_density&resource=54936 --output sonar-result.xml
Then I archive the sonar-result.xml to make it visible inside the job.
You can try using Mashup Portlets plugin for Jenkins to configure the results in Jenkins Dashboard.
PFB URL for the plugin.
URL:- https://wiki.jenkins-ci.org/display/JENKINS/Mashup+Portlets

Resources