Upload docker and druid service logs as artifacts on GitHub Actions IT run failure (#14967)

With this PR, docker and druid service logs are uploaded as artifacts onto GitHub when an IT job fails so that we can later download them for investigation.
This commit is contained in:
Tejaswini Bandlamudi 2023-09-13 11:32:04 +05:30 committed by GitHub
parent 23b78c0f95
commit b7bb5ee1db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 60 additions and 7 deletions

View File

@ -133,3 +133,35 @@ jobs:
- name: Run IT
run: ${{ inputs.script }}
- name: Collect docker logs on failure
if: ${{ failure() && steps.run-it.conclusion == 'failure' }}
run: |
for c in $(docker ps -a --format="{{.Names}}")
do
docker logs $c > ./docker-logs/$c.log
done
- name: Tar docker logs
if: ${{ failure() && steps.run-it.conclusion == 'failure' }}
run: tar cvzf ./docker-logs.tgz ./docker-logs
- name: Upload docker logs to GitHub
if: ${{ failure() && steps.run-it.conclusion == 'failure' }}
uses: actions/upload-artifact@master
with:
name: IT-${{ inputs.it }} docker logs (Compile=jdk${{ inputs.build_jdk }}, Run=jdk${{ inputs.runtime_jdk }}, Indexer=${{ inputs.use_indexer }}, Mysql=${{ inputs.mysql_driver }})
path: docker-logs.tgz
- name: Collect service logs on failure
if: ${{ failure() && steps.run-it.conclusion == 'failure' }}
run: |
docker cp middlemanager:/shared/logs/ ./service-logs
tar cvzf ./service-logs.tgz ./service-logs
- name: Upload Druid service logs to GitHub
if: ${{ failure() && steps.run-it.conclusion == 'failure' }}
uses: actions/upload-artifact@master
with:
name: IT-${{ inputs.it }} service logs (Compile=jdk${{ inputs.build_jdk }}, Run=jdk${{ inputs.runtime_jdk }}, Indexer=${{ inputs.use_indexer }}, Mysql=${{ inputs.mysql_driver }})
path: service-logs.tgz

View File

@ -88,13 +88,34 @@ jobs:
echo "${MVN} verify -pl integration-tests -P integration-tests ${{ inputs.testing_groups }} -Djvm.runtime=${{ inputs.runtime_jdk }} -Dit.indexer=${{ inputs.use_indexer }} ${MAVEN_SKIP} -Doverride.config.path=${{ inputs.override_config_path }}"
${MVN} verify -pl integration-tests -P integration-tests ${{ inputs.testing_groups }} -Djvm.runtime=${{ inputs.runtime_jdk }} -Dit.indexer=${{ inputs.use_indexer }} ${MAVEN_SKIP} -Doverride.config.path=${{ inputs.override_config_path }}
- name: Debug IT
- name: Collect docker logs on failure
if: ${{ failure() && steps.run-it.conclusion == 'failure' }}
run: |
for v in broker router ${{ inputs.use_indexer }} historical coordinator overlord; do
echo "=======================druid-"$v"========================";
echo "-----------------------docker logs-----------------------";
sudo docker logs druid-"$v" 2>&1 | tail -1000 ||:;
echo "-----------------------service logs----------------------";
sudo docker exec druid-"$v" tail -1000 /shared/logs/"$v".log 2>&1 ||:;
for c in $(docker ps -a --format="{{.Names}}")
do
docker logs $c > ./docker-logs/$c.log
done
- name: Tar docker logs
if: ${{ failure() && steps.run-it.conclusion == 'failure' }}
run: tar cvzf ./docker-logs.tgz ./docker-logs
- name: Upload docker logs to GitHub
if: ${{ failure() && steps.run-it.conclusion == 'failure' }}
uses: actions/upload-artifact@master
with:
name: IT-${{ inputs.group }} docker logs (Compile=jdk${{ inputs.build_jdk }}, Run=jdk${{ inputs.runtime_jdk }}, Indexer=${{ inputs.use_indexer }}, Mysql=${{ inputs.mysql_driver }})
path: docker-logs.tgz
- name: Collect service logs on failure
if: ${{ failure() && steps.run-it.conclusion == 'failure' }}
run: |
docker cp druid-middlemanager:/shared/logs/ ./service-logs
tar cvzf ./service-logs.tgz ./service-logs
- name: Upload Druid service logs to GitHub
if: ${{ failure() && steps.run-it.conclusion == 'failure' }}
uses: actions/upload-artifact@master
with:
name: IT-${{ inputs.group }} service logs (Compile=jdk${{ inputs.build_jdk }}, Run=jdk${{ inputs.runtime_jdk }}, Indexer=${{ inputs.use_indexer }}, Mysql=${{ inputs.mysql_driver }})
path: service-logs.tgz