Skip to content

Commit b8f1968

Browse files
authored
Collect more logs on nightly failure (#62)
* Collect more logs * Switch to bash key * Ignore failed reads on tar in Circle * Add TEMP and TMPDIR env var export for artifact upload on failure
1 parent dc13016 commit b8f1968

File tree

3 files changed

+29
-9
lines changed

3 files changed

+29
-9
lines changed

.circleci/config.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ jobs:
2424
type: string
2525
executor: <<parameters.os>>
2626
environment:
27-
MATLAB_LOG_DIR: /home/circleci/project/logs
27+
MATLAB_LOG_DIR: /home/circleci/project/mw_logs
28+
MW_INSTALLER_DDUX_LOG: /home/circleci/project/mw_logs/mw_installer_ddux.log
2829
MW_DIAGNOSTIC_DEST: file
2930
MW_DIAGNOSTIC_SPEC: cppmicroservices::framework.*=all;install.*=all;
3031
MW_VERBOSE_HTTPCLIENT_CORE: 1
@@ -46,11 +47,11 @@ jobs:
4647
- matlab/run-tests:
4748
source-folder: code
4849
- run:
49-
command: tar -cvzf matlab-logs.tar /home/circleci/project/logs
50+
command: tar --ignore-failed-read -cvzf mw-logs.tar /home/circleci/project/mw_logs "$TEMP"/mathworks_*.log "$TMPDIR"/mathworks_*.log /tmp/mathworks_*.log
5051
when: on_fail
5152
shell: bash
5253
- store_artifacts:
53-
path: matlab-logs.tar
54+
path: mw-logs.tar
5455
when: on_fail
5556

5657
workflows:

.github/workflows/ci.yml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ jobs:
1818
runs-on: ${{ matrix.os }}
1919

2020
env:
21-
MATLAB_LOG_DIR: ${{ github.workspace }}/logs
21+
MATLAB_LOG_DIR: ${{ github.workspace }}/mw_logs
22+
MW_INSTALLER_DDUX_LOG: ${{ github.workspace }}/mw_logs/mw_installer_ddux.log
2223
MW_DIAGNOSTIC_DEST: file
2324
MW_DIAGNOSTIC_SPEC: cppmicroservices::framework.*=all;install.*=all;
2425
MW_VERBOSE_HTTPCLIENT_CORE: 1
@@ -38,13 +39,24 @@ jobs:
3839
uses: matlab-actions/run-tests@v2
3940
with:
4041
source-folder: code
42+
43+
- name: Export TEMP and TMPDIR env vars for artifact upload
44+
if: ${{ failure() }}
45+
run: |
46+
echo "TEMP=$TEMP" >> $GITHUB_ENV
47+
echo "TMPDIR=$TMPDIR" >> $GITHUB_ENV
48+
shell: bash
4149

4250
- name: Upload MPM and MATLAB logs
4351
if: ${{ failure() }}
4452
uses: actions/upload-artifact@v4
4553
with:
46-
name: matlab-logs-${{ github.job }}-${{ matrix.os }}
47-
path: ${{ env.MATLAB_LOG_DIR }}
54+
name: mw-logs-${{ github.job }}-${{ matrix.os }}
55+
path: |
56+
${{ env.MATLAB_LOG_DIR }}
57+
${{ env.TEMP }}/mathworks_*.log
58+
${{ env.TMPDIR }}/mathworks_*.log
59+
/tmp/mathworks_*.log
4860
if-no-files-found: ignore
4961

5062
- name: Send mail

azure-pipelines-template.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ jobs:
66
pool:
77
vmImage: ${{ image }}
88
variables:
9-
MATLAB_LOG_DIR: $(Build.SourcesDirectory)/logs
9+
MATLAB_LOG_DIR: $(Build.SourcesDirectory)/mw_logs
10+
MW_INSTALLER_DDUX_LOG: $(Build.SourcesDirectory)/mw_logs/mw_installer_ddux.log
1011
MW_DIAGNOSTIC_DEST: file
1112
MW_DIAGNOSTIC_SPEC: cppmicroservices::framework.*=all;install.*=all;
1213
MW_VERBOSE_HTTPCLIENT_CORE: 1
@@ -19,9 +20,15 @@ jobs:
1920
- task: RunMATLABTests@1
2021
inputs:
2122
sourceFolder: code
23+
- bash: |
24+
mkdir -p $(Build.ArtifactStagingDirectory)/mw_logs
25+
cp -r $(MATLAB_LOG_DIR)/* $(Build.ArtifactStagingDirectory)/mw_logs/ || true
26+
cp -v /tmp/mathworks_*.log $(Build.ArtifactStagingDirectory)/mw_logs/ || true
27+
condition: failed()
28+
displayName: Gather MPM and MATLAB logs
2229
- task: PublishBuildArtifacts@1
2330
condition: failed()
2431
inputs:
25-
PathtoPublish: $(MATLAB_LOG_DIR)
26-
ArtifactName: matlab-logs
32+
PathtoPublish: $(Build.ArtifactStagingDirectory)/mw_logs
33+
ArtifactName: mw-logs
2734
displayName: Publish MPM and MATLAB logs

0 commit comments

Comments
 (0)