Commit 4d11355 1 parent f13ca95 commit 4d11355 Copy full SHA for 4d11355
File tree 1 file changed +19
-5
lines changed
1 file changed +19
-5
lines changed Original file line number Diff line number Diff line change @@ -172,19 +172,33 @@ jobs:
172
172
path : /tmp/shard-logs
173
173
pattern : mega-module-*
174
174
175
- # Cat all the files into one
175
+ # Cat all the files into one, while maintaining their shard
176
176
- run : |
177
- find /tmp/shard-logs -name 'mega-module.tf.json' -exec cat {} + >> logs.tf.json
177
+ find '/tmp/shard-logs' -name 'mega-module.tf.json' | while read file; do
178
+ shard_index=$(echo "$file" | sed -E 's/.*mega-module-([0-9]+)\.tf\.json.*/\1/')
179
+ echo $shard_index
180
+ jq -cr --arg shard_index "$shard_index" '. + {"shard_index":$shard_index}' $file >> logs.tf.json
181
+ done
182
+
183
+ # process the logs
184
+ - run : |
185
+ # Create a file just for errors
186
+ jq -r 'select(.["@level"]=="error")' logs.tf.json > errors.tf.json
178
187
179
188
# Build the markdown table
180
189
- run : |
181
- echo "| Status | Image | Summary | Address |" >> $GITHUB_STEP_SUMMARY
182
- echo "| :-: | ----- | ------- | ------- |" >> $GITHUB_STEP_SUMMARY
190
+ echo "| Status | Shard | Image | Summary | Address |" >> $GITHUB_STEP_SUMMARY
191
+ echo "| :-: | ----- | ----- | ----- -- | ------- |" >> $GITHUB_STEP_SUMMARY
183
192
184
193
# append the rows to the table
185
- export rows="$(jq -r 'select(.["@level"]=="error") | ("| ❌ | " + (.diagnostic.address | split(".")[1]) + " | ```" + .diagnostic.summary + "``` | ```" + .diagnostic.address + "``` |")' logs .tf.json)"
194
+ export rows="$(jq -r '"| ❌ | " + .shard_index + " | " + (.diagnostic.address | split(".")[1]) + " | ```" + .diagnostic.summary + "``` | ```" + .diagnostic.address + "``` |"' errors .tf.json)"
186
195
echo "${rows}"
187
196
188
197
cat >> $GITHUB_STEP_SUMMARY <<EOR
189
198
${rows}
190
199
EOR
200
+
201
+ - name : Error Details
202
+ run : |
203
+ # Print the errors as expandable groups
204
+ jq -r '"::group:: shard: " + .shard_index + " | " + (.diagnostic.address | split(".")[1]) + "\nresource: " + .diagnostic.address + "\n\nsummary: " + .diagnostic.summary + "\n\ndetails:\n\n" + .diagnostic.detail + "\n::endgroup::"' errors.tf.json || true
You can’t perform that action at this time.
0 commit comments