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

Statically generating opentofu releases page: Fixes opentofu/opentofu#1131 #22

Closed
wants to merge 7 commits into from

Conversation

sanskruti-shahu
Copy link

@sanskruti-shahu sanskruti-shahu commented Mar 5, 2024

Objective

The objective of this PR is to introduce a statically generated releases page for the opentofu.

Changes

  • Created a new folder named releases_page, containing main.go file and README.md.
  • main.go file is responsible for fetching release information from the GitHub API and generating all required HTML pages when executed.
  • Also, added README.md file to provide clarity on the functionality of the main.go file.

Continuation of #16

Signed-off-by: sanskruti-shahu <sanskruti.shahu@harness.io>
Copy link
Collaborator

@janosdebugs janosdebugs left a comment

Choose a reason for hiding this comment

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

It seems that this code is incomplete.

releases_page/main.go Show resolved Hide resolved
@janosdebugs janosdebugs marked this pull request as draft March 5, 2024 10:50
@sanskruti-shahu
Copy link
Author

sanskruti-shahu commented Mar 5, 2024

Hey @janosdebugs , For these changes to be reflected correctly you need to change/add the build command as
go run releases_page/main.go wherever this opentofu/get.opentofu.org is hosted on cloudflare. This ensures that the main.go file is executed during the build stage, generating all necessary HTML pages.

I did same thing with my forked of opentofu/get.opentofu.org, (on my personal cloudflare acount) I added build command as go run releases_page/main.go so I got the expected result.

Preview url: https://get-opentofu-org.pages.dev/

Copy link
Collaborator

@janosdebugs janosdebugs left a comment

Choose a reason for hiding this comment

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

I missed the file writing, my apologies.

releases_page/main.go Outdated Show resolved Hide resolved
releases_page/main.go Outdated Show resolved Hide resolved
@janosdebugs janosdebugs marked this pull request as ready for review March 5, 2024 11:09
Signed-off-by: sanskruti-shahu <sanskruti.shahu@harness.io>
Signed-off-by: sanskruti-shahu <sanskruti.shahu@harness.io>
releases_page/main.go Show resolved Hide resolved
releases_page/main.go Show resolved Hide resolved
releases_page/main.go Show resolved Hide resolved
Signed-off-by: sanskruti-shahu <sanskruti.shahu@harness.io>
@sanskruti-shahu
Copy link
Author

Hey @janosdebugs , I have implemented the changes you requested. Could you please review them again?

@janosdebugs
Copy link
Collaborator

Hey @sanskruti-shahu please make sure that:

  1. You handle ALL exit paths (i.e. close files before all return statements).
  2. When you have written a file, always handle errors on Close. With some filesystems you only get an error on Close, not when writing the file.

Please request a re-review once you have completed this for all code branches.

Signed-off-by: sanskruti-shahu <sanskruti.shahu@harness.io>
@sanskruti-shahu
Copy link
Author

Hey @janosdebugs , According to me I have implemented the mentioned changes, Please let me know if there's still anything missing. Thanks.

@sanskruti-shahu
Copy link
Author

@janosdebugs , Gentle reminder.

Copy link
Collaborator

@janosdebugs janosdebugs left a comment

Choose a reason for hiding this comment

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

Looks good @sanskruti-shahu thank you! One tiny nit-pick and sorry for the delay.

releases_page/main.go Outdated Show resolved Hide resolved
Signed-off-by: sanskruti-shahu <sanskruti.shahu@harness.io>
@janosdebugs
Copy link
Collaborator

Note for my fellow reviewer: this code now generates the content, but we will still need to add a GitHub Actions integration. I would recommend merging into a feature branch and work from there.

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 this pull request may close these issues.

None yet

2 participants