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

Warnings instead of exceptions for ConfigurationManager if deployment type has not been determined #3614

Conversation

DenisRumyantsev
Copy link
Contributor

@DenisRumyantsev DenisRumyantsev commented Nov 16, 2021

Description:
For some versions (e.g. 15), the Team Foundation Server cannot determine its own deployment type and return it to the agent (was not implemented yet). So the agent should write warnings to the diagnostic logs instead of errors when the deployment type determination is failed. However, if it is failed during the self-update process, the agent still should throw an exception, since:

  • there will be no checksum validation if the OnPremises will be set by default — and no one will know about it until check the agent diagnostic logs (not secure)
  • this can be skipped by setting the environment variable DISABLE_HASH_VALIDATION=true

ChangeLog:

  • src/Microsoft.VisualStudio.Services.Agent/Util/ServerUtil.cs —

    • the DeploymentTypeNotDeterminedException and DeploymentTypeNotRecognizedException custom exceptions are added;
    • the TryIsDeploymentTypeHosted method implemented. When the agent cannot get the deployment type from the server, this method will write a warning using the Trace and return false, which means, that the deployment type is not Hosted.
  • src/Agent.Listener/Configuration/ConfigurationManager.cs — the TryIsDeploymentTypeHosted method is used instead of the IsDeploymentTypeHosted method

  • src/Agent.Listener/SelfUpdater.cs — added more info to the exception message

Related issue

@DenisRumyantsev DenisRumyantsev requested a review from a team November 19, 2021 09:36
@DenisRumyantsev
Copy link
Contributor Author

Tested this pull request on the TFS 15. Changes work as expected. From now, in the pipeline agent diagnostic logs, during its configuration, the warning is displayed instead of the exception thrown.

Copy link
Contributor

@alexander-smolyakov alexander-smolyakov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@alexander-smolyakov alexander-smolyakov requested a review from a team November 30, 2021 14:56
@DenisRumyantsev DenisRumyantsev merged commit a7a72b2 into master Nov 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

config.sh fails with message: Deployment type has not been determined
3 participants