← Back to issue list

Add retry logic to publish action for connection failures

View original Github issue

Metadata

Project
snapcraft
Number
#5989
Type
pull request
State
closed
Author
Copilot
Labels
—
Created
Updated
Closed

Current evaluation

Copilot PR #5989 (commit 4cff0d0) added retry-on-connection-error logic to publish.yaml but was closed unmerged; mr-cal deferred the work to canonical/craft-actions#48, still open.

Resolution: closed superseded

Reason: Maintainer mr-cal closed the PR without merging, stating "this isn't possible to do simply, given the constraints. I'll wait for canonical/craft-actions/issues/48". Commit 4cff0d0 never landed: publish.yaml at HEAD still uses canonical/action-publish@v1 with no retry logic. Parent issue #5988 was closed as a result.

Evaluated by: mr-cal-bot

No scores available.

Issue body

The publish step occasionally fails with `RemoteDisconnected('Remote end closed connection without response')`. Added retry logic to handle transient network failures. ## Changes - Replaced `canonical/action-publish@v1` action with bash script using `snapcraft upload` directly - Configured for 2 attempts (1 initial + 1 retry) with 60-second delay between attempts - Only retries on specific connection errors (`RemoteDisconnected` or `Connection aborted`) - Captures and displays error output from both attempts for debugging ```yaml - name: Publish feature branch to edge/${{ steps.vars.outputs.branch }} if: steps.decisions.outputs.PUBLISH == 'true' run: | set +e # Don't exit on error immediately SNAP_FILE="${{ steps.build.outputs.snap }}" CHANNEL="edge/${{ steps.vars.outputs.branch }}" # Attempt 1 echo "Publishing $SNAP_FILE to $CHANNEL (attempt 1)" output=$(snapcraft upload "$SNAP_FILE" --release "$CHANNEL" 2>&1) exit_code=$? if [ $exit_code -eq 0 ]; then echo "Publish successful on first attempt" echo "$output" exit 0 fi # Check if error is the connection error we want to retry if echo "$output" | grep -q "RemoteDisconnected\|Connection aborted"; then echo "Connection error detected. Waiting 60 seconds before retry..." echo "$output" sleep 60 # Attempt 2 echo "Publishing $SNAP_FILE to $CHANNEL (attempt 2)" output=$(snapcraft upload "$SNAP_FILE" --release "$CHANNEL" 2>&1) exit_code=$? if [ $exit_code -eq 0 ]; then echo "Publish successful on second attempt" echo "$output" exit 0 else echo "Publish failed on second attempt" echo "$output" exit $exit_code fi else # Different error, don't retry echo "Non-retryable error encountered:" echo "$output" exit $exit_code fi env: SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_STORE_CREDENTIALS }} ``` ## Security - No external actions used - keeps credentials internal - Credentials only passed to snapcraft CLI directly - Error-specific retry prevents unnecessary retry attempts <!-- START COPILOT ORIGINAL PROMPT --> <details> <summary>Original prompt</summary> > > ---- > > *This section details on the original issue you should resolve* > > <issue_title>Retry publish to edge action</issue_title> > <issue_description>### Check existing issues > > - [x] I've verified that this request isn't described by any existing issues. > > ### Request > > The last step in the https://github.com/canonical/snapcraft/blob/main/.github/workflows/publish.yaml action sometimes fails with: > > ```bash > ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response')) > ``` > > If this happens, we should wait 60 seconds and retry once. Keep it simple - the timeout and number of retries doesn't need to be configurable. > > ### The problem it solves > > To improve flakiness of the CI suite. > </issue_description> > > ## Comments on the Issue (you are @copilot in this section) > > <comments> > </comments> > </details> <!-- START COPILOT CODING AGENT SUFFIX --> - Fixes canonical/snapcraft#5988 <!-- START COPILOT CODING AGENT TIPS --> --- 💬 We'd love your input! Share your thoughts on Copilot coding agent in our [2 minute survey](https://gh.io/copilot-coding-agent-survey).

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed superseded Copilot PR #5989 (commit 4cff0d0) added retry-on-connection-error logic to publish.yaml but was closed unmerged; mr-cal deferred the work to canonical/craft-actions#48, still open.
stealth/space-bunny-alpha — closed superseded Copilot PR replacing canonical/action-publish with bash retry logic (commit 4cff0d0) was closed unmerged after mr-cal judged it not simply doable; publish.yaml still uses action-publish. Work deferred to canonical/craft-actions#48.
stealth/space-bunny-alpha — closed superseded Closed unmerged; retry commit 4cff0d0 was deferred to canonical/craft-actions#48.
stealth/space-bunny-alpha — closed superseded Commit 4cff0d0 added targeted publish retries, but the PR was left unmerged; the change was deferred to canonical/craft-actions#48.
qwen/qwen3.6-35b-a3b — — Closed and rejected. The maintainer decided the retry logic cannot be implemented simply and will wait for an upstream fix in craft-actions issue #48 instead.
qwen3.6-35b-a3b-mtp-q6 — — Adding retry logic for publish failures was rejected. After addressing feedback to remove external actions and target specific errors, the maintainer closed it, deferring the fix to an upstream craft-actions issue.

Update history

No update history recorded yet.

Related work

  • Superseded By: canonical/craft-actions#48 (confidence 95%)

    Maintainer explicitly deferred to this open issue requesting a craft-actions publish action, including retry on store connection errors.

  • Duplicate Of: canonical/snapcraft#5988 (confidence 90%)

    PR body states "Fixes canonical/snapcraft#5988"; that issue was closed alongside the unmerged PR.

Related issues

Issue Project State Summary Similarity
#5988 Retry publish to edge action snapcraft closed Retry request was deferred to canonical/craft-actions#48; proposed Snapcraft PR #5989 (4cff0d0) was closed unmerged.
74%