With the Jenkins plugin "Parameterized Trigger Plugin" you can pass job parameters to a downstream job. You have to specify the downstream job which I don't know in my case.
In am using all maven jobs with the setting "Build whenever a SNAPSHOT dependency is built" enabled such that the downstream jobs are automatically detected and run by Jenkins it self.
A such, I don't know the downstream job such that I can't specify it when using the "Parameterized Trigger Plugin".
How can I pass all parameters value's to all the detected jenkins maven jobs?
Sorry, but I have to disappoint you. There is no way to add parameters to the Build whenever a SNAPSHOT dependency is built. There is a little manual work to do to "add this functionality":
Go to the triggered Job with parameter
Go to each Upstream-Job and add a post build action: Trigger parameterized build on other projects
Its not the ideal solution. But the plugin doesn't support this use case.
Related
I am writing a gradle custom plugin and the requirement is to fail build conditionally based on a parameter.
To fail the build i am throwing GradleException. If the property is not set, i want to log the reason and stop executing the plugin. Is there anyway other than System.exit?
I ended up throwing StopActionException when i need to stop action without failing the build.
In Jenkins I am not getting the Publish Junit test result report option in post build actions for my maven projects.
However, for freestyle projects I am getting the option, and am able to configure it properly.
Question: Is there any different approach that I need to follow for Maven projects? How can I configure JUnit for maven projects?
This is a known issue:
JENKINS-9980: Add the "Publish JUnit test result report" option to maven job configuration page
The main idea around this is that a Jenkins Maven job should publish the JUnit report automatically (so no need for this option), while in a freestyle job you may turn it to be a maven job yet having the flexibility of a freestyle/open configuration.
From comments to the JIRA ticket above, you could check suggestion on this old SO thread.
Basically, you are left with two options:
Use a freestyle Jenkins job to have full control, or
Use a Maven Jenkins job and review your pom.xml configuration or the way you are getting JUnit tests executed if the report isn't provided automatically (which could already be the case, hence end of the story).
We've configured Bamboo to use automatic dependencies based on Maven POM files. This appears to be working, insofar as the Bamboo interface correctly shows which the Maven artifacts required by and created by each plan, which upstream plans provide the dependencies and which downstream plans depend on the artifacts.
However, it also appears to not work, insofar as building an upstream artifact doesn't trigger a downstream build. Is it necessary to manually create child plans to trigger downstream builds -- an error-prone duplication of the information in the POM files? If so, the automatic dependency management isn't much use and it's hard to understand what the feature is for.
You can try adding a step in your parent build, using a script task to trigger whatever child build you'd like.
This way, you're not bounded by the Bamboo dependency/trigger mechanism.
https://answers.atlassian.com/questions/65517/trigger-bamboo-plan-via-rest-call
Hope this helps.
i have test packages like
test.regression.pacakgea
test.regression.pacakgeb
test.regression.pacakgec
these packages are developed by different people and am running them on VMs. i have configured an email notification for success and failures for each job. people may not be interested in going thru the mail for all the failures to find out which of their tests failed. the tests inside the packages extend junit and am using maven as a build tool
so is there a way in which jenkins can execute each package as a separate job. i can make each pacakge into a different project and in jenkins i can configure this as a new job but thats too tedious as everyone has to checkin into 2 locations.
If you're using Maven:
Make a Maven profile for each package you want to test.
Configure the Surefire plugin to only include the packages you want to test in that build using a variable from that profile.
Create a different Jenkins Job for each build with one of the three profiles.
Now Jenkins will test only that package in the given class.
Note that the include/exclude only works for the test packages. Those test might test code outside of that package.
I created some system properties in TC build configuration.
The value of these properties are passed to a maven configuration this way:
clean test -Dargument1=%system.property1% -Dargument2=%system.property2%
And this works as expected.
What I want to do now is to modify the value of the system properties when the build finish, so the next build will get these values.
Is it possible to do that programmatically, through Java or using Maven?
Is this the correct approach?
You can define build properties for this. Once your build finishes, you can craft a Maven plugin that sends a post request to TeamCity and alters the values for these build properties for the build type.
If I where you, I would craft maven task, which will update your properties via TeamCity restAPI on build completion.
It looks like mostly elegant way to do this task.
Full explanation for restAPI plugin could be found here:
http://confluence.jetbrains.com/display/TW/REST+API+Plugin
What is needed for your use-case is described here:
Build Configuration And Template Settings
Build configuration parameters: GET/DELETE/PUT http://*teamcity_url_goes_here*/httpAuth/app/rest/buildTypes//parameters/ (accepts/produces text/plain)
You could craft a request to update your parameters.
One more interesting thing: If you want to execute requests to REST API inside a TeamCity build running on the same server, you can use %teamcity.serverUrl% predefined parameter to construct URL