Skip to content

add captain_utility for upgrading helm #298

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

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

Conversation

hamzabouissi
Copy link
Contributor

@hamzabouissi hamzabouissi commented May 12, 2025

PR Type

enhancement


Description

  • Add captain_utility.sh script for interactive Helm upgrades

  • Enable version selection and diff viewing for ArgoCD and GlueOps Platform

  • Integrate user confirmation and upgrade application steps

  • Prepare for uploading Helm diff output (placeholder function)


Changes walkthrough 📝

Relevant files
Enhancement
captain_utility.sh
Add interactive Helm upgrade and diff script                         

.devcontainer/tools/captain_utility.sh

  • Introduces a Bash script for interactive Helm chart upgrades
  • Allows user to select component and version for upgrade
  • Displays Helm diff and applies upgrade upon confirmation
  • Includes placeholder for uploading diff output
  • +70/-0   

    Need help?
  • Type /help how to ... in the comments thread for any questions about Qodo Merge usage.
  • Check out the documentation for more information.
  • @Copilot Copilot AI review requested due to automatic review settings May 12, 2025 17:16
    Copy link

    @Copilot Copilot AI left a comment

    Choose a reason for hiding this comment

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

    Pull Request Overview

    This PR introduces a new utility script to support an interactive helm upgrade process for specific components.

    • Implements interactive version selection for "argocd" and "glueops-platform".
    • Executes helm diff, confirms the upgrade via gum, applies the helm upgrade, and uploads the diff output.
    Comments suppressed due to low confidence (1)

    .devcontainer/tools/captain_utility.sh:13

    • [nitpick] Consider renaming 'argocd_version' to 'argocd_versions' to better reflect that the variable holds multiple version values.
    local argocd_version=($(helm search repo  argo/argo-cd --versions -o json | jq -r "limit(30; .[]).version" | paste -sd' ' -))
    

    Copy link

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Error Handling

    The script lacks error handling for helm commands and other operations. If helm commands fail, the script continues execution without notifying the user or taking corrective action.

    helm diff --color upgrade "$component" "$chart_name" --version "$version" -f $target_file -n $namespace | gum pager
    
    if ! gum confirm "Apply upgrade"; then
        return
    fi
    
    helm upgrade "$component" "$chart_name" --version "$version" -f $target_file -n $namespace
    Incomplete Feature

    The upload_diff function is just a placeholder that logs a message but doesn't actually upload anything, despite being called in the workflow.

    upload_diff() {
        gum log --structured --level info "Uploading helm-diff output to ..."
    }
    Commented Code

    There's a commented line for watching kubectl progress that should either be implemented or removed before merging.

    # watch kubectl get apps -A | grep Progressing 
    

    Copy link

    codiumai-pr-agent-free bot commented May 12, 2025

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Impact
    Possible issue
    Handle upgrade failures

    Add error handling for the helm upgrade command. If the upgrade fails, the
    script should notify the user and prevent proceeding to the upload_diff
    function, which assumes the upgrade was successful.

    .devcontainer/tools/captain_utility.sh [48]

    -helm upgrade "$component" "$chart_name" --version "$version" -f $target_file -n $namespace
    +if ! helm upgrade "$component" "$chart_name" --version "$version" -f $target_file -n $namespace; then
    +  gum log --structured --level error "Helm upgrade failed. Please check the error message above."
    +  return
    +fi
    +gum log --structured --level info "Upgrade successful!"
    • Apply / Chat
    Suggestion importance[1-10]: 8

    __

    Why: The suggestion correctly identifies a critical missing error handling for the helm upgrade command. If the upgrade fails, the script should notify the user and not proceed to upload_diff. This significantly improves script reliability and user experience.

    Medium
    Add error handling

    Add error handling for the helm diff command. If helm diff fails (e.g., due to
    missing plugin or configuration issues), the script will continue without
    warning the user, potentially leading to unexpected behavior.

    .devcontainer/tools/captain_utility.sh [40-42]

     # Running helm diff command
     
    -helm diff --color upgrade "$component" "$chart_name" --version "$version" -f $target_file -n $namespace | gum pager
    +if ! helm diff --color upgrade "$component" "$chart_name" --version "$version" -f $target_file -n $namespace | gum pager; then
    +  gum log --structured --level error "Helm diff failed. Please check if helm-diff plugin is installed."
    +  return
    +fi
    • Apply / Chat
    Suggestion importance[1-10]: 7

    __

    Why: The suggestion correctly points out that the helm diff command lacks error handling. Adding a check for its exit status improves script robustness by informing the user of potential issues with the diff plugin or configuration.

    Medium
    • Update

    @venkatamutyala
    Copy link
    Contributor

    @hamzabouissi see AI feedback

    Copy link
    Contributor

    @venkatamutyala venkatamutyala left a comment

    Choose a reason for hiding this comment

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

    See AI feedback.

    Also, we can make another PR for this but would it be low effort to add these features to the tool: http://glueops.getoutline.com/doc/argocd-app-repairs-P63ZXVxOTu ?

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    2 participants