Skip to content

Commit

Permalink
Get and set container ID as output.
Browse files Browse the repository at this point in the history
Signed-off-by: dblock <dblock@amazon.com>
  • Loading branch information
dblock committed Aug 2, 2024
1 parent f825f1c commit 36ae2ac
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions .github/workflows/test-spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ jobs:
working-directory: .github/opensearch-cluster
run: docker compose up -d

- name: Get Container ID
id: container
run: |
echo "CONTAINER_ID=$(docker ps -aqf "ancestor=opensearchproject/opensearch:${{ matrix.entry.version }}")" >> $GITHUB_OUTPUT
- name: Run Tests
run: |
npm run test:spec -- \
Expand All @@ -69,11 +74,10 @@ jobs:
--coverage coverage/test-spec-coverage-${{ matrix.entry.version }}.json
- name: Get Container Logs
if: failure()
if: failure() && steps.container.outputs.CONTAINER_ID
run: |
CONTAINER_ID=$(docker ps -aqf "ancestor=opensearchproject/opensearch:${{ matrix.entry.version }}")
echo Dumping logs from $CONTAINER_ID ...
docker logs $CONTAINER_ID
echo Dumping logs from ${{ steps.container.outputs.CONTAINER_ID }} ...
docker logs ${{ steps.container.outputs.CONTAINER_ID }}
- name: Upload Test Coverage Results
uses: actions/upload-artifact@v4
Expand Down

0 comments on commit 36ae2ac

Please sign in to comment.