-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we update this message? This language is misleading/ambiguous.
- The
content build
command is targeting a named server, but that might not be this server (the host running thecontent build
script). - The previous
content build
command 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. It does feel odd to prompt after providing a --force
flag
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to remove the prompt
rsconnect/actions_content.py
Outdated
@@ -154,7 +157,8 @@ def build_start( | |||
build_add_content(connect_server, all_content) | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
@@ -885,6 +885,8 @@ build all "tracked" content that has the status `NEEDS_BUILD`. | |||
|
|||
> 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this include something like, "make sure any previously launched content build
operation is no longer active"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 running
errors without having to manually edit the JSON state fileFixes #603 #620 https://github.com/rstudio/connect/issues/29298
Type of Change
Approach
add a
--force
flag to thecontent build run
command. this ignoresrsconnect_build_running
being set totrue
in the state file to allow users to recover fromalready a build running
errors without having to manually edit the state fileremove the
rsconnect_build_running
check from thecontent build [add,remove]
commands--force
will only buildNEEDS_ BUILD
content by default, but can be combined with--retry
to build content in other statesupdate deprecated
logger.warn
usage tologger.warning
Automated Tests
added tests for
--force
andalready a build running
conditionsDirections for Reviewers
Checklist