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

chore(ci): ensure body is encoded correctly and can never be recognized as secret for release #1238

Conversation

jakobmoellerdev
Copy link
Contributor

What this PR does / why we need it

Only passes the body of the release notes and encodes it properly before passing so that we can not run into issues when handling the notes in different steps as an output

Which issue(s) this PR fixes

https://github.com/open-component-model/ocm/actions/runs/12690118935/job/35370314340#step:13:2 failed

fix open-component-model/ocm-project#363

@jakobmoellerdev jakobmoellerdev requested a review from a team as a code owner January 9, 2025 14:48
@github-actions github-actions bot added kind/chore chore, maintenance, etc. size/s Small component/github-actions Changes on GitHub Actions or within `.github/` directory and removed size/s Small labels Jan 9, 2025
@jakobmoellerdev jakobmoellerdev force-pushed the fix/release-note-body-decode branch from 857c4f1 to 0f5e177 Compare January 9, 2025 14:53
@github-actions github-actions bot added the size/s Small label Jan 9, 2025
@frewilhelm
Copy link
Contributor

I don't understand how base64 encoding can solve this error 2025-01-09T12:56:50.7656452Z ##[error]The template is not valid. .github/workflows/release.yaml (Line: 212, Col: 12): Error reading JToken from JsonReader. Path '', line 0, position 0. .

Do you have any insights on that?

@jakobmoellerdev
Copy link
Contributor Author

Yes. The issue was that the original body was empty and the JSON Decode only failed because that body was empty. The body was empty because of the warning I linked in which GH actions recognized the release JSON as containing secrets. So I changed it so that only the body part and only base64 encoded, gets passed so that the content basically never gets to get filtered by github actions output protection. This will fix the issue of the "empty body".

@ikhandamirov
Copy link
Contributor

I don't understand how base64 encoding can solve this error 2025-01-09T12:56:50.7656452Z ##[error]The template is not valid. .github/workflows/release.yaml (Line: 212, Col: 12): Error reading JToken from JsonReader. Path '', line 0, position 0. .

Do you have any insights on that?

See the link in the issue description. The issue is:

Warning: Skip output 'draft-release-notes' since it may contain secret.

base64 will hide the thing, which looks like a secret.

@frewilhelm
Copy link
Contributor

Ok, I understand the issue now.

Why is it not enough to only pass the body?

Hiding the body using base64 seems to me like an overkill. Is this really required to solve the current issue or is it an addition for potential future cases, in which a fake/mock secret or text could be trigger the warning?

@jakobmoellerdev
Copy link
Contributor Author

The base64 is not to hide it. It is to avoid issues related to new lines in the release notes when the body is passed around

@jakobmoellerdev jakobmoellerdev merged commit 7264f85 into open-component-model:main Jan 9, 2025
23 checks passed
jakobmoellerdev added a commit to jakobmoellerdev/ocm that referenced this pull request Jan 9, 2025
…ed as secret for release (open-component-model#1238)

<!-- markdownlint-disable MD041 -->
#### What this PR does / why we need it

Only passes the body of the release notes and encodes it properly before
passing so that we can not run into issues when handling the notes in
different steps as an output

#### Which issue(s) this PR fixes
<!--
Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`.
-->

https://github.com/open-component-model/ocm/actions/runs/12690118935/job/35370314340#step:13:2
failed

fix open-component-model/ocm-project#363
jakobmoellerdev added a commit that referenced this pull request Jan 9, 2025
…ed as secret for release (#1238) (#1239)

<!-- markdownlint-disable MD041 -->
#### What this PR does / why we need it

Only passes the body of the release notes and encodes it properly before
passing so that we can not run into issues when handling the notes in
different steps as an output

#### Which issue(s) this PR fixes
<!--
Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`. -->


https://github.com/open-component-model/ocm/actions/runs/12690118935/job/35370314340#step:13:2
failed

fix open-component-model/ocm-project#363

<!-- markdownlint-disable MD041 -->
#### What this PR does / why we need it

#### Which issue(s) this PR fixes
<!--
Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`.
-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/github-actions Changes on GitHub Actions or within `.github/` directory kind/chore chore, maintenance, etc. size/s Small
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error creating v0.19.1-rc.1 release
4 participants