Determining the type of Jenkins project - jenkins

Ideally I would like to clone a jenkins project, but it is in say /dir1/dir2/dir3/dir4/dir5 and I am in /dir1/dir2/dir6/dir7/dir8 and I can "copy existing item from" but it does not offer a browse, and I don't know how to specify a project from a different directory. If someone knows, you could let me know.
In the meantime, I will just have two window open. One window displaying the current project and the other window creating a new one, and I will just copy the things over. My problem, and I bet it is very simple but I could not find out during research or else it is so simple I overlooked it ;-) Jenkins wants me to specify the type (Freestyle project, MultiJob Project, Maven project, Pipeline, etc) and I am not sure. I want to make it the same as the existing project, but I can't figure out how to tell what type the existing project is. It does check out files from SVN and build via Java.
Can someone tell me how to find out what type of project an existing maven project is?

There is no specific tag, but if you open a project, delete button have the type of project information available. pipleline project will have "Delete Pipeline" button, maven project will have "Delete Maven Project" button and a freestyle project will only have "Delete Project" button.
In addition one should have description text about this information.

On Jenkins' Dashboard, each project type has a different icon representation on the left of the project table. For example, Folder project has a Folder icon. When you hover your mouse over the icon, it will show a tooltip that is the project type.

You can go to the script page on jenkins(http://replace_with_your_jenkins_url/script) and execute the below script:
def jenkins = Jenkins.getInstance()
def jobName = "name_of_your_job"
def job = jenkins.getItem(jobName)
println "Job type: ${job.getClass()}"

You don't need to know the project type. Just click on 'New Item' and enter the name of the new project and enter the name of the project you want to clone from, in 'Copy from' input and click OK

Related

Is there a way to "Queue new Build" and override the output created by the Build Number Format

We are running TFS 2013 update 3 with Git - We have a powershell script that uses the output created by the BuildNumberFormat (environment variable TF_BUILD_BUILDNUMBER) that is generated at the time a build is executed. We also want to be able to queue a new build, and override that auto-generated BuildNumber, and specify a alternate (targeted hotfix for a previous tree / branch). With the default build template, there is no option to change the Build Number format (where we can statically set the desired value).
Our Build template:
Queue New Build template where we are targeting a specific changeset:
So the question is -- Do I need to edit the build work flow xaml to add this option as something that is passed in or is there a simpler way? I would like not to have to edit my power shell scripts that depend on this if we can. Ideas are greatly appreciated.
I ended up figuring it out, and it was incredibly easy. This may be an answer for similar questions also.
Copy the default build template (you can press download)
Place the file in your Repo path such as /BuildProcessTemplates/companyName.GitTemplate.12.xaml
Open the new xaml file in visual studios.
At the bottom of the screen, click the "Arguments"
Scroll down to "Metadata" and click on the edit button on the right
Scroll down to BuildNumberFormat - select it, and on the drop down "View this parameter when", change it to "Always Show the parameter"
Save the template, Commit it to your Git repo, push to your Git server.
Update your build Definition to use your new build template
You can now specify your own BuildNumber
Hope this helps someone. Looks useful for the other variables available in the build template.

TFS Build a project twice

We have a solution with multiple projects. We'd like to build one particular project twice (running a script editing a few files from project in between these two builds) producing two different outputs.
Looking at the build template I can't navigate down to the level of individual projects, I can only see "build the solution" in the XAML. So I don't think we can perform any project specific actions there. Will I have to go down into MSBuild or are there other ways to do this?
You can.
From the "Items to Build" dialog, when you press the "Add" button, select "MSBuild Project files (*.*proj)" from the "Items of type" combo, then select your projects.
Beware that Default build template will go through the list of items to build and you cannot insert actions in between.

Custom workspace in jenkins

I am not getting the check box to select custom workspace in Jenkins(ver. 1.465) while configuring the job, is there any plugin to get it?
After getting check box how to configure (path of workspace)?
I had the same problem. For a maven build, the option "Use custom workspace" is in Build Section ("Advanced" button)
in the general tab, when you go to the "advanced options" , you will see the "custom workspace" option
A couple of images to clarify how to configure a custom workspace directory.
The "Advanced" button to click to show the "Workspace Root Directory" option:
Use a root directory with ${ITEM_FULLNAME} to put your projects' workspaces under a custom directory:
If you want to use custom workspace choose freestyle or multi-configuration option, Custom workspace option is not supported in maven-project(From new item)
Maybe this answer comes a little bit too late but, anyway:
Jenkins v2.13, works on v1.652
Maven project
Build section
Click on Advanced button on the right side of the page
Check "Use custom workspace"
Fill in the path to the desired folder
Supports parameters too: ${SVN_BRANCH}

How can I copy & paste, or duplicate, an existing project?

I've got an existing Hudson project that is configured and working.
I need to duplicate the project so that I can have the original and then change the new one so that it points to a different source control.
I don't want to manually recreate the build. How can i "copy & paste" or otherwise duplicate the exiting build configuration, so I can get the new build configuration up and running faster?
Click on "new job" and then select "Copy existing job" at the bottom. Then enter the name of the job you want to copy into the text field.
In addition to copying a job, I sometimes copy parts of the XML file that contains the job configuration. You just paste the copied part into the xml file of the new job and reload the configuration (under manage hudson). This is helpful when you change the original job after you created your copy. However, for your use case the copy is the right thing to do.
When you do new job, you can make the choice to copy it from an existing job. Later alter the settings of the new job.

How to buld selective Projects within a Solution in TS 2008 in Team Build?

I have a solution the source Control (TFS 2008) with multiple projects. Some of the projects are independent of each other. I dont want to build the complete solution instead sometimes we need to build some of the projects.
I am a total newbie in Team Build. Please help how i can use the
<SolutionToBuild Include="$(BuildProjectFolderPath)/../../Development/Main/Build-Development.sln">
<Targets></Targets>
<Properties></Properties>
</SolutionToBuild>
to select only some of the projects from the solution.
Kindly give a detailed answer for me as i am absolutely clueless about it.
Thanks
The easiest way to do this is to define a new solution configuration for your existing solution. Just follow these steps:
Open your solution
From the main Visual Studio menu, select Build > Configuration Manager...
Click the "Active solution configuration" drop down and select New...
Enter a name for the new configuration (e.g. "TFS")
Specify the configuration to copy settings from (e.g. "Release")
In the "Build" column, uncheck any projects you don't want to build from your TFS Build
Click Close
Update your configurations to build to use the configuration you just defined
That's it! There's no need to manage multiple solutions and new projects should be included in your new configuration by default. Switching them off is as simple as clearing a checkbox.
Create a second build and a second .sln file to do the build. We have one project with three different builds in it (a "main" build, a "utility" build, and a "code analysis" build).
Manually create a solution that includes all the projects you want to build and check it in. Then create a new build using the wizard. Finally, edit the created .PROJ file (found in $/ProjectName/TeamBuildTypes) and point it to the correct solution.
Alternatively, you could copy and modify your existing .PROJ file, but since you said you're a newbie, I'd stick with the first to begin with.

Resources