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

Echo SSH output to the GitHub Action logs #29

Open
teor2345 opened this issue Oct 7, 2022 · 0 comments
Open

Echo SSH output to the GitHub Action logs #29

teor2345 opened this issue Oct 7, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@teor2345
Copy link

teor2345 commented Oct 7, 2022

TL;DR

Add a show_ssh_output input to the action, which shows the SSH stdout and stderr in the GitHub Action logs. Ideally, the output should be shown live, as it arrives over SSH.

Detailed design

This feature allows the ssh-compute action to replace a manual call to gcloud compute ssh, which echoes the SSH output as it arrives, and has no output size limits.

Example usage:

jobs:
  job_id:
    permissions:
      contents: 'read'
      id-token: 'write'

    steps:
    - uses: 'actions/checkout@v2'

    - id: 'auth'
      uses: 'google-github-actions/auth@v0'
      with:
        workload_identity_provider: 'projects/123456789/locations/global/workloadIdentityPools/my-pool/providers/my-provider'
        service_account: '[email protected]'

    - id: 'compute-ssh'
      uses: 'google-github-actions/ssh-compute@v0'
      with:
        instance_name: 'example-instance'
        zone: 'us-central1-a'
        ssh_private_key: '${{ secrets.GCP_SSH_PRIVATE_KEY }}'
        command: 'echo Hello world'
        show_ssh_output: true

Expected behaviour:

Hello world is echoed live by the compute-ssh step, without the need for an extra step.

Additional information

GitHub Actions outputs are limited to 1 MB, so they can't be used for large logs:
https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#outputs-for-docker-container-and-javascript-actions

One alternative is using artifacts, but they aren't available live, only after the job has finished:
https://docs.github.com/en/actions/using-workflows/storing-workflow-data-as-artifacts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

No branches or pull requests

1 participant