docker / build-push-action

GitHub Action to build and push Docker images with Buildx
https://github.com/marketplace/actions/build-and-push-docker-images
Apache License 2.0
4.11k stars 527 forks source link

ERROR: failed to solve: failed to do request: Post #1017

Closed carloscao0928 closed 7 months ago

carloscao0928 commented 7 months ago

Contributing guidelines

I've found a bug, and:

Description

Hi, when I build and push, I encounted one issue, the error log is ""https://xxxxxxxx.dkr.ecr.cn-north-1.amazonaws.com.cn/v2/ai-lab-cn/streamlit-athena-glue-table/blobs/uploads/": EOF Error: buildx failed with: ERROR: failed to solve: failed to do request: Post "https://xxxxxxxx.dkr.ecr.cn-north-1.amazonaws.com.cn/v2/ai-lab-cn/streamlit-athena-glue-table/blobs/uploads/": EOF"

Expected behaviour

Build and push successfully

Actual behaviour

Build successfully but push failed

Repository URL

No response

Workflow run URL

No response

YAML workflow

name: AI-LAB-CN Streamlit App

on:
  workflow_dispatch:

permissions:
  contents: read  # For actions/checkout
  id-token: write # For JWT
  packages: write # For helm-charts checkout

env:
  PRODUCT: ai-lab-cn
  VALUES_FILE: ai-lab-cn.yaml
  TOKEN: ${{ secrets.GITHUB_TOKEN }}
  AWS_ACCESS_KEY_ID: ${{ secrets.CHINA_CI_BOT_AWS_ACCESS_KEY_ID }}
  AWS_SECRET_ACCESS_KEY: ${{ secrets.CHINA_CI_BOT_AWS_SECRET_ACCESS_KEY }}

jobs:
  streamlit:
    runs-on: [ self-hosted, linux, x64, connected-ai-prod]
    steps:
      - name: Checkout Repo
        uses: actions/checkout@v3

      - name: Setup yq
        uses: alexellis/arkade-get@master
        with:
          yq: latest

      - name: Get Product Info
        shell: bash
        run: |
          echo "AWS_REGION=$(yq e '.region' ${{ env.PRODUCT }}/${{ env.VALUES_FILE }})" >> $GITHUB_ENV
          echo "ENVIRONMENT=$(yq e '.environment' ${{ env.PRODUCT }}/${{ env.VALUES_FILE }})" >> $GITHUB_ENV
          echo "ACCOUNT_ID=$(yq e '.accountID' ${{ env.PRODUCT }}/${{ env.VALUES_FILE }})" >> $GITHUB_ENV
          echo "NAMESPACE=$(yq e '.namespace' ${{ env.PRODUCT }}/${{ env.VALUES_FILE }})" >> $GITHUB_ENV

      - name: Assume Role
        uses: aws-actions/configure-aws-credentials@v3
        with:
          aws-access-key-id: ${{ env.AWS_ACCESS_KEY_ID }}
          aws-secret-access-key: ${{ env.AWS_SECRET_ACCESS_KEY }}
          aws-region: ${{ env.AWS_REGION }}
          role-to-assume: arn:aws-cn:iam::${{ env.ACCOUNT_ID }}:role/xxxxxxxx
          role-skip-session-tagging: true

      - name: Login to Amazon ECR
        uses: aws-actions/amazon-ecr-login@v1
        with:
          mask-password: 'true'
          registries: "${{ env.ACCOUNT_ID }}"

      - name: File Changes
        uses: dorny/paths-filter@v2
        id: changes
        with:
          filters: |
            athena-glue-table:
              - 'streamlit-app/athena-glue-table/**'

      - name: Image Build Push - Athena Glue Table
        if: steps.changes.outputs.athena-glue-table == 'true'
        uses: ./.github/actions/build-push-action-v2
        env:
          REGISTRY_NAME: xxxxxxxxx.dkr.ecr.cn-north-1.amazonaws.com.cn
          ECR_REPOSITORY: ai-lab-cn/streamlit-athena-glue-table
        with:
          app_path: streamlit-app/athena-glue-table/
          tags: |
            type=raw,value=0.0.1
            type=raw,value=latest

And the action:
name: Build and push docker images
description: Build a docker image and push it to our AWS ECR

inputs:
  version:
    description: 'Version following SemVer pattern, which is used to tag the Docker image'
    required: false
  app_path:
    description: 'The path of the streamlit app'
    required: true
  tags:
    description: 'tags that should be extracted from the Docker image'
    required: false
  arch:
    description: 'Custom Architecture to be deployed'
    required: false

runs:
  using: composite

  steps:
    - name: Setup QEMU for Emulation
      uses: docker/setup-qemu-action@v2
      if: inputs.arch

    - name: Setup Docker buildx
      uses: docker/setup-buildx-action@v2.5.0
      with:
        version: v0.9.1
        driver-opts: image=moby/buildkit:v0.10.6

    - name: Extract metadata for the Docker image
      id: meta
      uses: docker/metadata-action@v4.4.0
      with:
        images: ${{ env.REGISTRY_NAME }}/${{ env.ECR_REPOSITORY }}
        tags: |
          type=sha
          type=ref,event=tag
          type=ref,event=branch
          type=semver,pattern={{version}},value=${{ inputs.version }}
          ${{ inputs.tags }}
          ${{ inputs.version }}

    - name: Build, tag, and push the image to Amazon ECR
      id: build-image
      uses: docker/build-push-action@v4.0.0
      with:
        provenance: false
        push: true
        platforms: ${{ inputs.arch != null && inputs.arch || 'linux/amd64' }}
        context: "./${{ inputs.app_path}}"
        tags: ${{ steps.meta.outputs.tags }}
        labels: ${{ steps.meta.outputs.labels }}
        build-args: ECR_REPO=${{ env.REGISTRY_NAME }}/${{ env.ECR_REPOSITORY }}

Workflow logs

No response

BuildKit logs

No response

Additional info

No response

carloscao0928 commented 7 months ago
Screenshot 2023-11-24 at 17 52 02
crazy-max commented 7 months ago

Looks like an issue with your registry. Might be an issue with your self hosted runners.

crazy-max commented 7 months ago

Don't think we can do much about it but in any case can you post your BuildKit logs? See https://docs.docker.com/build/ci/github-actions/configure-builder/#buildkit-container-logs