GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Warning annotation appears in Github Actions when post-build tries to clean up the builder · Issue #156 · docker/setup-buildx-action

Warning annotation appears in Github Actions when post-build tries to clean up the builder #156

New issue
Copy link
New issue
Copy link
Closed
#218
Closed
Warning annotation appears in Github Actions when post-build tries to clean up the builder#156
#218
Copy link
Labels
kind/bug

Description

@bamarch
bamarch
opened on Jul 14, 2022
Issue body actions

Behaviour

Steps to reproduce this issue

  1. Use buildx
  2. Warning appears in Github Actions when post-build tries to clean up the builder

Expected behaviour

If the error code is ignored and it's expected the builder won't be there sometimes, suppress the error so this warning annotation isn't present in each build

Actual behaviour

Each build shows a warning generated by the post step - perhaps it is something I'm doing or there is a way to easily suppress it?

image

image

Unfortunately these annotations are quite visible, and I'm often finding myself fielding questions about why they're present

Configuration

# composite action
name: 'Build'
description: 'pr.yml or ci.yml job: build'
inputs:
  src-code-path:
    description: 'Path to dir containing dotnet source code, relative to the github workspace root.'
    required: false
    default: './src'
  infra-repo-path:
    description: 'Path to checked-out infrastructure repo code, relative to the github workspace root.'
    required: false
    default: './infra-repo'
  publish:
    description: 'Publish built images to ACR if this is set to true'
    required: false
    default: 'false'
  acr-host:
    description: 'The ACR host for publishing images to'
    required: false
    default: ''
  acr-user:
    description: 'The ACR user for publishing images as'
    required: false
    default: ''
  acr-password:
    description: 'The ACR user password'
    required: false
    default: ''
  image-version:
    description: 'Version to tag the deployed docker image with when publishing e.g. github.sha, or 1.2.3'
    required: true
runs:
  using: "composite"
  steps:
    - name: Set Env
      shell: bash
      run: |
        {
          echo "SCRIPTS_DIR=${{ github.workspace }}/${{ inputs.infra-repo-path }}/.github/scripts"
          echo "SRC_DIR=${{ github.workspace }}/${{ inputs.src-code-path }}"
        } >> "$GITHUB_ENV"

    - name: Set up Docker Buildx
      id: buildx
      uses: docker/setup-buildx-action@v2

    - name: Build Docker Images (testing)
      shell: bash
      if: ${{ inputs.publish != 'true' }}
      working-directory: ${{ env.SRC_DIR }}
      # cached for maximum speed
      run: |
        docker buildx bake \
          -f docker-compose.yml \
          --builder ${{ steps.buildx.outputs.name }} \
          --set *.cache-from="type=gha,scope=${{ github.workflow }}" \
          --set *.cache-to="type=gha,scope=${{ github.workflow }},mode=max"

    - name: Build Docker Images (to publish)
      if: ${{ inputs.publish == 'true' }}
      shell: bash
      working-directory: ${{ env.SRC_DIR }}
      env:
        DOCKER_REGISTRY: ${{ inputs.acr-host }}/
        IMAGE_VERSION: ":${{ inputs.image-version }}"
        BUILD_ARG_HOMEPAGE_OVERRIDE: "${{ env.BUILD_ARG_HOMEPAGE_OVERRIDE }}"
      # no cache for security so when we publish we pull in security updates for the base
      run: |
        docker buildx bake \
          -f docker-compose.yml \
          --builder ${{ steps.buildx.outputs.name }} \
          --load \
          --no-cache

    - uses: azure/docker-login@v1
      if: ${{ inputs.publish == 'true' }}
      with:
        login-server: ${{ inputs.acr-host }}
        username: ${{ inputs.acr-user }}
        password: ${{ inputs.acr-password }}

    - name: Push Docker Images (image version)
      if: ${{ inputs.publish == 'true' }}
      shell: bash
      working-directory: ${{ env.SRC_DIR }}
      env:
        DOCKER_REGISTRY: ${{ inputs.acr-host }}/
        IMAGE_VERSION: ":${{ inputs.image-version }}"
      run: docker compose -f docker-compose.yml push

    - name: Tag Images (branch name)
      if: ${{ inputs.publish == 'true' && github.ref_name == 'main' }}
      shell: bash
      run: |
        for source_image_name in $(docker images --format "{{.Repository}}" | grep "${{ inputs.acr-host }}"); do
          echo "Tagging $source_image_name"
          source_image="${source_image_name}:${{ inputs.image-version }}"

          dest_image_branchname="${source_image_name}:main"
          echo "Tagging $source_image -> $dest_image_branchname"
          docker tag "$source_image" "$dest_image_branchname"
        done

    - name: Push Docker Images (branch name)
      if: ${{ inputs.publish == 'true' && github.ref_name == 'main' }}
      shell: bash
      working-directory: ${{ env.SRC_DIR }}
      env:
        DOCKER_REGISTRY: ${{ inputs.acr-host }}/
        IMAGE_VERSION: ":main"
      run: docker compose -f docker-compose.yml push
      
