webfactory / ssh-agent

GitHub Action to setup `ssh-agent` with a private key
MIT License
1.22k stars 253 forks source link

ERROR: stat "": no such file or directory #194

Open chester-personaify opened 1 year ago

chester-personaify commented 1 year ago

Running into this weird error when trying to use with Github action to build a docker container

This is the output error logs (some parts redacted):

Run webfactory/ssh-agent@v0.8.0  
Starting ssh-agent
SSH_AUTH_SOCK=/tmp/ssh-XXXXXXK8W2BZ/agent.2180
SSH_AGENT_PID=2181
Adding private key(s) to agent
Identity added: (stdin) (https://github.com/owner/repo)
Key(s) added:
25[6](https://github.com/owner/repo/actions/runs/.../job/...#step:4:6) SHA25[6](https://github.com/owner/repo/actions/runs/.../job/...#step:4:7):... https://github.com/owner/repo (ED25519)
Configuring deployment key(s)
Added deploy-key mapping: ....

....

Buildx version
  /usr/bin/docker buildx version
  github.com/docker/buildx v0.11.2 9872040
/usr/bin/docker buildx build --file ./Dockerfile --iidfile /tmp/docker-build-push-l5b75b/iidfile --provenance false --secret id=GIT_AUTH_TOKEN,src=/tmp/docker-build-push-l5b75b/tmp-2407-B4eeUuOAcea7 --ssh default="" --tag ***.azurecr.io/rest:c0f74278aeeb4fd5044441f1938f927fc64f7409 --tag ***.azurecr.io/rest:latest --metadata-file /tmp/docker-build-push-l5b75b/metadata-file --push https://github.com/owner/repo.git#c0f74278aeeb4fd5044441f1938f927fc64f7409
ERROR: stat "": no such file or directory
Error: buildx failed with: ERROR: stat "": no such file or directory

Here's my yml file:

jobs:
  build:
    runs-on: 'ubuntu-latest'

    steps:
    - name: Set up Docker Buildx
      uses: docker/setup-buildx-action@v3

    - name: Log in to registry
      uses: docker/login-action@v3
      with:
        registry: https://regname.azurecr.io/
        username: ${{ secrets.AzureAppService_ContainerUsername }}
        password: ${{ secrets.AzureAppService_ContainerPassword }}

    - name: Setup ssh-agent
      uses: webfactory/ssh-agent@v0.8.0
      with:
          ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}

    - name: replace requirements
       run: sed -i "s/https:\/\/git@github\.com/ssh:\/\/git@github\.com/g" requirements.txt

    - name: Build and push container image to registry
      uses: docker/build-push-action@v3
      with:
        ssh: |
          default="${{ secrets.SSH_AUTH_SOCK }}"
        push: true
        tags: regname.azurecr.io/rest:${{ github.sha }}, regname.azurecr.io/rest:latest
        file: ./Dockerfile

1) I've added the public ssh key as a deploy key to the github repo 2) I've added the private ssh key as a secret in the repo SSH_PRIVATE_KEY 3) I've tried using docker/build-push-action@v2 instead of v3.

Does anyone know what's going on?