Is it possible to create jar from past releases with Jenkins? - jenkins

I need a way to automate jar creation for some old releases in gitlab. I wonder if jenkins can help me or not ? And how ?

You probably must be having tags in gitlab for those releases...right. So you can create git based parametrized build which will show you all the branches/tags while doing the build...from the dropdown list you can select the required tag and it will do the creation of jar assuming you have build scripts in place.

Related

Adding Jenkins Pipelines on Build

does anyone know if its possible to add a Jenkins pipeline build into a Jenkins docker image? For example, I may have a Jenkinsfile that defines my pipeline in groovie, and would like to ADD that into my image when building from the Jenkins image.
something like:
FROM jenkins:latest
ADD ./jobs/Jenkinsfile-pipeline-example $JENKINS_HOME/${someplace}
And have that pipeline ready to go when i run it.
Thanks.
It's a lot cleaner to use Jenkinsfile for this instead. This way, as your repositories develop you can change the build process without needing to recompile and redeploy your Jenkins instance everytime. (less work, and less CI downtime) Also, having the Jenkinsfile in source code allows a simpler decoupling.
If you have any questions about extending Jenkins on Docker further to handle building NodeJS, Ruby or something else I go into how to do all that in an article.
You can create any job in Jenkins by passing in an XML file that describes the job. See https://support.cloudbees.com/hc/en-us/articles/220857567-How-to-create-a-job-using-the-REST-API-and-cURL
The way I've done this is to manually create the job I want in Jenkins, then append config.xml to the URL and it shows you the XML content needed to generate the pipeline job. Save that XML and you can deliver it to your newly deployed Jenkins instance.
I use a system similar to this to generate several hundred jobs based on our external build specifications.

Using Jenkins, how would I create an SVN tag from a job's workspace?

I normally check out code to a temp folder and run composer against the folder. If it passes, I then create a tag from within said folder. In Jenkins I can kick off composer just fine, but I need Jenkins to create the tag from the workspace and not from the branch.
If this can't be done using tagging feature within Jenkins, I suppose I could use a series of Post-Build scripts.
There is an option on Jenkins to tag a particular build, which captures the workspace at that point in time.
Using the GUI, it's the Tag this build option which appears when viewing a build.
Using a URL, it's
http://my-server:portnumber/jenkins/job/my_job_name/buildnumber/tagBuild/
Is that what you meant?

Jenkins clone jobs and change branch

I have a task that I want to realize with Jenkins, but I don't know how to do it.
I have a view full of jobs, all pointing to the same svn repo. Each job build one maven module present on the svn repo.
Once a year, we release a version, and therefore we create a new branch for the development on the future new version.
In Jenkins, it means that I want a view with all my jobs pointing on the released version branch, and a new view with the same jobs, but pointing on the future version branch.
I know that I can do that manually by cloning and then modify the branch for all the jobs, but I want to do that with the least number of actions possible (ideally one :-)).
I take a look at Jenkins built-in possibilities and in existing plugins, but I found nothing and I have no idea how to do it.
Is there a possibility to script that kind of job ? Or a plugin doing that ?
Thank you,
Seb
I suppose your future versions are developed on the trunk. So the URL for these versions is always the same (ex: http://svn.yourcompany.com/project1/trunk).
I propose to group your trunk jobs in a dedicated folder using the CloudBees Folder plugin.
This plugin will group all your jobs in a physical folder in your Jenkins home folder (ex: jobs/trunk).
When you want to create the new jobs for the release branch, you write a script which:
Copy the jobs/trunk folder into jobs/release_2.0
Replace http://svn/.../trunk with http://svn/.../branches/2.0 (you can use a regexp to do that)
Rename all the jobs (you just need to add 2.0 at the end of all job names)
Reload the Jenkins configuration
It should work :)

Centrally managed build profiles in Jenkins

I would like to be able to configure centrally something like "build profiles" which I can apply to multiple projects in Jenkins.
For instance, I want to setup a compile, email, deploy chain to be used by several projects. When I change something in this chain, I want to automatically apply the changes to all linked projects.
Is there a convenient way to do this? I am also open to suggestions for other build systems, as long as they can deal with sbt projects.
I see there is a SBT plugin for Jenkins which looks popular-I haven't used it
I have used the jenkins job-dsl which covers sbt out the box. This works by a build step in a job to create/regenerate other jobs (with an optional template)
The problem with having a generic job building separate projects is that all the job history gets merged together. I think it is better to use stand-alone jobs for each task and the job-dsl will allow you to do that
TeamCity supports build configuration templates out of the box and recently added basic sbt support.

Manually select artifacts and create a build using Jenkins?

Here is what i am trying to achieve:
We have a SVN repository, but we dont want to promote all the changes we get via svn update!
I want to manually select each artifact and then build it via Jenkins and deploy it.
Any plugin which will allow me to do that? I dont have a simple criteria like exclude *.jar or *.xml but it is purely manual human intervention.
Thanks,
Zoom
What about making a new job with build parameters. One of the parameters could be a svn tag/branch to build/run/use, then have a build step that runs a script. In the script you can do whatever you wish with that svn tag, including a checkout and build.
Or, if you want to use pre-built artifacts from another job, you can specify links to those artifacts in the build parameters or a job name/number and have the script automatically grab them for you.
Many different ways to run a job manually :)

Resources