Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 364486 - Inaccessible p2 repository leads to resolution problem - build should fail at root cause
Summary: Inaccessible p2 repository leads to resolution problem - build should fail at...
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Tycho (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Igor Fedorenko CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-22 11:15 EST by Tobias Oberlies CLA
Modified: 2021-04-28 16:55 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Oberlies CLA 2011-11-22 11:15:03 EST
If a project specifies repositories with layout p2 in the POM, and the repository URLs are invalid (or the server is not available), Tycho only prints out a warning and attempts to continue the build:

[WARNING] Failed to access p2 repository <id> (<url>), will try to use local cache. Reason: org.eclipse.equinox.p2.core.ProvisionException: Unknown Host: <url>

Since I haven't seen many builds which specify p2 repositories they don't actually need, and the "try to use local cache" never seems to do anything (reasonable), the build always fails during dependency resolution. Since the build fails anyways (in all cases I know), I believe it should directly fail at the root cause, i.e. when a repository cannot be read.
Comment 1 Tobias Oberlies CLA 2011-11-22 11:16:59 EST
@Igor: I assume that "try to use local cache" used to do something - but what? And what was the use case for not failing the build straight away?
Comment 2 Igor Fedorenko CLA 2011-11-22 11:23:26 EST
Tycho is expected to fall-back to locally cached repository metadata if repository is not accessible, provided there is local cache of course, and I am pretty sure it does that. This is extremely useful behaviour for flaky repositories, like download.eclipse.org right after a release.

The correct implementation should fail fast when remote repository is not accessible and there is no local cache, but I am not sure p2 provides a way to check that. At least I could not find a way.
Comment 3 Igor Fedorenko CLA 2011-11-26 10:57:43 EST
(In reply to comment #2)
> Tycho is expected to fall-back to locally cached repository metadata if
> repository is not accessible, provided there is local cache of course, and I am
> pretty sure it does that. This is extremely useful behaviour for flaky
> repositories, like download.eclipse.org right after a release.
> 
> The correct implementation should fail fast when remote repository is not
> accessible and there is no local cache, but I am not sure p2 provides a way to
> check that. At least I could not find a way.

I have to take this back. Due to apparent regression Tycho never falls back to local cache. I will push the fix with proper cache fall back bahavior, more precise warning message and a regression test shortly.
Comment 5 Tobias Oberlies CLA 2012-02-24 11:21:29 EST
I've just fixed another case that goes in the same direction: The build now fails if a repository with layout p2 from the POM doesn't parse as URL/URI. 

Submitted as a93b668 [1] to 0.15.0-SNAPSHOT.

[1] http://git.eclipse.org/c/tycho/org.eclipse.tycho.git/commit/?id=a93b668e6790fe3f1f82fde24408ee958fac87be