From 1434182888ae3fcb2b978018de2ff9c9256ba19e Mon Sep 17 00:00:00 2001 From: Terence Hampson Date: Thu, 12 Oct 2023 16:31:24 -0400 Subject: [PATCH] Get additional workflow information about diskspace (#29705) * Get additional workflow information about diskspace * Get even more diskspace usage info * Initial attempt at collecting info on disk space within checkout submodule * Fix CI issue * Another attempt to get CI running workflow grabbing diskspace usage * Couple other fixes * Another attempt to get CI running * Try this new approach * quick fix * Dump more info * Few more touch ups * quick fix * Restyle * Restyle * quick fix * quick fix --- .../action.yaml | 5 +++ .github/actions/dump-disk-info/action.yaml | 20 +++++++++ scripts/dump_diskspace_info.sh | 42 +++++++++++++++++++ 3 files changed, 67 insertions(+) create mode 100644 .github/actions/dump-disk-info/action.yaml create mode 100755 scripts/dump_diskspace_info.sh diff --git a/.github/actions/checkout-submodules-and-bootstrap/action.yaml b/.github/actions/checkout-submodules-and-bootstrap/action.yaml index 8226b7e7bd3d41..160e4fac5a5562 100644 --- a/.github/actions/checkout-submodules-and-bootstrap/action.yaml +++ b/.github/actions/checkout-submodules-and-bootstrap/action.yaml @@ -15,6 +15,8 @@ inputs: runs: using: "composite" steps: + - name: Dump disk info + uses: ./.github/actions/dump-disk-info - name: Checkout submodules uses: ./.github/actions/checkout-submodules with: @@ -26,6 +28,9 @@ runs: uses: ./.github/actions/bootstrap with: platform: ${{ inputs.platform }} + - name: Dump disk info after checkout submodule & Bootstrap + shell: bash + run: scripts/dump_diskspace_info.sh - name: Upload Bootstrap Logs uses: ./.github/actions/upload-bootstrap-logs with: diff --git a/.github/actions/dump-disk-info/action.yaml b/.github/actions/dump-disk-info/action.yaml new file mode 100644 index 00000000000000..1f6474e54c4656 --- /dev/null +++ b/.github/actions/dump-disk-info/action.yaml @@ -0,0 +1,20 @@ +name: Dump disk space info +description: Help debug running out of disk space on github CI +runs: + using: "composite" + steps: + - name: Collect disk info + # Unfortunately current syntax for github wrapper actions only work for + # Javascript actions, and Docker container actions, which doesn't make it + # possible to wrap a shell script like the one below. The action below + # essentially wraps the shell commands we want to run into a Javascript + # wrapped action. This allow us to get the disk info usage before a job + # is run and after the job is run regardless if the job succeeds or + # fails. + uses: pyTooling/Actions/with-post-step@v0.4.5 + if: ${{ runner.os == 'Linux' }} + with: + main: |- + exec ./scripts/dump_diskspace_info.sh + post: |- + exec ./scripts/dump_diskspace_info.sh \ No newline at end of file diff --git a/scripts/dump_diskspace_info.sh b/scripts/dump_diskspace_info.sh new file mode 100755 index 00000000000000..2e947f444e746a --- /dev/null +++ b/scripts/dump_diskspace_info.sh @@ -0,0 +1,42 @@ +#!/usr/bin/env bash +# +# Copyright (c) 2023 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# This script is meant to run in github CI to dump information related to +# disk space usage. Currently there is a heisenbug related to running out +# of disk space. Dumping information below might help us get a better +# understanding of how disk space is used in github CI. + +echo "Disk Space Usage:" +df -h + +listOfDirectories=("third_party/" ".environment/" "out/") + +pipCacheDir=$(python -m pip cache dir) +exitcode=$? + +if [ "$exitcode" -eq 0 ]; then + listOfDirectories+=("$pipCacheDir") +fi + +echo +echo "Storage Space Used By Key Directories:" +for directory in "${listOfDirectories[@]}"; do + if [ -d "$directory" ]; then + du -d1 -h "$directory" | sort -h + echo + fi +done