AWS ECR job never completes after adding context parameter

I am trying to use a context with a repository/CircleCI project. The context is named “common”. It has no security groups attached, and it’s in the same CircleCI/GitHub organization as the repo. Here is the config.yml file in the repo:

version: 2.1

orbs:
  aws-ecr: circleci/aws-ecr@8.0.0

workflows:
  build-and-push:
    jobs:
      - aws-ecr/build-and-push-image:
          context: common
          repo: "my-repo-name"
          tag: "latest,${CIRCLE_SHA1}"
          filters:
            branches:
              only:
                - circleci-project-setup

The context contains all the environment variables necessary to run the job:

  • AWS_ACCESS_KEY_ID
  • AWS_ACCOUNT_ID
  • AWS_DEFAULT_REGION
  • AWS_ECR_REGISTRY_ID
  • AWS_REGION
  • AWS_SECRET_ACCESS_KEY

When I run the workflow, it just never completes. (Keywords: infinite loop, forever, endless, hangs.) Eventually it times out and switches to “Failed,” but I never get any logs. In fact, CircleCI claims that workflows I began yesterday are “Failed” but still running 22h later!

When I remove the context or change the paramter to the name of a context which doesn’t exist (e.g. context: my-fake-context), the workflow fails immediately when it can’t construct a URL to the ECR API domain:

Invalid endpoint: https://api.ecr..amazonaws.com
Error: Cannot perform an interactive login from a non TTY device

What is going on?? I want to use a context because the variables are going to be shared between 2–3 repos/projects.

Thanks in advance!

hmm,

Can you try passing them?

      - aws-ecr/build-and-push-image:
          aws-access-key-id: $AWS_ACCESS_KEY_ID

Looking at the sample here CircleCI Developer Hub - circleci/aws-ecr

i wonder if its the naming difference

like aws-access-key-id vs AWS_ACCESS_KEY_ID

Thank you for the suggestions. However, the behavior I’m seeing seems to have nothing at all to do with environment variables or even arguments. I have created a test config.yml which reproduces the hang when including a new context that has no env vars at all.

version: 2.1

orbs:
  aws-ecr: circleci/aws-ecr@8.0.0

jobs:
  test-context:
    docker:
      - image: cimg/base:stable
    steps:
      - checkout
      - run:
          name: "Testing context"
          command: |
            echo Branch: ${CIRCLE_BRANCH}

workflows:
  test:
    jobs:
      - test-context:
          context:
            - testme

Any other ideas?

hmm, was if u change version to

orbs: 
  aws-ecr: circleci/aws-ecr@8.1.2`

rather than 8.0.0

Great suggestion, thanks! Sadly, that doesn’t help. I’ve also tried removing the orbs section entirely, since my minimal test case doesn’t use any orbs. But the build still hangs and times out after 10 minutes.

Hi @nk9,

I have tried out the sample config.yml you have provided, but I was able to run it without any modifications.

When you mentioned that you were not seeing any logs, were you seeing a failed job link in the UI that was unclickable?

If so, this would lead me to believe it is a permissions related bug on our end. Whenever you include a context in a job, CircleCI will perform an extra check to verify your account’s permissions and refresh the information we have stored for your account.

When this check fails or times out, it causes the job to fail. The chances of this happening increases when you haven’t used/accessed the dashboard recently.

One thing I would like to suggest is to have you reauthorize your account by following these steps:

  1. Sign out of your CircleCI account
  2. Clear your browser’s cache and cookies
  3. Sign into your GitHub/Bitbucket account
  4. Sign back into your CircleCI account
  5. Trigger a new build

There is an additional step listed in the following article that you can try as well, but it involves revoking access to CircleCI completely which would delete any user keys you have generated:

https://support.circleci.com/hc/en-us/articles/360051228052-How-to-perform-a-full-re-authentication

If the above steps do not work, or you believe that the description about the failed job does not apply to your case, I would suggest submitting a support ticket at the following link so that we can take a closer look:

https://circleci.zendesk.com/hc/en-us/requests/new

Thank you!

Thanks for the reply Aaron. When I say “no logs”, I’m not seeing any link. The web UI just looks like this until 10 minutes have passed and it changes to “Failed”:

Normally I can click on the “test-context” box to get info on what’s happening, but that doesn’t work in this case.

As for your suggested solution, I have been using the dashboard extensively over the past few days as I’ve been working to set up CD for a couple of my repos. And yet, when I followed your steps (cancel current run, sign out from the menu, sign in again using an incognito window, rerun workflow)… the workflow completed! I’ve tried accessing variables declared in the context and that is now working as expected.

I submitted a support request earlier today, and I do hope you guys can figure out a way to actually fix this issue. For example, while testing this, I’ve already had it happen where I change the context on a workflow and the runs begin to hang again until I do the above steps anew. It seems like changing contexts can trigger this ATM, at least in my org.

But for now, my issue is resolved. Thank you so much!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.