Skip to content

.git directory not present when expected with only certain files allowed #513

@nazar-pc

Description

@nazar-pc

Behaviour

Steps to reproduce this issue

  1. Have following ignore list
# .dockerignore
*
!/.git/refs/heads
!/.git/config
!/.git/HEAD
  1. And following config
FROM ubuntu:20.04

WORKDIR /code

COPY .git /code/.git

Expected behaviour

It should work, the idea is to include bare minimum files needed for git rev-parse --short HEAD to run

Actual behaviour

#10 [stage-0  7/11] COPY .git /code/.git
#10 ERROR: "/.git" not found: not found

...

------
 > [stage-0  7/11] COPY .git /code/.git:
------
error: failed to solve: failed to compute cache key: "/.git" not found: not found
Error: buildx failed with: error: failed to solve: failed to compute cache key: "/.git" not found: not found

Which apparently means none of those allowed files were actually present.

Probably related to #511

Configuration

Details
on:
  push:
    tags:
      - 'snapshot-*'

jobs:
  container-images:
    runs-on: ubuntu-20.04
    permissions:
      contents: read
      packages: write
    strategy:
      matrix:
        image:
          - node
          - farmer

    steps:
      - name: Log into registry
        uses: docker/login-action@v1
        with:
          registry: ghcr.io
          username: ${{ github.actor }}
          password: ${{ github.token }}

      - name: Extract Docker metadata
        id: meta
        uses: docker/metadata-action@v3
        with:
          images: |
            ghcr.io/subspace/${{ matrix.image }}
          tags: |
            type=ref,event=tag
          flavor: |
            latest=false

      - name: Build and push ${{ matrix.image }} image
        id: build
        uses: docker/build-push-action@v2
        with:
          file: Dockerfile-${{ matrix.image }}
          push: true
          tags: ${{ steps.meta.outputs.tags }}
          labels: ${{ steps.meta.outputs.labels }}

      - name: Generate testnet chain specifications
        run: |
          docker run --rm -u root ${{ steps.build.outputs.digest }} build-spec --chain testnet > chain-spec.json
          docker run --rm -u root ${{ steps.build.outputs.digest }} build-spec --chain testnet --raw > chain-spec-raw.json
        if: matrix.image == 'node'

      - name: Upload testnet chain specifictions to artifacts
        uses: actions/upload-artifact@v2
        with:
          name: chain-specifications
          path: |
            chain-spec.json
            chain-spec-raw.json
          if-no-files-found: error
        if: matrix.image == 'node'

      - name: Upload testnet chain specifictions to assets
        uses: alexellis/upload-assets@0.3.0
        env:
          GITHUB_TOKEN: ${{ github.token }}
        with:
          asset_paths: '["chain-spec.json", "chain-spec-raw.json"]'
        if: matrix.image == 'node'

Logs

logs_2035.zip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions