Does the file parameter work at all in a workflow job? If so, please explain how to do so.
When I add a file parameter under This build is parameterized in a workflow, it won't be uploaded. The parameter/variable will contain the file name though. While in a free style project an upload "step" is shown during a build.
jenkins (1.617),
workflow (1.8)
I do not believe file parameters can be made to work currently, as described in JENKINS-27413.
Related
Can any one please tell me that we can generate entire Jenkins file script with snippet generator?
I have to write Jenkins file including steps like Check Out Code, Build using Gradle, Pushing to nexus, Generate Sonar Report and Generate Package for deployment.
You can generate all the parts with the snippet generator but you have to put it all together in your defined stages.
Maybe you can start from examples or search in github for jenkinsfile
But be aware of the two different flavours of the Jenkinsfile:
scripted
declarative
I'm using Jenkins integrated with git and gerrit trigger.
I manage a huge repo that leads with a big amount of commits. So i'm not interested on running a complete build of the whole project on every push.
The idea here is just build the especific project .pom file where there is code changes.
For example:
-"common" is a subdir with its own .pom
-"persistence" is a subdir with its own .pom. "persistence" depends on common dir.
So if there is a change on persistence dir i have to build only the persistence .pom file because it will build common as a dependencie. On the other hand if someone change code on common, the jenkins do not have the necessity of building persistence. So it will save me time and hw resources.
So the question here is how could i do this? Does gerrit trigger have any support for this?
Update: On selecting the changed files does the file RegEx option refers to the file Path or the file name?
And also, is there a way to, using file RegEx field, express something like build "if changes in common and not changes in persistence"?
Have you tried to use Dynamic Trigger Configuration? you define a filter - on which change the job should start. So you create jobs for each build then define a proper gerrit trigger with filter.
Or if you want to use only 1 job for every build - then write a script where you can use git to determine which file was changed and then select the right project file for it.
Update: try to play with New build parameter: GERRIT_TOPIC
So push your changes with a proper TOPIC name e.g.
git push origin HEAD:refs/for/master/topic_name
where topic_name can be common, persistence
the topic name can be filled automatically with pre-push hook in git.
I'm in the process of updating our build process for Android to use gradle. We have client-specific apps - i.e. a single code template which is used as the basis for all the apps which are created dynamically.
To build the apps, I loop through a CSV file to get the details for each one. I then take a copy of the source template, inserting the client's name, images, etc. before compiling the app. This works fine in the current system. In the gradle version, I've got it successfully looping through the rows and creating the app source for each one with the right details. However when I try to actually build the app, it fails with the message:
Project with path ':xxxxxx' could not be found in root project 'android-gradle'.
From reading the documentation, I understand that this is because the project doesn't exist during the configuration phase as it's not created until the execution phase. However what I haven't been able to find is a way around this. Has anyone managed to achieve something similar? Or perhaps a suggestion for a better approach?
One option is to script settings.gradle. As in any other Gradle script, you have the full power of Groovy available. Later on you can no longer change which projects the build is composed of. Note that settings.gradle will be evaluated for each and every invocation of Gradle, so evaluation needs to be fast.
While Peter's answer pointed me in the right direction, it ended up not being a workable solution. Unfortunately with nearly 200 apps to build, creating a copy of the source for each one was too big an overhead and gradle kept running out of memory.
What I have done instead is to make use of the Android plugin's product flavors functionality. It was quite straight forward dynamically adding a productFlavor for each row in the CSV (and I can do that in build.gradle rather than settings.gradle), and I just set the srcDir to point to the relevant images etc for each one.
I would like a module to be run by all agents when a VCS trigger condition is met.
Is this possible?
One way you can do this is by adding a Schedule Trigger which has an option to run on all agents.
Having looked into it, as far as I can see, not directly,
the behaviour could potentially be achieved by using the command line remote runner plugin,(http://confluence.jetbrains.net/display/TW/Command+Line+Remote+Run+Tool) through a seperate build configuration linked to the VCS to detect the changes, calling the Remote Run tool from a command line build step to build the project on each required agent.
Further research into the Command Line Remote Run tool would be required to confirm this is possible.
There may also be some functionality allowing this in the REST API, although my look through the documentation didn't show anything up.
Have you had much luck working on alternative solutions?
I've created a build configuration to update our source managed third party referenced assemblies directory and this is a snapshot dependency on most if not all build configurations. When I update this directory with a new or more recent assembly, I'll too would like this configuration to be run on all build agents.
At the moment, I've simply duplicated the configuration and bound each to a specific agent. It adds management overhead, but has temporarily resolved the issue.
You could install this plugin and specify the list of agent names and it will run once per "value" in the matrix.
https://github.com/presidentio/teamcity-matrix-build-plugin
I have project configured in Jenkins that polls an SCM and begins a build when a change is posted. There is a post build action to build another project. The question I have is, the project that is being built afterwards has its own parameters. How do I know which parameter is specified when the post-build action triggers? Right now if if I use 'Choices', is it just picking the first one? How do I have it pick other ones?
OK, let's take it one by one :)
If you want to see which parameter were used, You can install this plugin: Show Build Parameters Plugin
If you want to trigger a build with a specific parameters, use this plugin: Parameterized Trigger Plugin