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

Action fails at Execute Over SSH: mkdir -p /github/home/docker-deployment/stacks || true #23

Open
alvarolloret opened this issue Oct 8, 2021 · 6 comments

Comments

@alvarolloret
Copy link

alvarolloret commented Oct 8, 2021

I can0t manage to get after the Execute Over SSH: mkdir -p /github/home/docker-deployment/stacks || true....

This is my action:

      - name: Deploy to Docker swarm
        uses: wshihadeh/docker-deployment-action@v1
        with:
          remote_docker_host: ${{ secrets.HOST_MANAGER }}
          ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }}
          ssh_public_key: ${{ secrets.SSH_PUBLIC_KEY }}
          deployment_mode: docker-swarm
          copy_stack_file: true
          stack_file_name: docker-compose.prod.yaml
          args: docker stack deploy --compose-file $FILE --log-level debug --host $HOST

this is my output:

/usr/bin/docker run --name fa4e140372bcb17b56441a8a806c8e42a5c387_2fe6f5 --label fa4e14 --workdir /github/workspace --rm -e INPUT_REMOTE_DOCKER_HOST -e INPUT_SSH_PRIVATE_KEY -e INPUT_SSH_PUBLIC_KEY -e INPUT_DEPLOYMENT_MODE -e INPUT_COPY_STACK_FILE -e INPUT_STACK_FILE_NAME -e INPUT_ARGS -e INPUT_DEPLOY_PATH -e INPUT_KEEP_FILES -e INPUT_DOCKER_PRUNE -e INPUT_PRE_DEPLOYMENT_COMMAND_ARGS -e INPUT_PULL_IMAGES_FIRST -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RETENTION_DAYS -e GITHUB_RUN_ATTEMPT -e GITHUB_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_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e GITHUB_ACTION_REPOSITORY -e GITHUB_ACTION_REF -e GITHUB_PATH -e GITHUB_ENV -e RUNNER_OS -e RUNNER_NAME -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_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/d2e-frontend/d2e-frontend":"/github/workspace" fa4e14:0372bcb17b56441a8a806c8e42a5c387 docker stack deploy --compose-file $FILE --log-level debug --host $HOST
Registering SSH keys...
Agent pid 12
Identity added: /github/home/.ssh/id_rsa (/github/home/.ssh/id_rsa)
Add known hosts
Execute Over SSH: mkdir -p /github/home/docker-deployment/stacks || true

I can't see where I'm failing.... any help :)

@leaniosci
Copy link

1- no need for this line

args: docker stack deploy --compose-file $FILE --log-level debug --host $HOST

2- make sure that you provided the correct values for ssh_private_key, ssh_public_key and remote_docker_host

@alvarolloret
Copy link
Author

Hello @leaniosci,

I've made sure the three values are set correctly, removed the args value and still getting the same error:

Registering SSH keys...
Agent pid 11
Identity added: /github/home/.ssh/id_rsa (/github/home/.ssh/id_rsa)
Add known hosts
Execute Over SSH: mkdir -p ~//stacks || true
load pubkey "/github/home/.ssh/id_rsa": invalid format
Warning: Permanently added 'xxx,xxxx' (ECDSA) to the list of known hosts.
docker-compose.yml: No such file or directory

It still seems I get invalid format, but I've tried changing to new keys in the server, updating the price key to RSA format, using the public key from known hosts, and still not working. Coult it be that the file name of the key is not the same? I use another filename: id_rsa_key instead of id_rsa.

I've been trying it for several days, but still not getting to it....

@jvalenciag
Copy link

I am getting the same error. I am setting the stack_file_name param with a custom file name.

Registering SSH keys...
Agent pid 12
Identity added: /github/home/.ssh/id_rsa ([email protected])
Add known hosts
Connecting to [email protected]... Command: docker-compose  --log-level debug --host ssh://[email protected]:22 -f docker-compose-deploy.yml up -d
Using configuration files: ./docker-compose-deploy.yml
.FileNotFoundError: [Errno 2] No such file or directory: './docker-compose-deploy.yml'

@elhe26
Copy link

elhe26 commented Aug 3, 2022

FYI, if anyone is having issues with the above error Execute Over SSH: mkdir -p /github/home/docker-deployment/stacks || true, this worked for me:

We have 2 parts: our local machine and the remote server.

  • SSH_PUBLIC_KEY needs the known_host value associated with the server's IP, ie. `if my server's IP address is 120.20.20.1 then I have to look for an entry on the file with this value. Look for it in your local machine.
  • The crucial part is to copy the ssh public key (this key is in our local machine) to the server. You can do it with this command: ssh-copy-id user@host. Using our previous case, ssh-copy-id [email protected].

After implementing these steps, everything works again.

@strazhnyk
Copy link

I have the same error, if I used to ssh-copy function a get fail build without error

@elhe26
Copy link

elhe26 commented Aug 8, 2022

@strazhnyk did you try ssh-copy-id -i ~/.ssh/id_rsa.pub user@host from your local machine?

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

5 participants