Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting a timeout using the private ssh key on github and keeping public key on remote #285

Open
shikhindahikar opened this issue Dec 22, 2023 · 2 comments

Comments

@shikhindahikar
Copy link

shikhindahikar commented Dec 22, 2023


on:
  workflow_dispatch:
    inputs:
      # IP address of the venue machine
      host:
        description: 'SSH host for the remote machine'
        required: true
      # username of the remote machine
      user:
        description: 'SSH user for authentication'
        required: true

jobs:
  git-pull:
    runs-on: ubuntu-latest
    steps:
    # checkout the code
    - name: Checkout code
      uses: actions/checkout@v4
    # install ssh-agent
    - name: Install ssh-agent
      uses: webfactory/ssh-agent@v0.8.0
      with:
        ssh-private-key: ${{ secrets.REMOTE_SSH_PRIVATE_KEY }}
    # ssh and run the command on the remote server
    - name: Git Pull on Remote Machine
      uses: appleboy/ssh-action@v1.0.0
      with:
        debug: true
        host: ${{ github.event.inputs.host }}
        username: ${{ github.event.inputs.user }}
        key: ${{ secrets.REMOTE_SSH_PRIVATE_KEY }}
        port: 22
        script: |
          cd test-ci-cd
          git pull
          echo "Git Pull on Remote Machine"
        timeout: 15s
      

This is my script and the error is

Run appleboy/ssh-action@v1.0.0
  with:
    debug: true
    host: 192.168.0.109
    username: oz_sports
    key: ***
    port: 22
    script: cd test-ci-cd
  git pull
  echo "Git Pull on Remote Machine"
  
    timeout: 15s
    command_timeout: 10m
    proxy_port: 22
    proxy_timeout: 30s
  env:
    SSH_AUTH_SOCK: /tmp/ssh-XXXXXXxJ479z/agent.1799
    SSH_AGENT_PID: 1800
/usr/bin/docker run --name cbaa8d1b205d0cd4f32a7dc4db38b538675_e6b119 --label 432cba --workdir /github/workspace --rm -e "SSH_AUTH_SOCK" -e "SSH_AGENT_PID" -e "INPUT_DEBUG" -e "INPUT_HOST" -e "INPUT_USERNAME" -e "INPUT_KEY" -e "INPUT_PORT" -e "INPUT_SCRIPT" -e "INPUT_TIMEOUT" -e "INPUT_PASSPHRASE" -e "INPUT_PASSWORD" -e "INPUT_SYNC" -e "INPUT_USE_INSECURE_CIPHER" -e "INPUT_CIPHER" -e "INPUT_COMMAND_TIMEOUT" -e "INPUT_KEY_PATH" -e "INPUT_FINGERPRINT" -e "INPUT_PROXY_HOST" -e "INPUT_PROXY_PORT" -e "INPUT_PROXY_USERNAME" -e "INPUT_PROXY_PASSWORD" -e "INPUT_PROXY_PASSPHRASE" -e "INPUT_PROXY_TIMEOUT" -e "INPUT_PROXY_KEY" -e "INPUT_PROXY_KEY_PATH" -e "INPUT_PROXY_FINGERPRINT" -e "INPUT_PROXY_CIPHER" -e "INPUT_PROXY_USE_INSECURE_CIPHER" -e "INPUT_SCRIPT_STOP" -e "INPUT_ENVS" -e "INPUT_ENVS_FORMAT" -e "INPUT_ALLENVS" -e "HOME" -e "GITHUB_JOB" -e "GITHUB_REF" -e "GITHUB_SHA" -e "GITHUB_REPOSITORY" -e "GITHUB_REPOSITORY_OWNER" -e "GITHUB_REPOSITORY_OWNER_ID" -e "GITHUB_RUN_ID" -e "GITHUB_RUN_NUMBER" -e "GITHUB_RETENTION_DAYS" -e "GITHUB_RUN_ATTEMPT" -e "GITHUB_REPOSITORY_ID" -e "GITHUB_ACTOR_ID" -e "GITHUB_ACTOR" -e "GITHUB_TRIGGERING_ACTOR" -e "GITHUB_WORKFLOW" -e "GITHUB_HEAD_REF" -e "GITHUB_BASE_REF" -e "GITHUB_EVENT_NAME" -e "GITHUB_SERVER_URL" -e "GITHUB_API_URL" -e "GITHUB_GRAPHQL_URL" -e "GITHUB_REF_NAME" -e "GITHUB_REF_PROTECTED" -e "GITHUB_REF_TYPE" -e "GITHUB_WORKFLOW_REF" -e "GITHUB_WORKFLOW_SHA" -e "GITHUB_WORKSPACE" -e "GITHUB_ACTION" -e "GITHUB_EVENT_PATH" -e "GITHUB_ACTION_REPOSITORY" -e "GITHUB_ACTION_REF" -e "GITHUB_PATH" -e "GITHUB_ENV" -e "GITHUB_STEP_SUMMARY" -e "GITHUB_STATE" -e "GITHUB_OUTPUT" -e "RUNNER_OS" -e "RUNNER_ARCH" -e "RUNNER_NAME" -e "RUNNER_ENVIRONMENT" -e "RUNNER_TOOL_CACHE" -e "RUNNER_TEMP" -e "RUNNER_WORKSPACE" -e "ACTIONS_RUNTIME_URL" -e "ACTIONS_RUNTIME_TOKEN" -e "ACTIONS_CACHE_URL" -e "ACTIONS_RESULTS_URL" -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/test-ci-cd/test-ci-cd":"/github/workspace" 432cba:a8d1b205d0cd4f32a7dc4db38b538675
======CMD======
cd test-ci-cd
git pull
echo "Git Pull on Remote Machine"

======END======
======ENV======

======END======
2023/12/22 05:44:19 dial tcp 192.168.0.109:22: i/o timeout

I am able to SSH using my local terminal but on github actions it is giving me a timeout. I have checked multiple times by putting the private key as a secret just in case if I made a mistake but idk what is happening.

Can anyone please help me get this running?

btw I am trying to ssh to a remote machine, not a docker container.

@shikhindahikar
Copy link
Author

Could it be that the name of the input parameter is not key but is ssh-key instead? As per the drone-ssh code here it could be a wrong input parameter. Please do let me know if I am wrong, thanks.

@CoreyJ87
Copy link

I'm having this same issue. It appears that key is the correct parameter. I get Warning: Unexpected input(s) 'ssh-key' with it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants