I am currently trying to solve an issue where I am not using Git for any purpose rather we just want to use Jenkins to trigger our pipeline whenever there is change in the symlink located in a folder and not in the workspace
I suggest that you'll try to use https://plugins.jenkins.io/fstrigger, even that it may not really being supported currently.
Related
How is that possible to add Pre-Build actions in Jenkins, exactly like it's Post-Build ?
I've came across Conditional BuildStep, Run Condition and Parameterized Trigger plugins, but can't find out a way to add that.
Sadly there is no real pre-build event because not every pipeline may build something.
You can disable the default checkout by using the option skipDefaultCheckout and manually do the git checkout later using the command checkout scm. I think this is the closes you will get to reach a Pre-Build-Stage.
I don't want my global pipeline changes to show up in Jenkins list of changes.
Whenever a build is ran and there are global pipeline updates, the list of changes for that build include all updates made to the global pipeline. I only want the list of changes that the build picked up from the SCM branch that is being built, not any of the global pipeline updates. Is this possible?
Such option to disable the changelog exists since version 2.9 of the Pipeline Shared Groovy Libraries Plugin:
#Library(value="mylib", changelog=false)
You can also uncheck the corresponding box in the Jenkins system settings if you are administrator for your Jenkins, see here:
In addition to #StephenKing's response, if you use the library step, do it this way
library identifier: 'mylib', changelog: false
More info on the topic in this improvement request
I have encountered the same problem and did an ugly workaround .
just at any change of the pipeline library put a prefix in your source control commit and then when you parse your changes you can ignore the changes with the commit prefix comment
I hope it helps
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.
I have a job in Jenkins and want the groovy script for the same? Is there a way I can do that?
I have created a Job using Jenkins, like add shell Command, Sync from repo,etc. Now I wish to have groovy script for the same, but I dont want to go to the trouble of writing the entire thing again. Is there something like Export to .groovy?
P.S. I am not sure of the correct tags.
You want to copy your configuration using Groovy script to create a new job or to persist.
Below Links are helpful for clone/ copy and create jobs using groovy script.
http://jenkins-ci.361315.n4.nabble.com/How-to-Copy-Clone-a-Job-via-Groovy-td4097412.html
Can I use Jenkins CLI or some groovy scripts to create a new job
https://wiki.jenkins-ci.org/display/JENKINS/Clone+all+projects+in+a+View
In case you want to persist your Job, always backup your resources file such as config.xml, jenkins.xml,etc..
you can recreate job from config.xml which holds all your job configuration
Check out this plugin. It seems to be appropriate for your purpose. Though it has some restrictions for plugins in your jobs that are not capable of Pipeline syntax. Anyway, it could be useful for code generation.
Recently our organization decided to move from using Maven/Cargo-plugin to deploy our applications to using Puppet. We still have all of our builds and test jobs in Jenkins. So what I'm trying to figure out is how do I trigger a specific Jenkins job based on a specific line being changed in a puppet manifest? We are using a manifest that has all of our deployed components and their versions. If I change the version of one of the components, I want a specific test job to be triggered based on which component was changed. And eventually I will want to rollback the puppet change if the test fails. Has anyone done something related?
I haven't used it for your specific use case, but for a "pull" scenario where you want to monitor the contents of the Puppet manifest for changes, the Jenkins FSTrigger plugin should work for you as long as your Jenkins job can access the Puppet manifest file. You can set it up to look for changes in the entire file content, or just in a particular part of the contents.
If you want a "push" scenario to trigger a build as soon as the Puppet manifest is changed, you could write a script that runs after the changes are saved, checks which components have been changed, and triggers a build via the Jenkins CLI.