I have a config file in Jenkins which contains list of servers. Which running parameterized job pipeline I would like to list it and choose the server where the code can be deployed.
How can I write that in "groovy template for pipeline" area as xml?
Config file content:file.txt
Server1
Server2
Server3
A Checkbox list should come to select the servers.
Make a new pipeline project.
Enable the option 'The project is parameterized'. Then choose the check box option. I used active choice reactive .
Here we can have type as checkbox. Save it once.
Now take the job history and we can view the XML of the project. From this the XML can be copied and used.
Related
We have number of jobs configured in Controlm and now we got new environment to configure same set of jobs,
Is there any way to create controlm jobs from backend server by writing shell or any scripts?
Any other possibilities to avoid spending time in creating same jobs again and again for each environment??
Control-M provides the functionality to export/import jobs across environments : https://communities.bmc.com/docs/DOC-50416
There are a couple of ways:
From the Planning domain, load the job folders you want to migrate into a blank workspace.
from the top bar then click Export and save. This will save a .xml file you can edit using a text editor and then Import Workspace and load - you can import the .xml into the same Control-M if environments are on one CTM EM Server, or a different CTM EM Server.
OR
From the planning Domain, load the job folders you want to migrate, right click on the folder and select Duplicate, then through the GUI update the new folder (If doing this I'd then unload the source folder just to ensure nothing is overwritten there). You can use the Find & Update option. This will only work if your environments are on the same CTM EM server.
I am new to the Cloudbees Enterprise of Jenkins and to the concept of "templates".
I am trying to define a new template and this template will be used by 20-30 number of jobs. The job is a basic build job. After the build, I would like to have code analysis plugin. How can I define it in the Jenkins Template.
I can define it while creating a direct job in "Post Build Actions" but not sure how to define the same in a template.
Do you have any solutions/ suggestions ?
Cloudbees templates plugin is very powerful but not easy to master. Creation and administration of templates is not as user-friendly as one wishes it to be. ;)
For an introduction I recommend reading the following resources:
Basic concept
Template documentation
Tutorial for simple job template
Make sure you understand the difference between builder template and job template. I assume you want to create a number of jobs using the job template. Follow these steps:
First of all create a normal job that contains all actions you want to perform by all templated jobs.
Make sure this job works as expected for one example configuration.
Now create a new job template:
You will need to decide, which parts of the job configuration need to be adapted to each jobs configuration (e.g. source code repository). Create an parameter for each configuration option.
You might want to do some pre-processing on the job templates parameters using some transformation script - but we skip that for now.
Now you need to add an XML description of what the generated job should do. I recommend copying this XML description from our example job created in step #1. You can access it via this URL: http://your-jenkins/job/this-job/config.xml. Simply copy&paste the XML code in the browser. Newer Jenkins versions also allow to read the jobs XML configuration via the user interface.
Finally you need to fill in the templates arguments within the XML configuration. Simply replace the specific (hard-coded) values by a reference to the name of the templates parameters created before: ${param_name}
Save the template
Now create a new job. On the job creation screen you should be able to select your newly created job template as job type. After creating a job of the templates type you can define all template parameters for this specific job.
Try to run the template-based job and make sure it works as expected.
Create more template-based jobs as needed.
All template-based jobs share the build steps defined by the job template. If you change the job template later on, all depending jobs are updated accordingly. This is a very efficient way to administrate a large number of similar jobs. It is very much worth the effort. Good luck!
I'm trying to migrate my TeamCity server to use SQL Server following the instructions at https://confluence.jetbrains.com/display/TCD10/Migrating+to+an+External+Database.
In step 3 it says
Create a temporary properties file with a custom name (for example, database.database_type.properties) for the target database using the corresponding template (TeamCity Data Directory/config/database.database_type.properties.dist).
but I can't find database.database_type.properties.dist anywhere on disk or in the installer package.
Where is database.database_type.properties.dist?
It's database.<database_type>.properties.dist where <database_type> in your case is mssql, so you should look for a file database.mssql.properties.dist.
The file is under <TeamCity data directory>/config. Path to the data directory you can see on Administration -> Global Settings page in TeamCity web interface.
We're using TeamCity 9 and have a pool of agents, only some of which can run a particular job we've created. It's going to be a while before a new pool can be created with new agents, and in the meantime we would like to set this job to run only on specific ones.
In the configuration settings we can choose system.agent.name, but that only allows us one agent. Is there a way to configure things so that I can run on multiple agents based on their name, so that, say teamcity_agent01, teamcity_agent07 and teamcity_agent12 are eligible?
If the capabilities you want on the agent expose environment variables you can have a command line step refer to the environment variable and that will scope the job to a suitable agent.
e.g.
echo "%env.PATH_TO_GIT%"
You can add environment variables to your agents like this
open file “/conf/buildAgent.properties” at agent
system. This file contains parameters in key=value format.
To add a system properties add line like -> system.os=Linux
To add an environment variable add line like ->
env.JAVA_HOME=/home/java/jdk1.6.0_13 the
The beauty of this is that as you add more capabilities and agents then you don't need to revisit each job to change where it can run
For Teamcity 9.x
Next to the Projects, and Changes select Agents.
Select the agent that you want to run specific jobs on.
Select the "Compatible Configurations" tab.
On the "Current run configuration policy" dropdown select "Run assgined configurations only"
Click on the "+ Assign configuration" button.
Compatible configurations are colored blue. Select as you wish.
The timing of the configurations and when they should run can be configured under each build configuration triggers tab.
The context is that I have a script that automates the update or deployment of applications on WAS 6.1 servers from a DMGR. This script use a setting file that contains the application name, the server cell, node and name. I don't want to make manually a file for every application. I searched IBM for a way to get all these informations and can't find how.
http://pic.dhe.ibm.com/infocenter/wasinfo/v8r0/index.jsp?topic=%2Fcom.ibm.websphere.base.doc%2Finfo%2Faes%2Fae%2Ftxml_listapp.html
I know how to list apps on a server but I need to link all those infos together.
$AdminApp list (any options would give me info I need?)
Use the scriptLibrary included in WAS version 8:
AdminApplication.listApplications()
Returns: List of the available application names in the respective cell.