I have a Cloudbees Jenkins instance configured to build several Mercurial projects. I would like to configure global Mercurial options that would normally go in ~/.hgrc, such as:
[extensions]
eol =
When setting up my own standalone Jenkins instance, I normally just log in as the user running Jenkins and set up its environment.
For Cloudbees, it's not clear how I should handle this. I don't see a way to configure the Mercurial Jenkins plugin to use a specific configuration file. Even if I could do that, I'm not sure where or when to fill in that file.
Can I somehow create a ~/.hgrc that applies to my entire Cloudbees Jenkins instance? Or do I need to do this on a per-job basis? I might be able to set up HGRCPATH in a pre-build step via EnvInect, or maybe modify the project .hgrc via a script build action. However, it seems like neither of these would necessarily happen early enough in the build process to take effect when the job starts.
I feel like I'm missing something obvious. Can someone suggest the proper way to accomplish this?
Go to the system configuration page and create a new Mercurial installation. Leave Installation directory blank and set Executable to simply hg, then set whatever you need in Custom Configuration (see the inline help). Now just select this alternate installation in your project(s).
Related
CICD Process with Jenkins, Bitbucket, SSDT(SQL Server Data Tools).
Please list out the steps to perform CICD Process.
Including what plugins i need to install in Jenkins for SSDT(SSIS-ISPAC file) or SQL Database Solution(DAPAC file)
This question is very broad and as with all the stuff related to databases the best answer would be "it depends". As far as I know that there is no proper plugins either for Jenkins nor for Bitbucket that work with SSDT very well so you'll need to implement all your actions by yourself.
It will depend on your system how the pipeline should look like. There are a lot of questions that you'll need to answer first but without knowing your exact situation it is very hard to suggest you something specific. Example questions:
How many environments do you have?
Do you have tests?
Can somebody change the state of the destination database manually, passing the CI/CD pipeline?
Will you run publish on every commit?
Do you trust what SSDT will decide how to publish database? (Mostly people would like to preview the script that would be executed on prod)
Then after answering these questions you'll might know what will you need. After that you need prepare the proper publish script, exclude/ignore/add object types you'd like to deploy and use MSBuild.exe and SQLPackage.exe command line utilities. You'll run these utilities with specific set of arguments and paths to the publish configs, DACPACs, etc. Bamboo and Jenkins supports command line commands for that.
I am looking for a way to add/remove/update Jenkins master environment variables using some way of configuration management.
If this can be done with Ansible even better.
Please note that I would like to avoid patching the config.xml file manually, especially because this would risk to create issues and a Jenkins restart would be required and this is to be avoided whenever is possible.
In case it was not clear, I am trying to find an automation solution for altering Manage Jenkins - Configure System - Global properties.
you can configure all your Jenkins master using groovy.
I just did the same when we upgrade to Jenkins 2.
here are some links : https://pghalliday.com/jenkins/groovy/sonar/chef/configuration/management/2014/09/21/some-useful-jenkins-groovy-scripts.html
https://github.com/DotCi/jenkinsci-dotci-example/blob/master/configure-dotci.groovy
https://gist.github.com/vrivellino/97954495938e38421ba4504049fd44ea
BTW , you can install your plugins using CLI it will save you time in the future.
and you can create all your jobs using DSL , so all changes will be in github.
if you have specific question , let me know
I would like to know, how to copy the "Post Build Activity" setting to all other builds in the same Jenkins server.
Example :
I have 100 or more builds are running in the Jenkins server.
Recently I have installed "Work Space Cleanup" plugin in the Jenkins Server
Now I have to enable/set the "Work Space Cleanup" property which is there in "Post Build Activity" for all 100 builds.
I am looking out for a common place in Jenkins to update the setting which intern updates the same setting for all 100 builds.
Thanks in advance.
Regards,
Bhupal.
Depending on what you require Configuration Slicing plugin has removed the support for the exact plugin you're asking for, but it would probably be possible to make a batch file, python script or something that removes the files wanted and then slice it among the projects.
When you are saying builds, i assume you mean to say projects/jobs. When you create a job, the configuration is stored in config.xml which is present on Jenkins server under the following path:
/path_to_jenkins_setup/jobs/job_name/config.xml
Just open the file and find the relevant portion that you need to replicate in other jobs. Create a script to copy the relevant portion to all jobs' config.xml.
Don't forget to restart Jenkins after making the changes. Alternatively, you can reload your changes by clicking on Reload Configuration from Disk which is present in Jenkins > Manage Jenkins section.
Am very new this kind of S/W development industry and since am here as system engineer, my task is to implement a Build and Release management system using Jenkins. So, far am able to install, configure and even build the war files for my java proj using maven after checking out the sourcecode from my svn. Now the actual task it to build mutliple war file for the same proj for my different environment like UAT, Staging and Prod. I dont want to create multiple jobs, however I would like to use the multi-configuration option to achieve this. So, can anyone please help me in doing this?
Thanks,
Sree
I strongly advise against building environment specific release binaries. Instead address what it is that makes one environment different from another. Generally it is configuration held in property files recording information like:
Database URLs and credentials
System sizing information
..
Baking this into the release makes your software very inflexible. For example why should you have to rebuild your software everytime the database password is changed?
The solution is the use of standards like JNDI. In tomcat you can use context files to set datasources and other variables.
I've been reading this wiki article about the Jenkins CLI. Is there a way to rename a job through the CLI? I can't seem to find a way. An obvious workaround would be to copy a job then delete the old one, but I'm hoping there's a more straight forward way.
For what it's worth, I had to rename a larger number of jobs and was hoping on the CLI. There is no dedicated rename command. I did not try to get-job and then push a changed version up again, maybe that would work.
I have no direct access to the Jenkins machine and thus cannot mess around on the file system, like some suggested.
I resorted to a manual approach, with some clicking - maybe this is viable workaround for others: https://.../jenkins/job/OLD-JOB-NAME/rename?newName=NEW-JOB-NAME - this will give you a "are you sure" prompt, which after confirming should rename the job.
I wouldn't bother with Jenkins' own CLI. If you just navigate to the Jenkins jobs' directory on your filesystem and rename the job using the 'mv' unix command, then refresh Jenkins it should be fine. (you may have to reload the config from the disk in the Jenkins settings if refreshing doesn't work)