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

Add better error message if "target branch" is missing - exit status 128 #330

Closed
colearendt opened this issue May 3, 2021 · 0 comments · Fixed by #511
Closed

Add better error message if "target branch" is missing - exit status 128 #330

colearendt opened this issue May 3, 2021 · 0 comments · Fixed by #511

Comments

@colearendt
Copy link

colearendt commented May 3, 2021

Is this a request for help?: no


Is this a BUG REPORT or FEATURE REQUEST? (choose one): FEATURE REQUEST

Version of Helm and Kubernetes: helm 3.4.0

What happened:

When running ct list-changed with the default target-branch (master) - if master does not exist (i.e. GitHub now defaults to main), then you get the following in GitHub Actions (via the chart-testing-action):

Error: Error running process: exit status 128

This is very tricky to debug without a dev environment that mirrors the GitHub Action (unfortunately I had a master branch locally so things would not fail locally). Mirroring the GitHub Action environment is not trivial - a bit of logging or a cleaner error would go a long ways to making this easier to debug!

I eventually figured this out by reasoning from this issue: #186

What you expected to happen:

ERROR: `--target-branch=master` does not exist

(Or infer which branch should be referenced from the git repository)

How to reproduce it (as minimally and precisely as possible):

# in a git repo with no master branch
ct list-changed

Anything else we need to know:

davidkarlsen pushed a commit that referenced this issue Apr 13, 2023
* feat: verify if targetBranch is present in git repo

If a targetBranch is not present in the git repository the `ct list-changed` command will fail.
The error message for this is not really meaningful.

This commit will validate if the branch exists and throw a error message which the user will understand.

closes #330

Signed-off-by: Marco Lecheler <marco@task.media>

* chore(test): mocking test for chart.BranchExists()

Signed-off-by: Marco Lecheler <marco@task.media>

* fix(lint): use fmt.Errorf for error msg

Signed-off-by: Marco Lecheler <marco@task.media>

---------

Signed-off-by: Marco Lecheler <marco@task.media>
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 a pull request may close this issue.

1 participant