CircleCI-Public / aws-ecr-orb

CircleCI orb for interacting with Amazon's Elastic Container Registry (ECR)
https://circleci.com/orbs/registry/orb/circleci/aws-ecr
MIT License
79 stars 140 forks source link

Step failing with ecr_login with 9.3.1 #352

Closed dishn closed 1 month ago

dishn commented 1 month ago

aws-ecr v9.3.1

What happened

when running command ecr_login, step would fail due to required user input:

The following NEW packages will be installed:
  amazon-ecr-credential-helper apparmor cgroupfs-mount containerd criu dbus
  dbus-bin dbus-daemon dbus-session-bus-common dbus-system-bus-common
  dbus-user-session dmsetup docker.io gettext-base iproute2 iptables
  libapparmor1 libargon2-1 libatm1 libbpf1 libcap2-bin libcryptsetup12
  libdbus-1-3 libdevmapper1.02.1 libfdisk1 libintl-perl libintl-xs-perl
  libip4tc2 libip6tc2 libjson-c5 libkmod2 libmnl0 libmodule-find-perl
  libmodule-scandeps-perl libnet1 libnetfilter-conntrack3 libnfnetlink0
  libnftables1 libnftnl11 libnl-3-200 libnss-systemd libpam-cap libpam-systemd
  libproc-processtable-perl libprotobuf-c1 libprotobuf32
  libsort-naturally-perl libsystemd-shared libterm-readkey-perl libxtables12
  needrestart nftables python3-protobuf runc sgml-base systemd systemd-sysv
  systemd-timesyncd tini
0 upgraded, 59 newly installed, 0 to remove and 5 not upgraded.
Need to get 80.1 MB of archives.
After this operation, 313 MB of additional disk space will be used.
Do you want to continue? [Y/n] Abort.

Exited with code exit status 1

This issue did not occur when we had version 9.0.2.

here's a snippet of the step:

    description: "Setup AWS ECR"
    steps:
      - setup_env
      - aws-ecr/ecr_login:
          # This requires the ${ } in order to substitute this environment variable name to string
          region: ${AWS_REGION}
marboledacci commented 1 month ago

Could yo provide more details about the environment you are using? It looks like it is failing for a lack of confirmation in the installation, but normally that's not requested.

dishn commented 1 month ago

@marboledacci We ran it in a remote docker environment with resource sized medium in circleci, below are the headers in the config.yml file:

version: 2.1
node-version-fill: &node-version-fill
  docker:
    - image: node:12.18.1
python-version-fill: &python-version-fill
  docker:
    - image: python:3.10.14
orbs:
  aws-cli: circleci/aws-cli@4.0.0
  aws-ecr: circleci/aws-ecr@9.3.1
  aws-eks: circleci/aws-eks@0.2.3
  kubernetes: circleci/kubernetes@0.12.0
  heroku: circleci/heroku@1.2.6
  browser-tools: circleci/browser-tools@1.4.8

instance is:

machine-agent version 1.0.81369-7529d87 (image: "ubuntu-2204:2024.05.1", public ip: "...", provider: "EC2") docker-agent version 1.0.26641-1e6f761

I've also tried aws-ecr@9.0.3 and it would fail with the same error, though not 9.0.2

marboledacci commented 1 month ago

The installation of the helper was added in 9.03, so that makes sense. As your instance is requiring to install more packages it needs confirmation. I'm going to add a -y flag to the step and that should work. In the meantime, if you need to use the newer versions of the orb before I can publish the fix I can think of two alternatives.

You can run installation steps previous to the login:

apt update
apt -y install amazon-ecr-credential-helper

Or you can choose not to use the credentials helper, and use the classical docker login as it was done in version 9.02 and before. For that you would have to set use_credentials_helper to false:

      - aws-ecr/ecr_login:
          region: ${AWS_REGION}
          use_credentials_helper: false

For this last option you must use version 9.3.0 or later.

dishn commented 1 month ago

Thank you for your response, I'll consider this issue to be fixed in a later update then, will be closing the issue.