Skip to content

publish: return api.ErrCanceled when user declines interactive prompts#13674

Open
ishwar170695 wants to merge 1 commit intodocker:mainfrom
ishwar170695:fix/publish-aborted-sentinel-error-v2
Open

publish: return api.ErrCanceled when user declines interactive prompts#13674
ishwar170695 wants to merge 1 commit intodocker:mainfrom
ishwar170695:fix/publish-aborted-sentinel-error-v2

Conversation

@ishwar170695
Copy link
Copy Markdown
Contributor

@ishwar170695 ishwar170695 commented Mar 26, 2026

What I did

Previously, declining the bind mount or sensitive data warning prompt caused publish() to return nil, which is indistinguishable from success for callers and automation scripts (exit code 0).

Change publish() to return the existing api.ErrCanceled sentinel so callers can detect user-initiated cancellation via errors.Is(). Add unit tests covering both the preChecks decline path and the full publish() path.

Signed-off-by: Ishwar chand meena ishwarcm@iitbhilai.ac.in

(not mandatory) A picture of a cute animal, if possible in relation to what you did

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR changes compose publish to return a detectable error when the user declines interactive safety prompts, instead of returning nil (success), so automation/callers can distinguish an abort from a successful publish.

Changes:

  • Introduce a new sentinel error (ErrPublishAborted) and return it when pre-check prompts are declined.
  • Add unit tests intended to cover “decline” paths for preChecks and publish.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
pkg/compose/publish.go Returns a sentinel error when publish is aborted via interactive decline.
pkg/compose/publish_test.go Adds tests for decline behavior in pre-checks and publish.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Signed-off-by: Ishwar <ishwarcm@iitbhilai.ac.in>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ishwar170695 ishwar170695 changed the title publish: return ErrPublishAborted when user declines interactive prompts publish: return api.ErrCanceled when user declines interactive prompts Mar 26, 2026
@ishwar170695
Copy link
Copy Markdown
Contributor Author

Updated PR description to reflect the use of the existing api.ErrCanceled instead of creating a new custom error.

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