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

fix: handle more ubuntu git repo errors #214

Merged
merged 1 commit into from
Jun 27, 2023

Conversation

westonsteimel
Copy link
Contributor

Currently there could be situations where there are untracked files present in the ubuntu git working directory (likely due to some previous failure state), so the provider will now automatically issue a git clean -fd to try and resolve these rather than failing. If the pull still fails, then just re-clone the repo (except in the case of 503 errors)

Now raises a specific exception for the 503 errors which are frequently issued by the upstream https endpoint so that specific scenario can be handled separately

@westonsteimel westonsteimel requested review from a team, wagoodman and zhill June 23, 2023 13:03
@westonsteimel westonsteimel added the run-pr-quality-gate Triggers running of quality gate on PRs label Jun 23, 2023
Currently there may be situations where there are untracked files
present in the ubuntu git working directory (likely due to some previous
failure state), so the provider will now automatically issue a `git clean
-fd` to try and resolve these rather than failing.  If the pull still
fails, then just re-clone the repo (except in the case of 503 errors)

Now raises a specific exception for the 503 errors which are
frequently issued by the upstream https endpoint so that specific
scenario can be handled separately

Signed-off-by: Weston Steimel <[email protected]>
@westonsteimel westonsteimel enabled auto-merge (squash) June 27, 2023 13:07
Copy link

@kzantow kzantow left a comment

Choose a reason for hiding this comment

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

👍

except Exception as e:
self.logger.exception("error executing command: {}".format(cmd))

if isinstance(e, subprocess.CalledProcessError):
if e.stderr and self._ubuntu_server_503_message in e.stderr.decode():
Copy link

Choose a reason for hiding this comment

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

nit: this seems a bit brittle

@westonsteimel westonsteimel merged commit d21a2f2 into main Jun 27, 2023
6 checks passed
@westonsteimel westonsteimel deleted the ubuntu-git-error-handling branch June 27, 2023 13:10
@westonsteimel westonsteimel added bug Something isn't working provider:ubuntu Relating to the Ubuntu provider labels Jun 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working provider:ubuntu Relating to the Ubuntu provider run-pr-quality-gate Triggers running of quality gate on PRs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants