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: status always success when using custom policy #5156

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

bakuljajan
Copy link

@bakuljajan bakuljajan commented Dec 12, 2024

what

try to fix #4585. It seems the original code does not return error when the custom policy is enabled.

why

the error status was skipped causing plan/apply combined with custom policy check to always be successful.

tests

manual test only. will need guidance if additional tests are needed.

references

#4585
possibly #4861

@bakuljajan bakuljajan requested review from a team as code owners December 12, 2024 14:42
@bakuljajan bakuljajan requested review from chenrui333, lukemassa and X-Guardian and removed request for a team December 12, 2024 14:42
@github-actions github-actions bot added the go Pull requests that update Go code label Dec 12, 2024
@dosubot dosubot bot added the bug Something isn't working label Dec 12, 2024
@bakuljajan bakuljajan force-pushed the fix/vcs-status-custom-policy branch from d57b7ad to e1317da Compare December 12, 2024 14:45
@jamengual
Copy link
Contributor

@bakuljajan, do you think you could add a test for this?

Thanks.

@bakuljajan
Copy link
Author

@bakuljajan, do you think you could add a test for this?

Thanks.

Hi @jamengual thanks for looking into this PR, I'm unfamiliar with writing golang code, but enabling the CustomPolicyCheck: true on the test already captures the error.

Let me know if you need me to add more test cases.

Copy link
Member

@chenrui333 chenrui333 left a comment

Choose a reason for hiding this comment

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

lgtm

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Dec 15, 2024
@mubarak-j
Copy link

I think this part of the docs should be updated as well
custom policy tool output is simply parsed for "fail" substrings to determine if the policy set passed
to reflect that the custom policy check will fail if exit code !=0...which should be the expected default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working go Pull requests that update Go code lgtm This PR has been approved by a maintainer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Custom Policy Check] Plan steps success despite statut error 1
5 participants