fix: add content build run --force flag#630
Conversation
873bd06 to
38a374d
Compare
☂️ Python Coverage
Overall Coverage
New FilesNo new covered files... Modified Files
|
ad7de8b to
c817f8f
Compare
Signed-off-by: Lucas Rodriguez <lucas.rodriguez@posit.co>
c817f8f to
8e5071e
Compare
aronatkins
left a comment
There was a problem hiding this comment.
Some suggestions; take if you feel they're worthwhile.
rsconnect/actions_content.py
Outdated
| raise RSConnectException("There is already a build running on this server: %s" % connect_server.url) | ||
| if build_store.get_build_running() and not force: | ||
| raise RSConnectException( | ||
| "There is already a build running on this server: %s. " |
There was a problem hiding this comment.
Should we update this message? This language is misleading/ambiguous.
- The
content buildcommand is targeting a named server, but that might not be this server (the host running thecontent buildscript). - The previous
content buildcommand may have exited abnormally.
Possible wording:
A "content build" operation targeting SERVER-URL is still running, or exited abnormally.
Use the '--force' option to override this check.
There was a problem hiding this comment.
I like it! Your suggested wording is more clear and accurate. Updated to use suggested wording
rsconnect/actions_content.py
Outdated
| # prompt the user to confirm that they want to --force a build. | ||
| if force: | ||
| logger.warning("Please ensure a build is not already running in another terminal before proceeding.") | ||
| user_input = input("Proceed with the build? Type 'yes' to confirm, any other key to cancel: ").strip().lower() |
There was a problem hiding this comment.
If the user has given --force, I'm OK without prompting for confirmation. They've already given a command-line option, which is enough intervention.
There was a problem hiding this comment.
Agreed. It does feel odd to prompt after providing a --force flag
There was a problem hiding this comment.
Updated to remove the prompt
rsconnect/actions_content.py
Outdated
| else: | ||
| # --retry is shorthand for --aborted --error --running | ||
| if retry: | ||
| # --force has the same behavior as --retry and also ignores when rsconnect_build_running=true |
There was a problem hiding this comment.
Is there content that is not included in aborted, error, and running? What about NEEDS_BUILD?
Maybe --force should do its best to continue the previous run and not run things that already completed.
There was a problem hiding this comment.
Replying to my own comment: Any items that have NEEDS_BUILD are automatically included. Based on that, how do you feel about not making --force act like --retry? Yes, folks can combine --force and --retry, but by default, --force runs only the items that have not yet been run.
There was a problem hiding this comment.
Yep, NEEDS_BUILD content is automatically included in the build. My thinking was that folks who end up in situations where the --force flag is needed likely are in a similar state that also requires using --retry, but I have no evidence to back that up and is yet to be seen. I think --force only building NEEDS_BUILD content is a sensible default. Updated --force to only build NEEDS_BUILD content
Signed-off-by: Lucas Rodriguez <lucas.rodriguez@posit.co>
Signed-off-by: Lucas Rodriguez <lucas.rodriguez@posit.co>
Signed-off-by: Lucas Rodriguez <lucas.rodriguez@posit.co>
Signed-off-by: Lucas Rodriguez <lucas.rodriguez@posit.co>
Signed-off-by: Lucas Rodriguez <lucas.rodriguez@posit.co>
Signed-off-by: Lucas Rodriguez <lucas.rodriguez@posit.co>
README.md
Outdated
| > To re-run failed builds, use `rsconnect content build run --retry`. This will build | ||
| all tracked content in any of the following states: `[NEEDS_BUILD, ABORTED, ERROR, RUNNING]`. | ||
| > | ||
| > If you encounter an error stating that a build operation is already running, you can use `rsconnect content build run --force`. This will override this check and build any content marked as `NEEDS_BUILD`. |
There was a problem hiding this comment.
Should this include something like, "make sure any previously launched content build operation is no longer active"?
There was a problem hiding this comment.
Ahh yeah that's a good suggestion. Added a note for that and made an attempt to improve the flow of the wording as well
Also, improve overall flow of --force docs in readme Signed-off-by: Lucas Rodriguez <lucas.rodriguez@posit.co>
Intent
Provide a way to recover from
already a build runningerrors without having to manually edit the JSON state fileFixes #603 #620 https://github.com/rstudio/connect/issues/29298
Type of Change
Approach
add a
--forceflag to thecontent build runcommand. this ignoresrsconnect_build_runningbeing set totruein the state file to allow users to recover fromalready a build runningerrors without having to manually edit the state fileremove the
rsconnect_build_runningcheck from thecontent build [add,remove]commands--forcewill only buildNEEDS_ BUILDcontent by default, but can be combined with--retryto build content in other statesupdate deprecated
logger.warnusage tologger.warningAutomated Tests
added tests for
--forceandalready a build runningconditionsDirections for Reviewers
Checklist