This PR adds support for an optional dir query parameter to the deployment API endpoints:
GET /api/deployments
GET /api/deployments/$NAME
POST /api/deployments
POST /api/deployments/$NAME
PATCH /api/deployments/$NAME
DELETE /api/deployments/$NAME
The directory is relative to the workspace root directory, and cannot escape it (the API should return a 400 if you provide a path that would be outside of the workspace root).
It also populates the returned configuration DTO with a new projectDir field that contains the subdirectory (again, relative to the workspace root).
Existing tests have been updated to assert that the projectDir is correct when no dir is specified. New tests have been added specifically to test the subdirectory case for each API.
Directions for Reviewers
Run the agent in a parent directory (one or more levels up from your deployable projects). Access deployment info from subdirectories using the various APIs:
The POST /api/deployments/$NAME endpoint should load the configuration named in the deployment from the same directory path; verify that.
Also run the extension and regression test basic publishing (you can't use subdirectories in the extension yet, but everything should default to the current behavior).
Intent
This PR adds support for an optional
dir
query parameter to the deployment API endpoints:The directory is relative to the workspace root directory, and cannot escape it (the API should return a 400 if you provide a path that would be outside of the workspace root).
It also populates the returned configuration DTO with a new
projectDir
field that contains the subdirectory (again, relative to the workspace root).This is part of https://github.com/posit-dev/publisher/issues/1844 and part of https://github.com/posit-dev/publisher/issues/1851.
Type of Change
Automated Tests
Existing tests have been updated to assert that the projectDir is correct when no dir is specified. New tests have been added specifically to test the subdirectory case for each API.
Directions for Reviewers
Run the agent in a parent directory (one or more levels up from your deployable projects). Access deployment info from subdirectories using the various APIs:
The
POST /api/deployments/$NAME
endpoint should load the configuration named in the deployment from the same directory path; verify that.Also run the extension and regression test basic publishing (you can't use subdirectories in the extension yet, but everything should default to the current behavior).