let Tycho/Jenkins build fail when p2 site doesn't exist

163 views Asked by At

I have an RCP application which I build in Jenkins using "mvn clean verify" to run Maven/Tycho. When the target platform of my application contains a p2 repository site that is not available anymore, Tycho prints a warning but still uses it's local cache.

[WARNING] Failed to access p2 repository http://download.eclipse.org/technology/babel/update-site/R0.11.1/indigo, use local cache. Neither http://download.eclipse.org/technology/babel/update-site/R0.11.1/indigo/content.jar nor http://download.eclipse.org/technology/babel/update-site/R0.11.1/indigo/content.xml found.

It took my quite some time to notice this problem because the Jenkins build succeeds without any issues and I am not going to read all console output...

I would like to get notified of this issue so I can take measures when a repository is moved or deleted. Tycho should still use it's cache under normal circumstances.

Can I solve this using Jenkins or can I instruct Tycho to fail fast (drawback: also fails on temporary outage)?

To partly answer my question the best solution is probably to set up a local p2 mirror, but I think this requires a lot more work.

1

There are 1 answers

0
Henno Vermeulen On

You can mark a Jenkins build unstable or failed based on it's output by using the Jenkins Text finder plugin.

  • Manage Jenkins plugins and install the text finder plugin from the Available plugins.
  • Edit the project to add a post-build action "Jenkins Text Finder".
  • Check 'Also search the console output', set the Regular expression to 'Failed to access p2 repository' and check 'Unstable if found'.