Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions aws/install-cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,36 @@ To install the latest version of the AWS CLI:
```yaml
tasks:
- key: aws-cli
call: aws/install-cli 1.0.11
call: aws/install-cli 2.0.0
```

To install a specific version of the AWS CLI (only v2 of the AWS CLI is supported):

```yaml
tasks:
- key: aws-cli
call: aws/install-cli 1.0.11
call: aws/install-cli 2.0.0
with:
cli-version: "2.15.13"
```

For the list of available versions, see the AWS CLI changelog on GitHub:

https://raw.githubusercontent.com/aws/aws-cli/v2/CHANGELOG.rst

## Upgrading to 2.0.0

Version 2.0.0 no longer automatically installs `unzip` and `gpg` if they are missing. If your base image does not include these tools, you will need to install them yourself and specify that task as a `use` dependency.

```yaml
tasks:
- key: install-deps
run: |
apt-get update
apt-get install -y unzip gnupg
apt-get clean

- key: aws-cli
use: install-deps
call: aws/install-cli 2.0.0
```
111 changes: 0 additions & 111 deletions aws/install-cli/mint-utils.sh

This file was deleted.

58 changes: 28 additions & 30 deletions aws/install-cli/rwx-package.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: aws/install-cli
version: 1.0.11
version: 2.0.0
description: Install the AWS CLI
source_code_url: https://github.com/rwx-cloud/packages/tree/main/aws/install-cli
issue_tracker_url: https://github.com/rwx-cloud/packages/issues
Expand All @@ -10,51 +10,49 @@ parameters:
required: false

tasks:
- key: install-unzip-if-necessary
- key: setup
run: |
if ! command -v unzip &> /dev/null; then
source "$RWX_PACKAGE_PATH/mint-utils.sh"
if ! mint_os_package_manager_in apt; then
echo "Unsupported operating system or package manager \`$(mint_os_package_manager)\`" > "$(mktemp "$RWX_ERRORS/error-XXXX")"
exit 1
fi

sudo apt-get update
sudo apt-get install unzip
sudo apt-get clean
needed=""

if ! command -v curl >/dev/null 2>&1; then
needed="$needed curl"
fi
filter: []
- key: install-gpg-if-necessary
run: |
if ! command -v gpg &> /dev/null; then
source "$RWX_PACKAGE_PATH/mint-utils.sh"
if ! mint_os_package_manager_in apt; then
echo "Unsupported operating system or package manager \`$(mint_os_package_manager)\`" > "$(mktemp "$RWX_ERRORS/error-XXXX")"
exit 1
fi

sudo apt-get update
sudo apt-get install gnupg
sudo apt-get clean

if ! command -v unzip >/dev/null 2>&1; then
needed="$needed unzip"
fi

if ! command -v gpg >/dev/null 2>&1; then
needed="$needed gpg"
fi

if [ -n "$needed" ]; then
cat << EOF > "${RWX_ERRORS}/missing-packages"
The \`aws/install-cli\` package requires system packages that were missing:$needed

Define a task which installs those packages, and specify it as a \`use\` dependency of the \`aws/install-cli\` task
EOF
exit 1
fi
filter: []
- key: install-cli
use: [install-gpg-if-necessary, install-unzip-if-necessary]
use: [setup]
run: |
set -ueo pipefail
set -ue
. "$RWX_PACKAGE_PATH/rwx-utils.sh"

tmp="$(mktemp -d)"
cd "$tmp"

# installer zip
if [[ -n "$CLI_VERSION" ]]; then
if [ -n "$CLI_VERSION" ]; then
curl -o "awscliv2.zip" -fsSL "https://awscli.amazonaws.com/awscli-exe-linux-$(uname -m)-$CLI_VERSION.zip"
else
curl -o "awscliv2.zip" -fsSL "https://awscli.amazonaws.com/awscli-exe-linux-$(uname -m).zip"
fi

# signature
if [[ -n "$CLI_VERSION" ]]; then
if [ -n "$CLI_VERSION" ]; then
curl -o "awscliv2.sig" -fsSL "https://awscli.amazonaws.com/awscli-exe-linux-$(uname -m)-$CLI_VERSION.zip.sig"
else
curl -o "awscliv2.sig" -fsSL "https://awscli.amazonaws.com/awscli-exe-linux-$(uname -m).zip.sig"
Expand Down Expand Up @@ -130,7 +128,7 @@ tasks:
gpg --verify awscliv2.sig awscliv2.zip

unzip awscliv2.zip
sudo ./aws/install
rwx_maybe_sudo ./aws/install
rm -rf "$tmp"
aws --version
filter: []
Expand Down
5 changes: 5 additions & 0 deletions aws/install-cli/rwx-test-base.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,10 @@
"image": "ubuntu:24.04",
"config": "rwx/base 1.0.0",
"arch": "arm64"
},
{
"image": "alpine:latest",
"config": "6e590fe8cb5122675c1998821470722bc58dab3f53cc992c18d3b3382f03a31e",
"arch": "x86_64"
}
]
17 changes: 17 additions & 0 deletions aws/install-cli/rwx-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,32 @@ base:
arch: ${{ init.base-arch }}

tasks:
- key: system-packages
run: |
if ! command -v curl >/dev/null 2>&1 || ! command -v unzip >/dev/null 2>&1 || ! command -v gpg >/dev/null 2>&1; then
if command -v apk >/dev/null 2>&1; then
apk add --no-cache curl unzip gnupg
elif command -v apt-get >/dev/null 2>&1; then
apt-get -y update
apt-get -y install curl unzip gnupg
apt-get clean
else
echo "Unsupported package manager; need curl, unzip, and gpg installed" >&2
exit 1
fi
fi

- key: test-default
call: ${{ init.package-digest }}
use: system-packages

- key: test-default--assert
use: test-default
run: aws --version | grep 'aws-cli/2\.'

- key: test-specified
call: ${{ init.package-digest }}
use: system-packages
with:
cli-version: "2.0.30"

Expand Down
Loading