Skip to content
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

Retry on particular HTTP errors #41

Closed
syphernl opened this issue Jan 18, 2023 · 3 comments · Fixed by #46
Closed

Retry on particular HTTP errors #41

syphernl opened this issue Jan 18, 2023 · 3 comments · Fixed by #46
Labels
enhancement New feature or request released

Comments

@syphernl
Copy link

GitLab can throw intermittent 503's, causing this plugin to fail (and thus the entire semantic-release job)

An example of a failure which just occurred.

remote: Service Unavailable
fatal: unable to access 'https://gitlab.example.com/team/project.git/': The requested URL returned error: 503
    at makeError (/usr/local/lib/node_modules/@saithodev/semantic-release-backmerge/node_modules/execa/lib/error.js:60:11)
    at handlePromise (/usr/local/lib/node_modules/@saithodev/semantic-release-backmerge/node_modules/execa/index.js:118:26)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  shortMessage: 'Command failed with exit code 128: git fetch https://gitlab-ci-token:[secure]@gitlab.example.com/team/project.git',
  command: 'git fetch https://gitlab-ci-token:[secure]@gitlab.example.com/team/project.git',
  escapedCommand: 'git fetch "https://gitlab-ci-token:[secure]@gitlab.example.com/team/project.git"',
  exitCode: 128,
  signal: undefined,
  signalDescription: undefined,
  stdout: '',
  stderr: 'remote: Service Unavailable\n' +
    "fatal: unable to access 'https://gitlab.example.com/team/project.git/': The requested URL returned error: 503",
  failed: true,
  timedOut: false,
  isCanceled: false,
  killed: false,
  pluginName: '@saithodev/semantic-release-backmerge'
}
AggregateError: 
    Error: Command failed with exit code 128: git fetch https://gitlab-ci-token:[secure]@gitlab.example.com/team/project.git
    remote: Service Unavailable
    fatal: unable to access 'https://gitlab.example.com/team/project.git/': The requested URL returned error: 503
        at makeError (/usr/local/lib/node_modules/@saithodev/semantic-release-backmerge/node_modules/execa/lib/error.js:60:11)
        at handlePromise (/usr/local/lib/node_modules/@saithodev/semantic-release-backmerge/node_modules/execa/index.js:118:26)
        at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at /usr/local/lib/node_modules/semantic-release/lib/plugins/pipeline.js:54:11
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async pluginsConf.<computed> [as success] (/usr/local/lib/node_modules/semantic-release/lib/plugins/index.js:80:11)
    at async run (/usr/local/lib/node_modules/semantic-release/index.js:209:3)
    at async module.exports (/usr/local/lib/node_modules/semantic-release/index.js:269:22)
    at async module.exports (/usr/local/lib/node_modules/semantic-release/cli.js:55:5)

Would there be a way to handle 503 by retrying for a few times until it does (or until the wait time is over)?

@saitho
Copy link
Owner

saitho commented Jan 26, 2023

Sounds useful and should be possible :)

@saitho saitho added the enhancement New feature or request label Jan 26, 2023
saitho added a commit that referenced this issue Feb 12, 2023
Remote Git operations may fail due to network or
the Git server being not available. In this case
retry up to 3 times with a fixed cooldown time of 1 second.

The following operations use retry:
fetch, push, checkout

Resolves: #41
saitho added a commit that referenced this issue Feb 12, 2023
Remote Git operations may fail due to network or
the Git server being not available. In this case
retry up to 3 times with a fixed cooldown time of 1 second.

The following operations use retry:
fetch, push, checkout

Resolves: #41
@saitho
Copy link
Owner

saitho commented Feb 12, 2023

It should now retry up to 3 times with 1 seconds in between for all errors on remote Git commands
Let me know if that is sufficient. :)

github-actions bot pushed a commit that referenced this issue Feb 12, 2023
# [3.1.0](v3.0.0...v3.1.0) (2023-02-12)

### Features

* retry remote Git operations ([3138c56](3138c56)), closes [#41](#41)
@saitho
Copy link
Owner

saitho commented Feb 12, 2023

🎉 This issue has been resolved in version 3.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request released
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants