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

ci: upgrade golang version to 1.23 #2176

Merged
merged 2 commits into from
Dec 6, 2024
Merged

Conversation

yangchiu
Copy link
Member

@yangchiu yangchiu commented Dec 4, 2024

Which issue(s) this PR fixes:

Issue N/A

What this PR does / why we need it:

upgrade golang version to 1.23

Special notes for your reviewer:

Additional documentation or context

Summary by CodeRabbit

  • Chores
    • Updated the Dockerfile for the test framework to utilize a newer Go base image for improved compatibility and performance.

@yangchiu yangchiu self-assigned this Dec 4, 2024
@yangchiu yangchiu requested a review from a team as a code owner December 4, 2024 01:20
Copy link

coderabbitai bot commented Dec 4, 2024

Walkthrough

The pull request updates the Dockerfile for the test framework by changing the base image from golang:1.22-alpine3.19 to golang:1.23-alpine3.19. While the base image has been updated, the ARG declarations for various tools and the installation commands for those tools remain unchanged. The environment variable settings and package installations within the Dockerfile are also preserved, ensuring consistency in the environment setup for the Go application.

Changes

File Change Summary
test_framework/Dockerfile.setup Updated base image from golang:1.22-alpine3.19 to golang:1.23-alpine3.19; all other configurations and installations remain unchanged.

Poem

🐇 In the world of code, a change so bright,
A new base image, a leap to new height.
With tools still intact, and packages near,
Our test framework's ready, let's give a cheer!
So hop with delight, let the builds take flight! 🌟


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Outside diff range and nitpick comments (2)
test_framework/Dockerfile.setup (2)

Line range hint 1-33: Consider multi-stage build for smaller image size

While not directly related to the Go version upgrade, consider implementing a multi-stage build to reduce the final image size. This would separate the build environment from the runtime environment.

Example structure:

# Build stage
FROM golang:1.22-alpine3.19 AS builder
# ... build steps ...

# Final stage
FROM alpine:3.19
COPY --from=builder /usr/local/bin/kubectl /usr/local/bin/kubectl
# ... copy other binaries and set up runtime environment ...

Tool versions need updates - no version constraints found

The codebase search reveals no hard dependencies on the specific versions currently used in the Dockerfile. The only version reference found is an older kubectl version (v1.4.6) in a test fixture, which is not related to the current setup. Given that:

  1. All tools are significantly outdated
  2. No version-specific dependencies were found in the codebase
  3. The version gaps include major version updates that likely contain important security fixes and features

Recommend updating all tool versions to their latest stable releases:

  • kubectl: Update to v1.31.0
  • RKE: Update to v1.7.0
  • Terraform: Update to v1.10.0
  • yq: Update to v4.44.5
🔗 Analysis chain

Line range hint 1-33: Verify tool compatibility with Go version

While the direct dependencies and tools remain unchanged, let's verify their compatibility with the Go environment:

  • kubectl v1.30.0
  • rke v1.3.4
  • terraform 1.3.5
  • yq v4.24.2

Tool versions are significantly outdated and need updates

The verification reveals significant version gaps in all tools:

  • kubectl: v1.30.0 vs latest v1.31.0 (minor version behind)
  • RKE: v1.3.4 vs latest v1.7.0 (major version behind)
  • Terraform: 1.3.5 vs latest 1.10.0 (major version behind)
  • yq: v4.24.2 vs latest v4.44.5 (many minor versions behind)

Let's verify if there are any version constraints in the codebase that require these specific versions.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if the specified tool versions are the latest stable versions
# and verify their compatibility documentation

# Check latest kubectl version
LATEST_KUBECTL=$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)
echo "Current kubectl: v1.30.0"
echo "Latest stable kubectl: $LATEST_KUBECTL"

# Check latest RKE version
LATEST_RKE=$(curl -s https://api.github.com/repos/rancher/rke/releases/latest | jq -r .tag_name)
echo "Current RKE: v1.3.4"
echo "Latest stable RKE: $LATEST_RKE"

# Check latest Terraform version
LATEST_TERRAFORM=$(curl -s https://api.github.com/repos/hashicorp/terraform/releases/latest | jq -r .tag_name | sed 's/v//')
echo "Current Terraform: 1.3.5"
echo "Latest stable Terraform: $LATEST_TERRAFORM"

# Check latest yq version
LATEST_YQ=$(curl -s https://api.github.com/repos/mikefarah/yq/releases/latest | jq -r .tag_name)
echo "Current yq: v4.24.2"
echo "Latest stable yq: $LATEST_YQ"

Length of output: 935


Script:

#!/bin/bash
# Search for version references in configuration files and documentation
rg -g '!{.git,vendor}' -i "kubectl.*1\.30|rke.*1\.3\.4|terraform.*1\.3\.5|yq.*4\.24\.2" --type yaml --type md --type txt

# Check for any version-specific test cases
rg -g '!{.git,vendor}' -i "kubectl.*version|rke.*version|terraform.*version|yq.*version" --type go --type py

Length of output: 647

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 3a8c014 and ef777f7.

📒 Files selected for processing (1)
  • test_framework/Dockerfile.setup (1 hunks)

@@ -1,4 +1,4 @@
FROM golang:1.22-alpine3.19
FROM golang:1.23-alpine3.19
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Critical: Go 1.23 is not yet released

The base image golang:1.23-alpine3.19 references an unreleased version of Go. As of December 2024, Go 1.22 is the latest stable version. Using an unreleased version in a test framework could lead to:

  • Build failures when the image is not found
  • Potential stability issues
  • CI/CD pipeline disruptions

Recommend using the latest stable version instead:

-FROM golang:1.23-alpine3.19
+FROM golang:1.22-alpine3.19
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
FROM golang:1.23-alpine3.19
FROM golang:1.22-alpine3.19

Copy link
Contributor

@roger-ryao roger-ryao left a comment

Choose a reason for hiding this comment

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

LGTM

@yangchiu yangchiu merged commit eaa6312 into longhorn:master Dec 6, 2024
6 of 7 checks passed
@yangchiu
Copy link
Member Author

yangchiu commented Dec 6, 2024

@mergify backport v1.7.x

Copy link

mergify bot commented Dec 6, 2024

backport v1.7.x

✅ Backports have been created

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.

2 participants