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

CICD Bugs #518

Closed
msampathkumar opened this issue Oct 20, 2023 · 5 comments · Fixed by #608
Closed

CICD Bugs #518

msampathkumar opened this issue Oct 20, 2023 · 5 comments · Fixed by #608

Comments

@msampathkumar
Copy link
Contributor

msampathkumar commented Oct 20, 2023

TL;DR

PTAL #510 (comment)

CICD is failing for unrelated errors.

Expected behavior

No response

Observed behavior

No response

Terraform Configuration

NA

Terraform Version

NA

Additional information

No response

@rogerthatdev rogerthatdev self-assigned this Oct 23, 2023
@rogerthatdev
Copy link
Contributor

The root of the problem is this error that occurs on the first step of the build config:

fatal: ambiguous argument 'origin/': unknown revision or path not in the working tree.

This is due to this line in the yaml config that uses git diff origin/${_BASE_BRANCH} --name-only > _changed_files to make a list of files that the PR updates.

The problem seems to be that for some PRs such as this one that are coming from a fork, _BASE_BRANCH does not evaluate to main.

@rogerthatdev
Copy link
Contributor

I'll add that it's possible for tests to pass instead of fail with this issue because the tests continue as if there are no files changed in the PR (example where the test passes but it does not run the changed terraform)

In the meantime, it will be important to verify that the int tests are passing for the impacted samples of each PR reviewed.

@rogerthatdev rogerthatdev removed their assignment Oct 27, 2023
@glasnt
Copy link
Contributor

glasnt commented Jan 16, 2024

re: enforcing failure: Cloud Build steps that finish with an exit code != 0 fail the entire build, but not when it happens within the step itself (like bash). Adding a set -e will exit the step with failure on first failure (as long as the fatal in git returns the appropriate exit code), causing the whole build to fail.

re: missing substitution variable: I'll investigate further.

glasnt added a commit that referenced this issue Jan 16, 2024
@glasnt
Copy link
Contributor

glasnt commented Jan 16, 2024

Reproduction in https://github.com/glasnt/cloud-build-context/pull/3/checks?check_run_id=20515490284

_BASE_BRANCH had value in the fork, but in case it didn't, adding the set -e should ensure failures actually fail out the build.

Updated #528 to add -e

@glasnt
Copy link
Contributor

glasnt commented Mar 19, 2024

@msampathkumar #608 should resolve this issue, ptal

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants
@glasnt @msampathkumar @rogerthatdev and others