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

Update docker image to fix aws-cli, update doctor to properly report AWS info from within docker. #65

Merged
merged 3 commits into from
Oct 12, 2022
Merged
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
9 changes: 4 additions & 5 deletions cloud/cloud.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
# workaround uses an aarch64 (arm64) image instead when an optional platform argument is set to arm64.
# Docker's BuildKit skips unused stages so the image for the platform that isn't used will not be built.

FROM eclipse-temurin:11.0.16_8-jre-alpine as amd64
FROM bellsoft/liberica-openjre-alpine:11.0.16-8 as arm64
FROM eclipse-temurin:11.0.16_8-jre as amd64
FROM bellsoft/liberica-openjre-debian:11.0.16-8 as arm64

FROM ${TARGETARCH}

Expand All @@ -14,8 +14,7 @@ COPY --from=amazon/aws-cli:2.8.2 /usr/local /usr/local
COPY --from=amazon/aws-cli:2.8.2 /aws /aws
# TODO(#3222): Add Azure CLI and make sure It works with arm64.

RUN /bin/sh -c set -o pipefail && apk update && \
apk add --upgrade apk-tools && apk upgrade --available && \
apk add --no-cache --update bash python3 git less groff
RUN /bin/sh -c set -o pipefail && apt-get update && \
apt-get upgrade --yes && apt-get install --yes bash python3 git

COPY ./cloud/ cloud/
11 changes: 7 additions & 4 deletions cloud/shared/bin/doctor.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def should_skip(self):
return self._get_cloud_provider() not in ['aws', 'azure']

def is_ok(self):
return self._check_command_succeeds(["aws", "help"])
return self._check_command_succeeds(["aws", "--version"])


class AzureCliCheck(Check):
Expand Down Expand Up @@ -168,10 +168,13 @@ def should_skip(self):
return self._get_cloud_provider() not in ['aws', 'azure']

def is_ok(self):
output = self._get_command_output(["aws", "configure", "list-profiles"])
output = self._get_command_output(["aws", "sts", "get-caller-identity"])

# the default profile will be present if they are logged in
return 'default' in output
# If AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY are not set, the above
# command will print nothing to stdout and an error message to stderr.
# If they are set, a json object with the following keys will be
# printed to stdout.
return 'UserId' in output and 'Account' in output and 'Arn' in output


class AzureLoginCheck(Check):
Expand Down