Giter Site home page Giter Site logo

Comments (6)

Ian-Rowland-i2 avatar Ian-Rowland-i2 commented on September 22, 2024

I think the orb could really benefit from some additional Windows tests!

from aws-cli-orb.

brivu avatar brivu commented on September 22, 2024

Hey @jenny-miggin and @Ian-Rowland-i2,

Thanks for bringing this to our attention. I have a fix in place and some extra testing as well in #174.

If there are other test cases you can think of, let me know and I'd be happy to add them as well!

Best,
Brian

from aws-cli-orb.

Ian-Rowland-i2 avatar Ian-Rowland-i2 commented on September 22, 2024

According to the @orb.yml, the latest version of the orb should only used to install version 2.

So not sure why code is present to distinguish between version 1 and version 2 paths.

This could be accomplished by updating install.sh to include the following code:

# Only support AWS CLI V2
if echo "${AWS_CLI_STR_AWS_CLI_VERSION}" | grep -q "^1\."; then
    echo "AWS CLI V1 (v${AWS_CLI_STR_AWS_CLI_VERSION}) is not supported."
    exit 1
fi

This would obviate the need for the logic distinguishing between the two paths as only version 2 would be accepted.

If this is not possible then the Windows version of the install.sh, should be updated, as the grep statement in its current form will allow, for example, version 1.24.0 to be installed but will be assigned the Version 2 path!

This is because grep -e "2." will match the number '2' and any next character within the whole string. i.e.

echo "1.24.0" | grep -e "2." -e "latest"
echo "1.16.213" | grep -e "2." -e "latest"
echo "2.1.33" | grep -e "2." -e "latest"

will all match.

The correct expression is "^2\." - this will ensure that versions beginning with "2", followed by a '.' will match. This will eliminate the first two versions numbers (1.24.0 and 1.16.213) from being matched.

from aws-cli-orb.

Ian-Rowland-i2 avatar Ian-Rowland-i2 commented on September 22, 2024

Also noted that the tests that override with the latest versions (integration-test-install-override-version-with-latest-*) assume that because a version has been installed that the latest version has been installed., whereas it should verify that it is the case.

This can accomplished using the following code to obtain the latest available version of the AWS CLI and comparing it to the version installed:

# Fetches the latest available AWS Command Line Interface (AWS CLI) version from either chocolatey.org for Windows executors
# or from the official AWS CLI GitHub repository's CHANGELOG file.
#
# Returns:
#   # - The latest available AWS CLI version in 'x.y.z' format.
function get_latest_available_aws_cli_version() {
  # shellcheck disable=SC2005 # This syntax results in exactly the desired output
  if is_choco_installed; then
      echo "$(choco find awscli --exact --page-size=1 --limit-output --source=chocolatey | tail -n1 | cut -d'|' -f2)"
  else
      # Otherwise, interrogate the AWS CLI changelog for the latest version.
      # N.B The following commands fail (to run on non-Windows executors):
      # latest_version="$(curl -s https://raw.githubusercontent.com/aws/aws-cli/v2/CHANGELOG.rst | grep -oEm 1 '[0-9]+\.[0-9]+\.[0-9]+')" - gives error status 23
      # latest_version="$(curl -s https://raw.githubusercontent.com/aws/aws-cli/v2/CHANGELOG.rst | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -n 1)" give error status 141
      # See https://stackoverflow.com/a/19120674 for more details
      echo "$(curl -s https://raw.githubusercontent.com/aws/aws-cli/v2/CHANGELOG.rst)" | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' |  sed -n 1p
  fi
}

from aws-cli-orb.

Ian-Rowland-i2 avatar Ian-Rowland-i2 commented on September 22, 2024

Also, the Windows code (and the non-Windows code), always uninstall the existing CLI before installing the specified version.

This means that if the specified version is already installed, it is uninstalled (unnecessarily) and then (re)installed, when in fact it should be a NO-OP!

The code should check if the specified version is installed and do nothing if it is.

from aws-cli-orb.

Ian-Rowland-i2 avatar Ian-Rowland-i2 commented on September 22, 2024

Finally, the Toggle_Pager code is only run if the AWS CLI was initially absent or if another version is being installed.

If an existing version of the AWS CLI is present the TogglePager code is not run meaning the disable_aws_pager argument is effectively ignored.

from aws-cli-orb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.