Skip to content

Add validate option #453

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

Merged
merged 3 commits into from
Dec 5, 2023
Merged

Add validate option #453

merged 3 commits into from
Dec 5, 2023

Conversation

mmarchetti
Copy link
Contributor

Intent

This PR adds a validation step after deployment, as in posit-dev/rsconnect-python#511.

Validation is the default but can be disabled by setting validate = false in the deployment configuration.

Fixes #437

Type of Change

  • Bug Fix
  • New Feature
  • Breaking Change

Approach

The Connect client has a new ValidateDeployment method that accesses the deployed content using the user's credentials. This will fail if the app cannot successfully start (for example, it has an import error, or raises an exception in code that runs during import).

This also adds a new event phase publish/validateDeployment for the validation step. Since validation takes a couple seconds, this should have its own phase in the progress UI.

Automated Tests

Updated existing tests to cover this new step.

Directions for Reviewers

Deploy an app and see the validation step in the log:

time=2023-12-04T17:45:42.087-05:00 level=INFO msg="Validating deployment" event_op=publish/validateDeployment event_phase=start
time=2023-12-04T17:45:44.315-05:00 level=INFO msg=Done event_op=publish/validateDeployment event_phase=success ok=true

Deploy an app that imports a nonexistent package (so it fails startup), and see a validation error:

time=2023-12-04T17:42:25.406-05:00 level=INFO msg="Validating deployment" event_op=publish/validateDeployment event_phase=start
time=2023-12-04T17:42:27.337-05:00 level=ERROR msg="unexpected response from the server" event_op=publish/validateDeployment event_phase=failure error_code=serverErr URL=https://rsc.radixu.com/content/43485fe8-b037-4f2a-9f7e-e604d5347a1c Method=GET Status=500

Set validate = false in default.toml, and you should not see any validation activity in the logs.

Copy link
Collaborator

@dotNomad dotNomad left a comment

Choose a reason for hiding this comment

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

Created #456 as a follow-up to this.

@mmarchetti mmarchetti force-pushed the mm-validate-deployment branch from 4f7d62f to b802863 Compare December 5, 2023 15:17
@mmarchetti mmarchetti merged commit b7410d2 into main Dec 5, 2023
@mmarchetti mmarchetti deleted the mm-validate-deployment branch December 5, 2023 15:41
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.

Validate after deploying
2 participants