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

Feat update aws nuke script #193

Merged
merged 3 commits into from
Dec 3, 2024
Merged

Conversation

venkatamutyala
Copy link
Contributor

@venkatamutyala venkatamutyala commented Dec 2, 2024

PR Type

enhancement, configuration changes


Description

  • Updated the AWS Nuke script to use version v3.29.5, including changes to the download URL and command options.
  • Modified the AWS Nuke configuration file to rename account-blocklist to blocklist for compatibility with the new version.

Changes walkthrough 📝

Relevant files
Enhancement
destroy-aws.sh
Update AWS Nuke script to new version and command               

tests/destroy-aws.sh

  • Updated AWS Nuke version to v3.29.5.
  • Changed the download URL for AWS Nuke.
  • Modified the command to include additional flags.
  • +3/-3     
    Configuration changes
    aws-nuke.yaml
    Update configuration for AWS Nuke compatibility                   

    tests/aws-nuke.yaml

    • Renamed account-blocklist to blocklist.
    +1/-1     

    💡 PR-Agent usage: Comment /help "your question" on any pull request to receive relevant information

    Copy link
    Contributor

    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

    File Permissions
    Verify that the downloaded aws-nuke binary has proper executable permissions set after extraction

    Error Handling
    The script lacks error handling for the download and extraction steps. Failed downloads or corrupted archives could cause issues

    Configuration Path
    The nuke.yaml config file path has changed from aws-nuke.yaml but there's no check if the file exists

    Copy link
    Contributor

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Score
    Possible issue
    Fix incorrect configuration file name in command invocation

    The configuration file name in the aws-nuke command doesn't match the actual file
    name, which will cause the command to fail.

    tests/destroy-aws.sh [6]

    -./aws-nuke nuke -c nuke.yaml
    +./aws-nuke nuke -c aws-nuke.yaml
    • Apply this suggestion
    Suggestion importance[1-10]: 10

    Why: This is a critical fix as the script would fail due to referencing 'nuke.yaml' instead of 'aws-nuke.yaml', preventing the entire cleanup operation from working.

    10
    Add error handling for critical file operations to prevent silent failures

    Add error handling to check if the download and extraction of aws-nuke was
    successful before proceeding with the nuke command.

    tests/destroy-aws.sh [5-6]

    -wget https://github.com/ekristen/aws-nuke/releases/download/$AWS_NUKE_VERSION/aws-nuke-$AWS_NUKE_VERSION-linux-amd64.tar.gz && tar -xvf aws-nuke-$AWS_NUKE_VERSION-linux-amd64.tar.gz && rm aws-nuke-$AWS_NUKE_VERSION-linux-amd64.tar.gz
    +if ! wget https://github.com/ekristen/aws-nuke/releases/download/$AWS_NUKE_VERSION/aws-nuke-$AWS_NUKE_VERSION-linux-amd64.tar.gz || \
    +   ! tar -xvf aws-nuke-$AWS_NUKE_VERSION-linux-amd64.tar.gz; then
    +  echo "Failed to download or extract aws-nuke"
    +  exit 1
    +fi
    +rm aws-nuke-$AWS_NUKE_VERSION-linux-amd64.tar.gz
    +if [ ! -f ./aws-nuke ]; then
    +  echo "aws-nuke binary not found"
    +  exit 1
    +fi
     ./aws-nuke nuke -c nuke.yaml --max-wait-retries 200 --no-dry-run --force --log-full-timestamp true
    • Apply this suggestion
    Suggestion importance[1-10]: 8

    Why: Adding error handling for the download and extraction operations is crucial for reliability, as it prevents the script from proceeding with potentially destructive operations when prerequisites fail.

    8

    💡 Need additional feedback ? start a PR chat

    Copy link

    sonarqubecloud bot commented Dec 2, 2024

    @venkatamutyala venkatamutyala merged commit 02f56e0 into main Dec 3, 2024
    6 of 7 checks passed
    @venkatamutyala venkatamutyala deleted the feat-update-aws-nuke-script branch December 3, 2024 00:35
    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