Skip to content

Conversation

@omar-rs
Copy link
Contributor

@omar-rs omar-rs commented Jul 13, 2023

Intent

Redeploy to Posit Cloud from a project now correctly associates the content with that project. Previously, this was done on new deploys only. This affects Posit Cloud only.

Resolves #409

Type of Change

  • Bug Fix
  • New Feature
  • Breaking Change

Approach

The code to fetch the Posit Cloud project associated with the content (in the case of the initial deployment) was extracted as a function and re-used in the case of re-deployments. In the case of re-deployment, the existing content in Posit Cloud is updated so that it is associated with the current project.

Automated Tests

The automated tests assert the API calls made to Posit Cloud to 1) retrieve the id of the current project, and 2) update the content being redeployed with that project id.

Directions for Reviewers

Minimal steps to verify:

  1. create a new project (A) in Posit Cloud
  2. install rsconnect
  3. create an Rmd file and render it to html
  4. deploy the rendered html to Posit Cloud using rsconnect deploy html my_output --name posit.cloud
  5. verify the content is deployed correctly and that it is associated with project A
  6. record the id of the content in the content URL (e.g., https://posit.cloud/spaces/1425143/content/**1942409**)
  7. create a new project (B) in Posit Cloud
  8. install rsconnect
  9. create an Rmd file and render it to html
  10. deploy the rendered html to Posit Cloud using rsconnect deploy html my_other_output --app-id <id_from_step_6> --name posit.cloud
  11. verify the content is deployed correctly to the URL as step 6 and that it is associated with project B

Checklist

  • I have updated CHANGELOG.md to cover notable changes.
  • I have updated all related GitHub issues to reflect their current state.

@omar-rs omar-rs requested review from mmarchetti and mslynch July 13, 2023 21:54
@github-actions
Copy link

github-actions bot commented Jul 14, 2023

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
4234 2698 64% 0% 🟢

New Files

No new covered files...

Modified Files

File Coverage Status
rsconnect/api.py 67% 🟢
TOTAL 67% 🟢

updated for commit: 24284b3 by action🐍

rsconnect/api.py Outdated
project_id = project_application["content_id"]
# this is a deployment of a new output
# associate the current Posit Cloud project and space (if any) to the new output
project_id = self._get_current_project_id()
Copy link
Member

Choose a reason for hiding this comment

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

Both calls to self._get_current_project_id() could move up before if app_id is None:.

@omar-rs omar-rs force-pushed the redeploy_posit_cloud branch from 39340a2 to 24284b3 Compare July 18, 2023 14:52
@scubastevew
Copy link

scubastevew commented Jul 18, 2023

Verified

  • Using the steps to reproduce, the content is associated to the correct project in:
    • Named space
    • Null space
    • Projects in 2 different named spaces
  • Users attempting to publish to an existing app ID for a different user are prevented.

@omar-rs omar-rs merged commit 22dac9c into master Jul 18, 2023
@omar-rs omar-rs deleted the redeploy_posit_cloud branch July 18, 2023 20:54
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.

Update project_id on redeploy for Cloud

5 participants