ssh-compute icon indicating copy to clipboard operation
ssh-compute copied to clipboard

Output of ssh command

Open itsmesuniljacob opened this issue 1 year ago • 1 comments

TL;DR

Is there a way to get output of commands?

    - id: 'compute-ssh'
      uses: 'google-github-actions/ssh-compute@v0'
      with:
        instance_name: test-instance
        zone: asia-south1-c
        ssh_private_key: '${{ secrets.SSH_KEY }}'
        command: 'composer -V'

Expected behavior

composer -V
Composer version 2.4.4 2022-10-27 14:39:29

Observed behavior

No output

Action YAML

name: Build and Deploy to GCE
on:
  workflow_dispatch:
      inputs:
        logLevel:
          description: environment   
          required: true
          default: stg

env:
  PROJECT_ID: ${{ secrets.GCP_PROJECT }}
  GCE_INSTANCE: test-instance
  GCE_INSTANCE_ZONE: asia-south1-c

jobs:
  setup-build-publish-deploy:
    name: Setup, Build, Publish, and Deploy
    runs-on: ubuntu-latest

    # Add "id-token" with the intended permissions.
    permissions:
      contents: 'read'
      id-token: 'write'

    steps:
    - name: Checkout
      uses: actions/checkout@v3

    # Alternative option - authentication via credentials json
    - id: 'auth'
      uses: 'google-github-actions/auth@v1'
      with:
        credentials_json: '${{ secrets.CREDENTIALS_VM_STG }}'

    - id: 'compute-ssh'
      uses: 'google-github-actions/ssh-compute@v0'
      with:
        instance_name: test-instance
        zone: asia-south1-c
        ssh_private_key: '${{ secrets.SSH_KEY }}'
        command: 'composer -V'


### Log output

```text
Running: gcloud compute ssh test-instance --zone asia-south1-c --ssh-key-file /tmp/0bbff49169572489822e4f40/google_compute_engine --quiet --tunnel-through-iap --command bash -c "composer -V"


### Additional information

Is there anyway to get output?

itsmesuniljacob avatar Nov 25 '22 05:11 itsmesuniljacob

This is in the readme file, look for "Example of using the output" in the yaml sample code.

barend avatar Apr 07 '23 12:04 barend