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

allowing JobUrl to the PlanSuccess model for github comment templating #5392

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

Conversation

cpaloia
Copy link

@cpaloia cpaloia commented Mar 7, 2025

What

This PR adds support for including the job URL in the GitHub comment template by adding the property JobURL to the PlanSuccess model.

This PR also renames the LockURLGenerator to URLGenerator as it will be used for generating more than just the lock url. Currently the code already uses the router to fulfill this interface, so I have added the function GenerateProjectJobURL which it gets from the router.

Why

In certain cases, it's necessary to hide Terraform plan output in GitHub comments—such as in public repositories where the output may contain sensitive information. However, users may still need access to the plan details via a secure URL, such as one behind a firewall or ingress.

By including the job URL in the GitHub comment template (in addition to the existing GitHub check link), we provide users with clear guidance on why the output is hidden and where they can access it instead.

Tests

Tested locally by overriding the comment template and verifying the job URL was correctly included.

References

Notes

  • I encountered issues running pegomock unless I downgraded Go to 1.23.0 in go.mod.
  • Currently, the job URL is added only to plan success—I considered adding it to PolicyCheckResults, but I’m unsure whether those results are accessible via a URL. Would appreciate any feedback on this!

@cpaloia cpaloia requested review from a team as code owners March 7, 2025 12:14
@cpaloia cpaloia requested review from GenPage, lukemassa and X-Guardian and removed request for a team March 7, 2025 12:14
@dosubot dosubot bot added feature New functionality/enhancement go Pull requests that update Go code labels Mar 7, 2025
@github-actions github-actions bot removed the feature New functionality/enhancement label Mar 7, 2025
@jamengual
Copy link
Contributor

I do not think policy checks have a URL status at all.

Copy link
Contributor

@X-Guardian X-Guardian left a comment

Choose a reason for hiding this comment

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

Can you update the PR title and description to detail what this PR is actually doing, i.e. adding the job URL to the plan success model which can then be used by a custom plan success template. Also please detail the changes you have made to LockURLGenerator and why.

It also needs markdown_renderer_test updating with tests for this change.

@X-Guardian X-Guardian added the waiting-on-response Waiting for a response from the user label Mar 9, 2025
cpaloia and others added 2 commits March 12, 2025 20:01
Co-authored-by: Simon Heather <[email protected]>
Signed-off-by: Corey Aloia <[email protected]>
Signed-off-by: Corey Aloia <[email protected]>
@cpaloia cpaloia changed the title allowing job url in template allowing JobUrl to the PlanSuccess model for github comment templating Mar 12, 2025
@cpaloia
Copy link
Author

cpaloia commented Mar 17, 2025

Hi @X-Guardian I believe I have made the requested changes. Could you have another look when you get time? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
go Pull requests that update Go code waiting-on-response Waiting for a response from the user
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants