appleboy / drone-ssh

Drone plugin for executing remote ssh commands
MIT License
251 stars 74 forks source link

getKeyFile error: permission denied #271

Open siwa-pparzer opened 8 months ago

siwa-pparzer commented 8 months ago
latest: Pulling from appleboy/drone-ssh
Digest: sha256:189b2b76131cbb0e62b09621c3d0a0f9aed39dc3bb7aca8a2c117b7c15bb972b
Status: Image is up to date for appleboy/drone-ssh:latest
======CMD======
execution command
======END======
2024/02/05 06:59:34 getKeyFile error: open /root/.ssh/id_rsa: permission denied
2024/02/05 06:59:34 ssh: handshake failed: ssh: unable to authenticate, attempted methods [none], no supported methods remain

config:

kind: pipeline
type: docker
name: default

platform:
  os: linux
  arch: arm64

steps:
  - name: build
    image: docker:dind
    volumes:
      - name: dockersock
        path: /var/run/docker.sock
      - name: ssh
        path: /root/.ssh/id_rsa
      - name: buildx
        path: /root/.docker/buildx
    when:
      branch:
        - master
    environment:
      REGISTRY_URL: xxx
    commands:
      - cat /root/.ssh/id_rsa

  - name: deploy
    image: appleboy/drone-ssh
    volumes:
      - name: ssh
        path: /root/.ssh/id_rsa
    when:
      branch:
        - master
    environment:
      REGISTRY_URL: xxx
      SERVER_PATH: xxx
    settings:
      host:
        - xxx
      port: xxx
      username: root
      key_path: /root/.ssh/id_rsa
      envs: [SERVER_PATH, REGISTRY_URL]
      script:
        - execution script
volumes:
  - name: dockersock
    host:
      path: /var/run/docker.sock
  - name: ssh
    host:
      path: /root/.ssh/id_rsa
  - name: buildx
    host:
      path: /root/.docker/buildx

trigger:
  branch:
    - master

When I try to read /root/.ssh/id_rsa in the build steps, I get the key without problem. Setup has been working for 2 years now, suddenly it breaks.