How to fail if <p4jresolve/> skipped any files due to merge conflicts? - ant

According to http://www.perforce.com/perforce/doc.current/manuals/p4ant/p4tasks.html#p4jresolve, files with merge conflicts are skipped. Even setting failonerror='true' does nothing in the event of merge conflicts.
Is the best way to check for merge conflicts to use:
<p4jresolve failonerror='true' forceresolve='true'/>
then check for conflict markers? If so, what's the Ant syntax to do that?

After you resolve normally, the files with conflicts will still require a resolve. So you can run p4jresolve again with the showactionsonly attribute and see if it reports any files left to resolve.
I haven't tried it myself but that's how I'd do it just using the command line.

If <p4jresolve/> doesn't succeed (eg due to a conflict), <p4submit/> will fail.

Related

With Jenkins Job Builder (JJB) what's the preferred way to inject values into a static set of job configuration files?

This bounty has ended. Answers to this question are eligible for a +100 reputation bounty. Bounty grace period ends in 14 hours.
frans is looking for an answer from a reputable source.
I have a working set of JJB YAML files successfully creating jobs and folders.
I now want to make certain values I use inside those YAML files configurable i.e. when running jenkins-jobs test|update -r jobfolder I want to set values for folder prefixes (to not damage existing production jobs), names for branches, nodes etc.
I don't want to use JJBs defaults approach for this since I'm already using it for configuration at a different place and it results in conflicts when used in projects and jobs together.
The ideal way of doing this I can think of would be a way to call JJB like this
jenkins-jobs test|update --define "folder-prefix=experimental/,node=test-node" -r jobfolder
Giving me variables I can use in the actual job definition files.
Since this option seemingly doesn't exist, I'm currently trying to provide files which contain those variables and somehow 'inject' them in my project.
Those are the approaches I can think of:
1 - having different configuration folders with YAML files inside, I would use like this:
jenkins-jobs test -r experimental-config:jobfolder
jenkins-jobs test -r production-config:jobfolder
with experimental-config and production-config being folders with additional files containing my configuration I can switch between.
But unfortunately I don't know how I would reference values I've defined in different yaml files. Is that even possible?
2 - having include files like described in the documentation
While that sounds promising I didn't manage to actually make this run. I tried to turn the following 'configuration header' I'm already using:
- dynamic-config: &dynamic-config
name: "dynamic-config"
folder-prefix: "experimental/"
node: "test-node"
[Rest of the file making use of dynamic-config]
into something making use of the !include statement like this:
!include: dynamic-config.yaml.inc
[Rest of the file making use of stuff defined in dynamic-config.yaml.inc]
giving me a seemingly unrelated parser error:
yaml.parser.ParserError: expected '<document start>', but found '<block sequence start>'
in "/home/me/my/project.yml", line 11, column 1
so I tried this snippet, which looks more like the example by putting it inside an existing element:
- dynamic-config: &dynamic-config
name: "dynamic-config"
!include: dynamic-config.yaml.inc
giving me a different error but still an error:
yaml.scanner.ScannerError: while scanning a simple key
in "/home/me/my/project.yml", line 7, column 5
could not find expected ':'
in "/home/me/my/project.yml", line 8, column 5
In both cases it doesn't make a difference whether or not the specified include file exists or not, which makes me doubt you can just 'include' a file like this at all.
What am I doing wrong here? Is there a more obvious / straight forward way to customize a jenkins-jobs run?
Update:
I somehow managed to use the !include tag for individual items now, like this:
- dynamic-config: &dynamic-config
name: "dynamic-config"
folder-prefix: !include: job-configs/active/folder-prefix.inc
branch-name: !include: job-configs/active/branch-name.inc
node-name: !include: job-configs/active/node-name.inc
But I wasn't able to put the whole dynamic-config element (with the anchor) into an include file yet.
2nd update:
Looks like I'm trying something similar as the guy from this question.
Can someone confirm, that this is currently still a problem? What's the JJB way of handling this?

TFS - Merge code from two versions of same file ( in same branch )

