From 84a2a9ce631122fd9fbb53ca57d29b9d3d05afb9 Mon Sep 17 00:00:00 2001 From: lukqw <39307517+lukqw@users.noreply.github.com> Date: Tue, 20 Aug 2024 14:22:25 +0200 Subject: [PATCH] print logs of ephemeral instance after executing preview-cmd (#38) --- ephemeral/startup/action.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/ephemeral/startup/action.yml b/ephemeral/startup/action.yml index e1f7f9a..3a4d999 100644 --- a/ephemeral/startup/action.yml +++ b/ephemeral/startup/action.yml @@ -66,6 +66,7 @@ runs: - name: Create preview environment shell: bash + id: create-instance run: | autoLoadPod="${AUTO_LOAD_POD:-${{ inputs.auto-load-pod }}}" extensionAutoInstall="${EXTENSION_AUTO_INSTALL:-${{ inputs.extension-auto-install }}}" @@ -111,3 +112,14 @@ runs: shell: bash run: ${{ inputs.preview-cmd }} + + - name: Print logs of ephemeral instance + if: ${{ !cancelled() && steps.create-instance.outcome == 'success' }} + shell: bash + run: | + log_response=$(curl -X GET \ + -H "ls-api-key: ${LOCALSTACK_API_KEY:-${{ inputs.localstack-api-key }}}" \ + -H "content-type: application/json" \ + https://api.localstack.cloud/v1/compute/instances/$previewName/logs) + + echo "$log_response" | jq -r '.[].content'