Skip to content

Port automation scripts from JavaScript to Go - #3829

Open
Ankitsinghsisodya wants to merge 6 commits into
knative:mainfrom
Ankitsinghsisodya:fix/2815-port-js-scripts-to-go
Open

Port automation scripts from JavaScript to Go#3829
Ankitsinghsisodya wants to merge 6 commits into
knative:mainfrom
Ankitsinghsisodya:fix/2815-port-js-scripts-to-go

Conversation

@Ankitsinghsisodya

@Ankitsinghsisodya Ankitsinghsisodya commented May 21, 2026

Copy link
Copy Markdown
Contributor

related to #2815

Note: Re-submission of #3691, accidentally closed when the head repository was deleted.

/kind cleanup

Changes

  • Remove hack/update-ca-bundle.js, hack/update-quarkus-platform.js, and hack/update-springboot-platform.js, eliminating the Node.js runtime dependency from CI
  • Add Go programs under hack/cmd/ for each removed script: update-ca-bundle, update-quarkus-platform, update-springboot-platform
  • Add hack/cmd/shared package with a shared HTTP client and command runner used across the new programs
  • Update update-ca-bundle.yaml, update-quarkus-platform.yaml, and update-springboot-platform.yaml workflows to use the new Go programs via go run, delegate PR creation to peter-evans/create-pull-request@v7, and gate smoke tests and PR creation on actual file changes
  • Add update-quarkus-platform, update-springboot-platform, and update-ca-bundle Makefile targets for local invocation

Copilot AI review requested due to automatic review settings May 21, 2026 11:22
@knative-prow knative-prow Bot added the kind/cleanup Cleanup label May 21, 2026
@knative-prow
knative-prow Bot requested review from dsimansk and jrangelramos May 21, 2026 11:22
@knative-prow

knative-prow Bot commented May 21, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Ankitsinghsisodya
Once this PR has been reviewed and has the lgtm label, please assign matejvasek for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@knative-prow knative-prow Bot added size/XL 🤖 PR changes 500-999 lines, ignoring generated files. needs-ok-to-test 🤖 Needs an org member to approve testing labels May 21, 2026
@knative-prow

knative-prow Bot commented May 21, 2026

Copy link
Copy Markdown

Hi @Ankitsinghsisodya. Thanks for your PR.

I'm waiting for a knative member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Tip

We noticed you've done this a few times! Consider joining the org to skip this step and gain /lgtm and other bot rights. We recommend asking approvers on your previous PRs to sponsor you.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR migrates several automation/update scripts from Node.js to Go and updates the GitHub Actions workflows/Makefile to use the new Go implementations.

Changes:

  • Replaced JS-based platform/CA update scripts with Go commands under hack/cmd/....
  • Added shared Go helpers for HTTP + command execution used by the new tools.
  • Updated GitHub Actions workflows and Makefile targets to run the Go commands and create PRs via peter-evans/create-pull-request.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
hack/update-springboot-platform.js Removed legacy Node.js automation script for Spring Boot platform updates.
hack/update-quarkus-platform.js Removed legacy Node.js automation script for Quarkus platform updates.
hack/update-ca-bundle.js Removed legacy Node.js automation script for CA bundle updates.
hack/cmd/update-springboot-platform/main.go New Go implementation to fetch latest Spring Boot version + update POM(s).
hack/cmd/update-quarkus-platform/main.go New Go implementation to fetch latest Quarkus version + update POM(s).
hack/cmd/update-ca-bundle/main.go New Go implementation to update the CA bundle via make.
hack/cmd/shared/shared.go Shared Go utilities (HTTP client, signal handling, command runner).
Makefile Added make update-* targets to run the new Go tools.
.github/workflows/update-springboot-platform.yaml Switched workflow from Node to Go + create-pull-request action, added generate/tests steps.
.github/workflows/update-quarkus-platform.yaml Switched workflow from Node to Go + create-pull-request action, added generate/tests steps.
.github/workflows/update-ca-bundle.yaml Switched workflow from Node to Go + create-pull-request action, added generate step.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