I have Two change sets in TFS (for a single file) , for example 8901 and 9053.
I want to merge the code in both these change sets.
When I select both the change sets, I don't find any option except compare and copy. Please refer below screenshot of the same.
I want to merge these two changesets so that I the file will finally contain both the versions of code.
Any suggestions on how to achieve this? Please help.
Thanks in Advance.
Merge is using between branches, not between changesets.
It seems 9053 is the latest version of your project, so you should have get this version in your workspace. In my example, it's TestCaseProject.
Then you can try to create a branch for this project from 8901, named TestCaseProject-branch:
After that, perform a merge from TestCaseProject to TestCaseProject-branch, and you can check whether TestCaseProject-branch includes all changes you need in 8901 and 9053.

error: addinfo_cache failed while cherrypicking

I am getting the followinge error while cherry-picking a gerrit...does anyone have info on what this means and why would anyone see it?
error: addinfo_cache failed for path 'ROE/NAS/src/abc.c
Looks like this has something to do with the whitespace and EOL. I also got the same issue today and just used the git-->mergetool to resolve the issue based on the following thread - http://git.661346.n2.nabble.com/error-addinfo-cache-failed-during-merge-tp6840473p6840622.html.
The only cause of concern, I now see the entire file modified instead of just the two lines which were part of my cherry-pick changeset.
Run git stash before cherry-picking. It helped at least in my case.

jenkins archive artifact excluding all subdirectory

I have a couple of job in Jenkins that archive artifact from the source tree for another job (some unit tests or alike). I have the current situation :
top_dir
\scripts_dir
\some_files
\dir1
\dir2
\dir3
\other_dir
I would like to archive all that is in "top_dir" including the files in "scripts_dir", but not the subdirectories "dir1, dir2,...", which I do not know the name, that are in "scripts_dir". These subdirs are actually Windows directory joints that point to other places on the disk, and I do not want them to be copied.
How do I achieve this with the inculde/excludes pattern of Jenkins ?
I already tried, having include=top_dir/ , exclude=
**/scripts_dir/*/
**/scripts_dir/*/**
**/scripts_dir/**/*
but it always exculdes the whole "scripts_dir" folder.
Finally, by using brute force, I found that the following expression does exclude all the files in the subdirectories of scripts_dir (whatever symlink or not), then removing these subdirs, while keeping the files directly in scripts_dir :
**/scripts_dir/**/*/*/
Thanks for the help anyway.
Reading the ANT manual, there an followsymlinks attribute that defaults to true. You said those things you want to exclude are symlinks (although i am not sure if this will work with Windows joints). Try adding followsymlinks=false
Another solution: if all your files under scripts_dir have a set number of characters in the extension, you can put that into your include statement. This will only pickup files with extensions of 3 characters:
**/scripts_dir/*.???
More on this here

Compiler warnings plugin: Fileset excludes

We are using Hudson as our build machine and I am trying to configure the excludes fileset for the Compilier Warnings plugin. Hudson parses the build log to determine warnings/errors and our Clover scripts output duplicates of real warnings.
As documented by Hudson you can configure an ANT fileset to exclude certain warnings:
Warnings to ignore:: Fileset 'excludes' setting that specifies the warnings to exclude from the report (based on their filename).
I am getting the following warnings (duplicates):
C:/vsfz/temp/1/clover1710786373818922904.tmp/src4952837385592305293.tmp/corp/app/path
....
I have set the excludes fileset to:
*vsfz/temp/*/clover*/**
I expected the Fileset to match the warnings and for them not be added to the Compiler Warnings report, this is not the case. Does anyone see a problem with the above Fileset definition?
Try something like:
C:/vsfz/temp/*/clover*/**
or
**/vsfz/temp/*/clover*/**
another problem might be that clover* doesn't match correctly so that you have to write it as clover*.* but I don't think this is the issue.
I was just messing with this today and I could only get it to work when I specified the file extension*.csor maybe *.* would work?
anyway **/old*/**/*.cs worked for me.
Hope this helps.
I managed to get this going (it has been on the back burner for quite some time now).
The template that I ended up using:
**/temp/**

Resources