Skip to content

Commit

Permalink
automataCI: added checksum safety against directory targets
Browse files Browse the repository at this point in the history
There may be possibilities of directories being as one of the
package target (e.g. PyPi). Hence, the checksum function must have
a safety check against such scenario. Let's do this.

This patch adds safety check against directory-type targets during
Release Job checkum executions.

Co-authored-by: Galyna, Cory <[email protected]>
Co-authored-by: (Holloway) Chew, Kean Ho <[email protected]>
Signed-off-by: (Holloway) Chew, Kean Ho <[email protected]>
  • Loading branch information
hollowaykeanho and corygalyna committed Sep 22, 2023
1 parent a4234c9 commit 8b0b994
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions automataCI/_release-functions_unix-any.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ RELEASE::run_checksum_seal() {

# shasum all files
for TARGET in "${PROJECT_PATH_ROOT}/${PROJECT_PATH_PKG}"/*; do
if [ -d "$TARGET" ]; then
OS::print_status warning "${TARGET} is a directory. Skipping...\n"
continue
fi

if [ ! -z "$PROJECT_RELEASE_SHA256" ]; then
OS::print_status info "sha256 checksuming $TARGET\n"
__value="$(SHASUM::create_file "$TARGET" "256")"
Expand Down
5 changes: 5 additions & 0 deletions automataCI/_release-functions_windows-any.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ function RELEASE-Run-Checksum-Seal {

# shasum all files
foreach ($TARGET in (Get-ChildItem -Path "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_PKG}")) {
if (Test-Path -PathType Container -Path "${TARGET}") {
OS-Print-Status warning "${TARGET} is a directory. Skipping..."
continue
}

if (-not ([string]::IsNullOrEmpty(${env:PROJECT_RELEASE_SHA256}))) {
OS-Print-Status info "sha256 checksuming ${TARGET}"
$__value = SHASUM-Checksum-File $TARGET.FullName "256"
Expand Down

0 comments on commit 8b0b994

Please sign in to comment.