ssh-compute
ssh-compute copied to clipboard
Echo SSH output to the GitHub Action logs
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