# using the action
jobs:

  build-and-publish:
    name: "Docker Build and Publish"
    runs-on: ubuntu-latest
    defaults:
      run:
        working-directory: ./src
    steps:
    - uses: actions/checkout@v2

    - name: Checkout Infrastructure repo
      uses: actions/checkout@v2
      with:
        fetch-depth: 0
        repository: BondOrigination/infrastructure
        path: infra-repo
        ssh-key: ${{ secrets.DEPLOY_KEY_INFRASTRUCTURE_READ_ONLY }}

    - name: Use PR Build action and publish
      uses: ./infra-repo/.github/actions/build
      with:
        publish: true
        image-version: ${{ github.sha }}
        acr-host: ${{ secrets.ACR_HOST__PRE }}
        acr-user: ${{ secrets.ACR_USERNAME__PRE }}
        acr-password: ${{ secrets.ACR_PASSWORD__PRE }}      

Logs

full logs: docker_buildx_logs.txt

Activity

  1. AndrewKahr commented on Jan 27, 2023

    @AndrewKahr
    AndrewKahr
    on Jan 27, 2023
    More actions

    I have this issue as well. This would be nice to have fixed as large matrix builds spam the annotation summary with this warning.

  2. TomasEkeli commented on Feb 17, 2023

    @TomasEkeli
    TomasEkeli
    on Feb 17, 2023
    More actions

    i see this as well

  3. crazy-max
    added
    status/needs-investigation
    on Feb 17, 2023
  4. crazy-max commented on Mar 3, 2023

    @crazy-max
    crazy-max
    on Mar 3, 2023
    Member
    More actions

    Is it just flaky or can you repro for every run?

  5. AndrewKahr commented on Mar 3, 2023

    @AndrewKahr
    AndrewKahr
    on Mar 3, 2023
    More actions

    It appears to repro every run for us. See https://github.com/game-ci/docker/actions/workflows/test.yml
    Every job within each run will get one of these warnings, though now that I look at it, the message is slightly different from OP's:

    ERROR: context builder cannot be removed, run `docker context rm default` to remove this context
    
  6. crazy-max commented on Mar 3, 2023

    @crazy-max
    crazy-max
    on Mar 3, 2023
    Member
    More actions

    It appears to repro every run for us. See https://github.com/game-ci/docker/actions/workflows/test.yml Every job within each run will get one of these warnings, though now that I look at it, the message is slightly different from OP's:

    ERROR: context builder cannot be removed, run `docker context rm default` to remove this context
    

    Oh I see, we should skip removal for docker builder. Will fix that.

    Reacted by Tomas Ekeli
  7. crazy-max
    added
    kind/bug
    and removed
    status/needs-investigation
    on Mar 3, 2023
  8. crazy-max
    closed this as completedin #218on Mar 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.