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

When multiple hosts are used everything seems to execute on a single host instead of the intended host #365

Open
jawnothin opened this issue Feb 17, 2025 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@jawnothin
Copy link

Describe the bug

If you have two jobs connecting to two different hosts, it issues all the commands against one of the hosts rather than the intended host.

If I do SSH_HOST_1 and SSH_HOST_2, things seem to work just fine ... but if I do what's described below ... SSH_HOST and JOBS_SSH_HOST ... even though the logs show the right IP, everything just goes to SSH_HOST.

Yaml Config

Please post your Yaml configuration file along with the output results.

# This is a basic workflow that is manually triggered

name: Manual workflow

# Controls when the action will run. Workflow runs when manually triggered using the UI
# or API.
on:
  workflow_dispatch:

env:
  SSH_HOST: '1.2.3.4'
  JOBS_SSH_HOST: '5.6.7.8'
  SSH_USER_1: user
  SSH_USER_2: user

jobs:
  job0:
    runs-on: ubuntu-24.04

    steps:
      - name: Job0
        uses: appleboy/ssh-action@v1.2.0
        with:
          host: ${{ env.SSH_HOST }}
          username: ${{ env.SSH_USER_1 }}
          key: ${{ secrets.DEPLOY_PRIVATE_KEY }}
          script: sleep 5 && touch ~/file0.txt

  job1:
    runs-on: ubuntu-24.04

    needs:
      - job0

    steps:
      - name: Job1
        uses: appleboy/ssh-action@v1.2.0
        with:
          host: ${{ env.SSH_HOST }}
          username: ${{ env.SSH_USER_1 }}
          key: ${{ secrets.DEPLOY_PRIVATE_KEY }}
          script: sleep 5 && touch ~/file1.txt

      - name: Job1b
        uses: appleboy/ssh-action@v1.2.0
        with:
          host: ${{ env.SSH_HOST }}
          username: ${{ env.SSH_USER_1 }}
          key: ${{ secrets.DEPLOY_PRIVATE_KEY }}
          script: sleep 5 && touch ~/file1b.txt

  job2:
    runs-on: ubuntu-24.04

    needs:
      - job0

    steps:
      - name: Job2
        uses: appleboy/ssh-action@v1.2.0
        with:
          host: ${{ env.JOBS_SSH_HOST }}
          username: ${{ env.SSH_USER_2 }}
          key: ${{ secrets.DEPLOY_PRIVATE_KEY }}
          script: sleep 5 && touch ~/file2.txt

      - name: Job2b
        uses: appleboy/ssh-action@v1.2.0
        with:
          host: ${{ env.JOBS_SSH_HOST }}
          username: ${{ env.SSH_USER_2 }}
          key: ${{ secrets.DEPLOY_PRIVATE_KEY }}
          script: sleep 5 && touch ~/file2b.txt
@jawnothin jawnothin added the bug Something isn't working label Feb 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants