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

script_stop: true mess up cat command #335

Open
uchar opened this issue Sep 4, 2024 · 3 comments
Open

script_stop: true mess up cat command #335

uchar opened this issue Sep 4, 2024 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@uchar
Copy link

uchar commented Sep 4, 2024

Describe the bug

When I use script_stop: true the output of the cat command becomes

    {
              "RESTORE_BACKUP": "$RESTORE_BACKUP",
              "FTP_HOST": "$FTP_HOST",
              DRONE_SSH_PREV_COMMAND_EXIT_CODE=0 ; if [ 0 -ne 0 ]; then exit 0; fi;
             {
              DRONE_SSH_PREV_COMMAND_EXIT_CODE=0 ; if [ 0 -ne 0 ]; then exit 0; fi;

Yaml Config

      - name: Clone project and run docker
        uses: appleboy/ssh-action@master
        env:
          FTP_HOST: ${{ secrets.FTP_HOST }}
          RESTORE_BACKUP: ${{ github.event.inputs.restoreBackup }}
        with:
          command_timeout: 60m
          script_stop: true
          host: ${{ secrets.SSH_HOST }}
          username: ${{ secrets.SSH_USER }}
          key: ${{ secrets.SSH_PRIVATE_KEY }}
          port: ${{ secrets.SSH_PORT }}
          envs: FTP_HOST,RESTORE_BACKUP
          script: |
            cat <<EOF > ./inputsData/deployEnvs.json
            {
              "RESTORE_BACKUP": "$RESTORE_BACKUP",
              "FTP_HOST": "$FTP_HOST",
            }
            EOF

it works fine without script_stop: true

@uchar uchar added the bug Something isn't working label Sep 4, 2024
@ArtemGoutsoul
Copy link

ArtemGoutsoul commented Sep 13, 2024

bumped into the same issue when using ssh-action to update nginx configs remotely

this bug makes HEREDOC unusable in this context :(

as a workaround I had to convert the HEREDOC into one-liner which greatly reduced the readability of the workflow

@georgique
Copy link

I can confirm that if statements are not working correctly with script_stop=true.

Script:

echo "TMP TESTING IF"
if [[ "2" == "1" ]]; then
  echo "True"
else
  echo "False"
fi

Output:

out: TMP TESTING IF
2024/09/24 21:19:30 Process exited with status 1

Script:

echo "TMP TESTING IF"
if [[ "1" == "1" ]]; then
  echo "True"
else
  echo "False"
fi

Output:

out: TMP TESTING IF
out: True
2024/09/24 21:20:40 Process exited with status 1

@appleboy
Copy link
Owner

I will disable the script_stop flag on the next version.

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

4 participants