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

Remote-ssh-commands task hangs after scripts been executed #1277

Open
yeeyaa opened this issue Jun 12, 2024 · 0 comments
Open

Remote-ssh-commands task hangs after scripts been executed #1277

yeeyaa opened this issue Jun 12, 2024 · 0 comments

Comments

@yeeyaa
Copy link

yeeyaa commented Jun 12, 2024

Expected Behavior

Scripts runs fine in remote-ssh-commands session. When scripts are done, the task should run to complete status.

Actual Behavior

When running a remote-ssh-commands task in one of our pipelines. The defined scripts have been executed as we can see from the log, however, the drone-ssh command won't exit thus causing the taskrun to timeout eventually. Hence causing the pipelinerun to fail.

Steps to Reproduce the Problem

  1. Define some scripts to run using the remote-ssh-commands task

Additional Info

We have even switched using the latest tag for the drone-ssh docker image. Issue still the same.

Our task definition in the pipeline:

    - displayName: Install PAC - BRT
      name: task-install-pac-brt-cluster
      params:
        - name: HOST
          value: $(params.pac-fyre-host)
        - name: USERNAME
          value: $(params.default-brt-login-user)
        - name: SSH_SCRIPT
          value: |
            #!/usr/bin/bash
            $(params.path-to-pipeline-scripts)/install_lsf_brt.sh
            sleep 60
            $(params.path-to-pipeline-scripts)/install_pac_brt.sh
      runAfter:
        - task-build-hpc-package
        - copy-repo-to-remote-host
      taskRef:
        kind: Task
        name: remote-ssh-commands
      timeout: 30m0s
      when:
        - input: $(params.should-run-install-pac-brt-cluster)
          operator: in
          values:
            - 'yes'
            - 'y'
            - 'YES'
            - 'yes'
      workspaces:
        - name: credentials

I have modified the remote-ssh-commands yaml a bit to print some information after the drone-ssh finishes. But the message is never printed on the console.

...
  steps:
    - computeResources: {}
      image: 'docker.io/appleboy/drone-ssh:latest'
      name: ssh
      script: |

        export script="$(params.SSH_SCRIPT)"
        cmd=""
        [[ -f ./privatekey ]] && cmd="$cmd -i ./privatekey"
        [[ -f ./password ]] && cmd="$cmd -P $(cat ./password)"
        [[ -f ./passphrase ]] && cmd="$cmd --ssh-passphrase $(cat ./passphrase)"
        [[ -f ./fingerprint ]] && cmd="$cmd --fingerprint $(cat ./fingerprint)"
        [[ -f ./ciphers ]] && cmd="$cmd --ciphers $(cat ./ciphers)"
        [[ $(params.USE_INSECURE_CIPHER) == "true" ]] && cmd="$cmd --useInsecureCipher true"

        drone-ssh -H $(params.HOST) -p $(params.PORT) -u $(params.USERNAME) -T $(params.COMMAND_TIMEOUT) -s "$script" $cmd
        echo "drome-ssh session finished, ending task."
      workingDir: $(workspaces.credentials.path)
...
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

1 participant