if err != nil {
return err
}
updated := parentVersionRe.ReplaceAll(data, []byte("${1}"+newVersion+"${3}"))
if release.Draft {
return "", nil
}
return strings.TrimPrefix(release.TagName, "v"), nil
for _, m := range mappings {
r := m.CompatibilityRange

if strings.HasPrefix(r, "[") {
Comment on lines +223 to +225
} else {
// open-ended lower bound
begin, err := semver.ParseTolerant(r)
data, err := os.ReadFile(path)
if err != nil {
return err
}
@lkingland lkingland added ok-to-test 🤖 Non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test 🤖 Needs an org member to approve testing labels May 22, 2026
@lkingland lkingland moved this to New in Functions Traige Jun 2, 2026
@lkingland

Copy link
Copy Markdown
Member

This one will require a more in-depth review. @gauron99 did @Ankitsinghsisodya adress your concerns from the original, now-defunkt PR?

// Range format mirrors Maven version ranges:
// - "[begin,end)" — begin inclusive, end exclusive
// - "begin" — begin inclusive, no upper bound
func resolveSpringCloudVersion(springBootVersion string, mappings []springCloudMapping) (string, error) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No tests in this PR. resolveSpringCloudVersion is a pure function and the POM read/update helpers are testable with t.TempDir() — please add table tests for both (see hack/cmd/components/main_test.go for the existing pattern).

Comment thread hack/cmd/update-ca-bundle/main.go Outdated
}

func run(ctx context.Context) error {
return shared.RunCmd(ctx, "make", caBundleMakeTarget)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This program only execs make templates/certs/ca-certificates.crt, and make certs already exists for exactly that. Please drop the Go wrapper: in update-ca-bundle.yaml replace the go run step with run: make certs (keep the make generate/zz_filesystem_generated.go step and setup-go as they are — generate needs Go), delete this file and shared.RunCmd (its only caller), and remove the update-ca-bundle Makefile target (or alias it to certs).

return err
}
updated := parentVersionRe.ReplaceAll(data, []byte("${1}"+newVersion+"${3}"))
updated = springCloudVersionRe.ReplaceAll(updated,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: springCloudVersionRe is never checked for a match; if <spring-cloud.version> is absent the parent bumps and spring-cloud silently stays. Error if it doesn't match.

return "", fmt.Errorf("cannot parse Spring Boot version %q: %w", springBootVersion, err)
}

for _, m := range mappings {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: continue on an unparsable compatibilityRange can fall through to a wrong later mapping; the JS threw. Return an error instead.

- Introduced new Makefile targets: `update-quarkus-platform`, `update-springboot-platform`, and `update-ca-bundle` to automate the process of updating respective platform versions in templates.
- Updated GitHub Actions workflows for `update-ca-bundle`, `update-quarkus-platform`, and `update-springboot-platform` to utilize Go scripts instead of Node.js for executing updates.
- Added new Go scripts for handling the update logic for CA bundle, Quarkus platform, and Spring Boot platform, including PR creation and version checks.
- Implemented shared GitHub client functionality for PR management and version retrieval.

This change enhances the automation of platform updates and streamlines the CI/CD process for dependency management.
…ment

- Updated Makefile targets to streamline the execution of platform updates for Quarkus, Spring Boot, and CA bundle.
- Replaced Node.js scripts with Go scripts for better performance and maintainability in GitHub Actions workflows.
- Enhanced the update logic for CA bundle, Quarkus platform, and Spring Boot platform, including automated PR creation and version checks.
- Removed outdated JavaScript files related to platform updates, consolidating functionality within Go.

These changes improve the automation process for dependency management and enhance the CI/CD workflow.
- Pass GITHUB_TOKEN to the Spring Boot update step so GitHub API calls
  are authenticated (unauthenticated rate limit is 60 req/hr, shared
  across all Actions runners, causing intermittent 403s on the 4-hour cron)
- Add a git-diff check after each Go tool + make generate step; skip
  smoke tests and the create-pull-request action when no files changed,
  restoring the early-exit behaviour the original JS scripts had
- Switch all `go run .../main.go` invocations to `go run ./pkg` in
  Makefile and the three CI workflows so additional files added to a
  command package are automatically included
- Rename hack/cmd/shared/github.go → shared.go; the file contains a
  generic HTTP client and command runner, not GitHub-specific helpers
- Eliminated the change detection step from the GitHub Actions workflows for updating CA bundle, Quarkus platform, and Spring Boot platform. This simplifies the workflows by directly proceeding to create pull requests without checking for file changes, streamlining the automation process.
@Ankitsinghsisodya
Ankitsinghsisodya force-pushed the fix/2815-port-js-scripts-to-go branch from e36f175 to 3ecc3ef Compare August 31, 2026 14:46
- Updated the Makefile to simplify the `update-ca-bundle` target, making it an alias for the `certs` target.
- Modified the GitHub Actions workflow to run `make certs` instead of the previous direct command for updating the CA bundle, enhancing consistency and maintainability.
- Removed the now redundant Go script for updating the CA bundle, consolidating functionality within the Makefile and improving the overall automation process.
@knative-prow knative-prow Bot added size/XXL 🤖 PR changes 1000+ lines, ignoring generated files. and removed size/XL 🤖 PR changes 500-999 lines, ignoring generated files. labels Aug 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/cleanup Cleanup ok-to-test 🤖 Non-member PR verified by an org member that is safe to test. size/XXL 🤖 PR changes 1000+ lines, ignoring generated files.

Projects

Status: New

Development

Successfully merging this pull request may close these issues.

4 participants