rstudio / rsconnect

Publish Shiny Applications, RMarkdown Documents, Jupyter Notebooks, Plumber APIs, and more
http://rstudio.github.io/rsconnect/
133 stars 81 forks source link

Github Deployment on Posit Connect doesn't follow files/directories outlined in manifest.json #963

Closed keatonwilson closed 11 months ago

keatonwilson commented 1 year ago

Hi all,

Thanks for all the incredible work on rsconnect! We've (@ksradmingroup) recently been working through some challenges when deploying Shiny apps from GitHub to Posit Connect. There are occasionally situations where we'd like to specify which files and directories get bundled for deployment. We were under the impression that the combination of an .rscignore file containing the appropriate directories/files and subsequent manifest.json (built with rsconnect::writeManifest() would do the trick.

However, on our deployments, it appears that the bundle always contains every directory and file in the branch being deployed, regardless of what is outlined explicitly in the manifest.json. We've created a small test app reprex to illustrate the issue, and have verified the behavior on our deployment infrastructure.

Any help or guidance that could be provided would be wonderful!

hadley commented 1 year ago

Can you confirm that these are the files that you expect to be deployed?

https://github.com/ksrinc/connect_manifest_reprex/blob/main/manifest.json#L1520-L1530

keatonwilson commented 1 year ago

Can you confirm that these are the files that you expect to be deployed?

https://github.com/ksrinc/connect_manifest_reprex/blob/main/manifest.json#L1520-L1530

Exactly! Our expectation is that everything in ./data_2/ should not be in the deployment bundle given the directory is included in .rscignore and absent in the subsequent manifest.json.

aronatkins commented 1 year ago

How are you deploying this content to Connect? Do you have a GitHub Action that publishes to Connect or is Connect fetching from your Git repository?

If it is the latter, this is likely because Connect does not rely on the files enumerated in the manifest.json when extracting your content from Git; it grabs the entire directory using git archive. That operation happens without considering the manifest.

keatonwilson commented 1 year ago

@aronatkins I believe it's the latter - Connect is fetching from the repository but @ksradmingroup can confirm. I guess we were under the impression that the manifest.json was required for this methodology - or is it utilizing other pieces of the manifest (e.g. package details) but not the file/directory specification?

aronatkins commented 1 year ago

Yes, that's currently true - the file listing does not inform the bundling from Git by Connect. There isn't a lot of control today over what from the Git repository is grabbed -- Connect uses git archive to extract a specific directory from the repository.

Your suggestion makes a lot of sense. There are probably some folks and workflows that are not that careful about regenerating the manifest (updating only when package dependencies change), so we would need to think about how to navigate that problem.

In the meantime, you could reverse the relationship and deploy from some CI action. That would give you much more control over what appears in the bundle.

keatonwilson commented 1 year ago

Thanks @aronatkins - I just confirmed with our IT team, and we are in fact letting Connect fetch from the Git repo. We're looking into deploying via a CI-action framework - that's a great suggestion. Totally agree with you on navigating scenarios where files may change but users aren't regenerating the manifest.json. Eventually, it would be wonderful to be able to have this implemented - what's the best way to tag this as a feature request? Happy to help facilitate in any way we can.

Also, I'm not sure if it's totally under the scope of this thread, but when we were browsing the Posit Connect documentation around Git-backed content we didn't find a section pointing to this. Perhaps it would be good to add to the Limitations section?

hadley commented 11 months ago

Closing this because it sounds like this is a current limitation of the git backed deployment, we have filed issues to both list this as a limitation in the docs and one day fix it in connect itself.