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

Cannot perform an interactive login from a non TTY device #296

Closed
swiknaba opened this issue Aug 10, 2023 · 3 comments
Closed

Cannot perform an interactive login from a non TTY device #296

swiknaba opened this issue Aug 10, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@swiknaba
Copy link

swiknaba commented Aug 10, 2023

Orb version

I've just upgrade from orb version 7.x to 9.0.0
(skipping v8.x since that is still broken, and a patch was never released, see #269).

What happened

The following snippet worked in 7.x

jobs:
  backend-docker:
    resource_class: medium
    docker:
      - image: cimg/base:current
    steps:
      - checkout
      - setup_remote_docker:
          docker_layer_caching: true
      - attach_workspace:
          at: .
      - aws-cli/install
      - aws-ecr/ecr_login
      - aws-ecr/build_and_push_image:
          auth:
            - aws-cli/setup
          repo: << pipeline.parameters.project-name >>
          tag: 'commit-${CIRCLE_SHA1},latest-${CIRCLE_BRANCH//\//-}'
          extra_build_args: '--build-arg GIT_SHA="${CIRCLE_SHA1}" --build-arg DOCKER_DEPLOYKEY_BASE64="$DOCKER_DEPLOYKEY_BASE64"'
          path: backend

but now the ecr_login step fails with:

Removing login credentials for ***********************************************

The config profile (default) could not be found
Error: Cannot perform an interactive login from a non TTY device

Exited with code exit status 1

I already added the new ENV VAR AWS_DEFAULT_REGION and set it to my desired region ("eu-central-1") (previously I was using AWS_REGION).

NOTE: the build_image and push_image both do NOT required an auth object, but the combined build_and_push_image does required it. The documentation on that is rather absent. Why is that only required for the combined job? Can't I use ecr_login?

Expected behavior

I expect the orb to work, especially for such a basic task.#

I also expect the docs be particularly careful about documenting actual (breaking) changes to previous versions.

@swiknaba swiknaba added the bug Something isn't working label Aug 10, 2023
@guillaumearm
Copy link

Same problem here with this config:

jobs:
  build-and-push:
    executor:
      name: aws-ecr/default
      docker_layer_caching: false
    parameters:
      repo:
        description: The ECR repo name you want to push your image to
        type: string
      tag:
        description: Tag to use for the image
        type: string
      dockerfile:
        description: Dockerfile path
        type: string
    steps:
      - aws-ecr/build_and_push_image:
          auth:
            - aws-cli/setup:
                aws_access_key_id: ECR_AWS_ACCESS_KEY_ID
                aws_secret_access_key: ECR_AWS_SECRET_ACCESS_KEY
                profile_name: myProfileName
          extra_build_args: '--build-arg NPM_TOKEN --build-arg DD_VERSION="<< pipeline.git.revision >>"'
          attach_workspace: true
          dockerfile: << parameters.dockerfile >>
          region: '${ECR_AWS_REGION}'
          repo: '<< parameters.repo >>'
          tag: '<< parameters.tag >>'

@nicolaschambrier
Copy link

Hello 👋 we've finally made it work and here are the main changes for us:

  • Authentication ➡️ implicitely relying on profile "default" didn't make the cut for us, I had to explicitly use a specific profile name:
        - aws-ecr/build_and_push_image:
            auth:
              - aws-cli/setup:
                  aws_access_key_id: OUR_ACCESS_KEY_ID
                  aws_secret_access_key: OUR_SECRET_ACCESS_KEY
                  profile_name: ecr
            profile_name: ecr
            ...
  • build ➡️ this is a bit more specific to us I think, but we used to pass tag: "$(cat ./some-file)" which was generated earlier. I think this is due to not knowing about $BASH_ENV by that time? However this used to work and doesn't anymore as they changed something in the build script and now the string is manipulated before (split by space among other things), so we had to change the way this worked by storing the tag in a shared env var, like that:
      ...
        - run:
            name: Set tag from file
            command: |
              echo "file: our-ecr-tag.txt"
              echo "value: $(cat out-ecr-tag.txt)"
              echo 'export STEP_ECR_TAG="$(cat our-ecr-tag.txt)"' >> "$BASH_ENV"
      ...
        - aws-ecr/build_and_push_image:
            tag: '${OUR_ECR_TAG}'

@BernalCarlos
Copy link

BernalCarlos commented Oct 9, 2023

The docs offer zero context on how to set this up. In our case, we migrated from version 8.x to 9.x.

What solved the same problem for us, was adding AWS_DEFAULT_REGION to the environment and calling aws-cli/setup before the build and push command.

  deploy_app:
    ...
    steps:
      - aws-cli/setup
      - setup_remote_docker:
          docker_layer_caching: true
      - aws-ecr/build_and_push_image:
          auth:
            - aws-cli/setup
          repo: "equals-services-<< parameters.app-environment >>-backend"
          dockerfile: ".docker/Dockerfile"
          tag: "latest,<< pipeline.git.revision >>"
          extra_build_args:
            ...

@brivu brivu closed this as completed Dec 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants