Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detect missing team project collection configuration #111

Merged
merged 2 commits into from
Aug 11, 2016

Conversation

olivierdagenais
Copy link
Member

Without the changes in this branch, if the Set build pending status in TFS/Team Services build step or the Set build completion status in TFS/Team Services post-build action were added without adding the corresponding Team Project Collection URL in the global configuration, the build output would contain:

ERROR: Error while trying to update pending status in TFS/Team Services
net.sf.json.JSONException: A JSONObject text must begin with '{' at character 1 of <!DOCTYPE(...)>
(...)
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>
        Visual Studio Team Services | Sign In
(...lots of HTML...)
</html>
    at net.sf.json.util.JSONTokener.syntaxError(JSONTokener.java:499)
    at net.sf.json.JSONObject._fromJSONTokener(JSONObject.java:919)
    at net.sf.json.JSONObject.fromObject(JSONObject.java:156)
    at net.sf.json.JSONObject.fromObject(JSONObject.java:132)
    at hudson.plugins.tfs.util.TeamRestClient.request(TeamRestClient.java:101)
    at hudson.plugins.tfs.util.TeamRestClient.addPullRequestStatus(TeamRestClient.java:200)
    at hudson.plugins.tfs.util.TeamStatus.createFromRun(TeamStatus.java:46)
    at hudson.plugins.tfs.TeamPendingStatusBuildStep.perform(TeamPendingStatusBuildStep.java:36)
    at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:78)
    at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
    at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:782)
    at hudson.model.Build$BuildExecution.build(Build.java:205)
    at hudson.model.Build$BuildExecution.doRun(Build.java:162)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534)
    at hudson.model.Run.execute(Run.java:1738)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:98)
    at hudson.model.Executor.run(Executor.java:410)

...whereas with these changes, the build output contains:

ERROR: There is no team project collection configured for the URL 'https://mseng.visualstudio.com/'.
Please go to Jenkins > Manage Jenkins > Configure System and then add a Team Project Collection with a Collection URL of 'https://mseng.visualstudio.com/'.

Mission accomplished!

Oli Dagenais added 2 commits August 10, 2016 12:30
This is better than returning null, which implied the requested
collection URL was configured with no credentials.
There's no need for a full stack trace.
@olivierdagenais olivierdagenais merged commit 2f1640c into master Aug 11, 2016
@olivierdagenais olivierdagenais deleted the detect_missing_collection_configuration branch August 11, 2016 19:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant