Skip to content

feat: add content migrate-to-connect-cloud - #838

Open
samperman wants to merge 1 commit into
connect-cloudfrom
migrate-shinyapps-io-deploys
Open

feat: add content migrate-to-connect-cloud#838
samperman wants to merge 1 commit into
connect-cloudfrom
migrate-shinyapps-io-deploys

Conversation

@samperman

@samperman samperman commented Aug 14, 2026

Copy link
Copy Markdown
Collaborator

Intent

Point a directory's local deployment record at an existing Posit Connect
Cloud content item, so the next deploy from that directory updates that
item instead of creating a second one. Connect Cloud cannot look content
up by name, so the local record is the only way back to a content item;
without one, deploying content that already exists there duplicates it.

Nothing is copied and no bundle is uploaded. The record that was
migrated from is removed, leaving the directory with one deployment
target rather than two; --from-server chooses which record to migrate
when the store covers several servers, and -o/--overwrite replaces an
existing Connect Cloud record.

Records are keyed by account, and a deploy refuses content owned by
another account, so a record written under the wrong account would be
silently useless. Migration therefore requires the content's owning
account to be the one being targeted and names it when it is not. With
no local record at all the record is reconstructed from the content,
with app mode unknown, which validate_app_mode already tolerates.

Fixes #826

Type of Change

  • Bug Fix
  • New Feature
  • Breaking Change

Approach

This follows the patterns established by rstudio/rsconnect#1353 and rstudio/rsconnect#1358

Automated Tests

Unit tests exist, integration tests are scheduled but will happen after this merges.

Directions for Reviewers

These steps can be used to verify it works locally:

  1. Setup credentials
    • uv run rsconnect add -n shinyapps -A <shinyapps-account> -T <token> -S <secret>
    • uv run rsconnect add -n cloud --connect-cloud -A <cc-account> # opens a browser
  2. deploy an app to shinyapps.io
    • uv run rsconnect deploy shiny ./my-app -n shinyapps
  3. Migrate the content in https://connect.posit.cloud
    • remember the content id
  4. Migrate the deployment record
    • uv run rsconnect content migrate-to-connect-cloud ./my-app -n cloud --content-id <content-id>
  5. Verify it, deploy it again
    • uv run rsconnect info ./my-app
    • uv run rsconnect deploy shiny ./my-app -n cloud

This tool will also create a new deployment record if its missing. This test can be done without shinyapps.io or content migration in Connect Cloud.

  1. Setup credentials as above
  2. Deploy content to Connect Cloud
    • uv run rsconnect deploy shiny ./my-app -n cloud
  3. Delete the deployment record
    • rm -rf ./my-app/rsconnect-python
  4. Migrate the deployment record, same as step 4 above
  5. Verify as in step 5 above

Checklist

  • I have updated CHANGELOG.md to cover notable changes.
  • I have updated all related GitHub issues to reflect their current state.
  • I have run the rsconnect-python-tests-at-night workflow in Connect against this feature branch.

Point a directory's local deployment record at an existing Posit Connect
Cloud content item, so the next deploy from that directory updates that
item instead of creating a second one. Connect Cloud cannot look content
up by name, so the local record is the only way back to a content item;
without one, deploying content that already exists there duplicates it.

Nothing is copied and no bundle is uploaded. The record that was
migrated from is removed, leaving the directory with one deployment
target rather than two; `--from-server` chooses which record to migrate
when the store covers several servers, and `-o/--overwrite` replaces an
existing Connect Cloud record.

Records are keyed by account, and a deploy refuses content owned by
another account, so a record written under the wrong account would be
silently useless. Migration therefore requires the content's owning
account to be the one being targeted and names it when it is not. With
no local record at all the record is reconstructed from the content,
with app mode `unknown`, which `validate_app_mode` already tolerates.

Fixes #826
@github-actions

Copy link
Copy Markdown
PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://posit-dev.github.io/rsconnect-python/pr-preview/pr-838/

Built to branch gh-pages at 2026-08-14 14:13 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

Comment thread docs/CHANGELOG.md
target rather than two; pass `--from-server` to choose which record to migrate
when there are several.

## Unreleased

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Looks like this heading is duplicated

Comment thread rsconnect/api.py
Only records for other servers are candidates: a Connect Cloud record is
what this migration produces, so treating one as a source would delete the
result. With no `from_server` a lone record is taken, and several are
reported rather than picked between.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Is this safe when the lone record is Connect's deployment record?

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.

2 participants