forked from berkshelf/berkshelf
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add version check in hab environment
Signed-off-by: Sachin <[email protected]>
- Loading branch information
Sachin
committed
Dec 3, 2024
1 parent
7e6fe7a
commit b1dc5fb
Showing
2 changed files
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
Write-Host "--- :fire: Smokish test" | ||
# Pester the Package | ||
$version=hab pkg exec "${pkg_ident}" berks -v | ||
$actual_version=[Regex]::Match($version,"([0-9]+.[0-9]+.[0-9]+)").Value | ||
$package_version=$PackageIdentifier.split("/",4)[2] | ||
|
||
Write-Host "package_version $package_version actual version $actual_version" | ||
if ($package_version -eq $actual_version) | ||
{ | ||
Write "Berkshelf working fine" | ||
} | ||
else { | ||
Write-Error "Berkshelf version not met expected $package_version actual version $actual_version " | ||
throw "Berkshelf windows pipeline not working for hab pkg" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
set -euo pipefail | ||
|
||
|
||
project_root="$(git rev-parse --show-toplevel)" | ||
|
||
# print error message followed by usage and exit | ||
error () { | ||
local message="$1" | ||
|
||
echo -e "\nERROR: ${message}\n" >&2 | ||
|
||
exit 1 | ||
} | ||
|
||
[[ -n "$pkg_ident" ]] || error 'no hab package identity provided' | ||
|
||
package_version=$(awk -F / '{print $3}' <<<"$pkg_ident") | ||
|
||
cd "${project_root}" | ||
|
||
echo "--- :mag_right: Testing ${pkg_ident} executables" | ||
actual_version=$(hab pkg exec "${pkg_ident}" berks -v | sed -E 's/.*: ([0-9]+\.[0-9]+\.[0-9]+).*/\1/') | ||
[[ "$package_version" = "$actual_version" ]] || error "Berkshelf version is not the expected version. Expected '$package_version', got '$actual_version'" |