Skip to content

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

Description

@jawnothin

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions