-
Notifications
You must be signed in to change notification settings - Fork 581
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
Not worked with ECR actions #20
Comments
Hi @Surgo the action uses a separate Could you try changing the build-push-action inputs to something like:
|
Hey @Surgo did this work for you? |
tried with similar workflow, it still returning
|
@zappy-shu @nebuk89 That does not worked for me :( |
It's my temporary solution.
|
Any news about this issue? I'm having the same problem |
Following what @Surgo suggested, by separating registry from the repository I managed to avoid the My GH-action look like this
|
+1 on the issue - I'm having an analogous problem with digitalocean's container registry: this configuration doesn't work (nor variants with dummy credentials do):
login succeeds in its own step, then build-push-action doesn't pick up the existing login.
yes, this has nothing do to with ECR - but to me it looks like the same underlying problem of not picking up existing logins. |
Thanks @Surgo, I'm using your workaround for now. |
any official comments on this? |
Here's a slightly improved version of the workaround. It fixes:
- name: Login to ECR
env:
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
AWS_REGION: ${{ secrets.AWS_REGION }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
id: get-ecr-password
run: |
aws ecr get-login-password \
| {
read PASSWORD
echo "::add-mask::$PASSWORD"
echo "::set-output name=password::$PASSWORD"
} |
@Surgo You should be able to use the ECR action with our future build-push-action v2 (#92). Can you try it? |
@crazy-max Works fine for me - name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Build & Push image
uses: docker/build-push-action@v2-build-push
with:
registry: ${{ steps.login-ecr.outputs.registry }}
repository: ${{ steps.login-ecr.outputs.registry }}/${{ secrets.REGISTRY }}
add_git_labels: true
tag_with_ref: true 📣 Buildx version: 0.4.2
🏃 Starting build...
/usr/bin/docker buildx build --iidfile /tmp/docker-build-push-dIdwjV/iidfile --file ./Dockerfile .
time="2020-09-03T10:35:10Z" level=warning msg="invalid non-bool value for BUILDX_NO_DEFAULT_LOAD: "
#2 [internal] load build definition from Dockerfile
#2 transferring dockerfile: 1.82kB 0.0s done
#2 DONE 0.0s
#1 [internal] load .dockerignore
#1 transferring context: 109B done
#1 DONE 0.0s
#3 [internal] load metadata for ***.dkr.ecr.us-east-1.amazonaws.co...
#3 DONE 0.3s
...
#19 exporting to image
#19 exporting layers
#19 exporting layers 8.3s done
#19 writing image sha256:dfe7204a70239a95a8ce761af1bb4a5ea306edb6466cd7011a1ec136e021c8d2 done
#19 DONE 8.3s
🛒 Extracting digest...
sha256:dfe7204a70239a95a8ce761af1bb4a5ea306edb6466cd7011a1ec136e021c8d2 (BTW: I'll close this issue when v2 released. |
Be careful, inputs have changed in v2. See Usage section and also this workflow as an example.
Great! |
v2 released 🎉 |
A full example with ECR would be great! I've tried both: - name: Login to ECR
uses: docker/login-action@v1
with:
registry: 000000000000.dkr.ecr.nn-nnnn-1.amazonaws.com
username: ${{ secrets.AWS_ACCESS_KEY_ID }}
password: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Build & Push image
uses: docker/build-push-action@v2
env:
DOCKER_BUILDKIT: 1
with:
context: .
file: ./Dockerfile
push: true
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
tags: |
repo:${{ github.sha }}
repo:latest and - name: Build & Push image
uses: docker/build-push-action@v2
env:
DOCKER_BUILDKIT: 1
with:
context: .
file: ./Dockerfile
push: true
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
tags: |
000000000000.dkr.ecr.nn-nnnn-1.amazonaws.com/repo:${{ github.sha }}
000000000000.dkr.ecr.nn-nnnn-1.amazonaws.com/repo:latest First gave me a |
Let me know if you'd like me to bring conversation there vs here (but I think this is explicitly referring to ECR so it might fit either?) Updated setup to use - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
with:
driver-opts: image=moby/buildkit:master Still no dice. Same errors. I tried with the full registry for a tag and this is the more explicit error message
|
@michaelhelmick Can you open a new issue about this please with all relevant info for a bug report? Thanks. |
I haven't been able to get this to work for me. I'm trying to use ECR as the cache repo of my multi-stage docker build. I'm not doing a push to the repo in this step, that happens later (..although I could change that if it makes it easier). - name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Docker build using docker build layer cacheing
uses: docker/build-push-action@v2
env:
DOCKER_BUILDKIT: 1
with:
registry: ${{ steps.login-ecr.outputs.registry }}
repository: ${{ steps.login-ecr.outputs.registry }}/myproject-frontend
context: .
push: false
build-args: |
BUILD_APP_VERSION=${{ env.RELEASE_VERSION }}
tags: |
myproject-frontend:latest
myproject-frontend:${{ env.RELEASE_VERSION }}
cache-from: type=registry,ref=myproject-frontend:buildcache
cache-to: type=registry,ref=myproject-frontend:buildcache,mode=max This gave me the error Going by the error and since I couldn't find mention of the - name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Docker build using docker build layer cacheing
uses: docker/build-push-action@v2
env:
DOCKER_BUILDKIT: 1
with:
context: .
push: false
build-args: |
BUILD_APP_VERSION=${{ env.RELEASE_VERSION }}
tags: |
myproject-frontend:latest
myproject-frontend:${{ env.RELEASE_VERSION }}
cache-from: type=registry,ref=${{ steps.login-ecr.outputs.registry }}/myproject-frontend:buildcache
cache-to: type=registry,ref=${{ steps.login-ecr.outputs.registry }}/myproject-frontend:buildcache,mode=max This gave me a 400 bad request error: I've not been able to find any other documentation/examples of how to use ECR for the build cache. Can someone point me to where I'm going wrong? |
hitting the same issue with ECR as cache target, @dfluff did you manage to make it work in the end? |
@HellGilo ECR just does not support it aws/containers-roadmap#876 |
For anyone trying to get
The key being the |
After ECR login action, can pull and push images from ECR repository on run docker command directly.
Maybe it required to support local
~/.docker/config.json
But cannot pull and push on
docker/build-push-action
caused byno basic auth credentials
error.My workflow is
Successfully pull on command line:
Pull from ECR (pull test)
Logged in to ECR: Debug auth (pull test)
Failed to push or pull on
docker/build-push-action@v1
The text was updated successfully, but these errors were encountered: