Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing the buildkite pipelines for hab #423

Merged
merged 14 commits into from
Dec 10, 2024
Merged
11 changes: 2 additions & 9 deletions .expeditor/buildkite/artifact.habitat.test.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,8 @@ Write-Host "+++ Testing $Plan"
Push-Location $project_root

try {
Write-Host "Running unit tests..."
hab pkg exec "${pkg_ident}" rake unit

If ($lastexitcode -ne 0) {
Write-Host "Rake unit tests failed!" -ForegroundColor Red
Exit $lastexitcode
} else {
Write-Host "Rake unit tests passed!" -ForegroundColor Green
}
$scriptPath = Join-Path $project_root "habitat/tests/test.ps1"
& $scriptPath $pkg_ident
}
finally {
# Ensure we always return to the original directory
Expand Down
2 changes: 1 addition & 1 deletion .expeditor/buildkite/artifact.habitat.test.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,4 @@ export PATH
echo "PATH is $PATH"

echo "--- :mag_right: Testing $PLAN"
${project_root}/habitat/tests/test.sh "$pkg_ident" || error 'failures during test of executables'
"${project_root}/habitat/tests/test.sh" "$pkg_ident"
19 changes: 12 additions & 7 deletions .expeditor/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,12 @@

# Slack channel in Chef Software slack to send notifications about build failures, etc
slack:
notify_channel: chef-infra-notify
notify_channel: chef-ws-notify

# This publish is triggered by the `built_in:publish_rubygems` artifact_action.
rubygems:
- chef-vault

release_branches:
- workstation-LTS:
version_constraint: 4.*
- main:
version_constraint: 4.*

github:
# This deletes the GitHub PR branch after successfully merged into the release branch
delete_branch_on_merge: true
Expand All @@ -27,6 +21,12 @@ github:
major_bump_labels:
- "Expeditor: Bump Version Major"

release_branches:
- workstation-LTS:
version_constraint: 4.*
- main:
version_constraint: 4.*

changelog:
rollup_header: Changes not yet released to rubygems.org

Expand All @@ -46,6 +46,11 @@ subscriptions:
- "Expeditor: Skip All"
- built_in:build_gem:
only_if: built_in:bump_version
- trigger_pipeline:habitat/test:
only_if: built_in:bump_version
ignore_labels:
- "Expeditor: Skip Habitat"
- "Expeditor: Skip All"
- trigger_pipeline:habitat/build:
only_if: built_in:bump_version
ignore_labels:
Expand Down
4 changes: 2 additions & 2 deletions .expeditor/habitat-test.pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ expeditor:

steps:

- label: ":linux: Validate Habitat Builds of Test Kitchen"
- label: ":linux: Validate Habitat Builds of Chef-vault"
commands:
- .expeditor/buildkite/artifact.habitat.test.sh
expeditor:
Expand All @@ -18,7 +18,7 @@ steps:
image: ruby:3.1
privileged: true

- label: ":windows: Validate Habitat Builds of Test Kitchen"
- label: ":windows: Validate Habitat Builds of Chef-vault"
commands:
- .expeditor/buildkite/artifact.habitat.test.ps1
expeditor:
Expand Down
2 changes: 1 addition & 1 deletion .expeditor/run_windows_tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ If ($lastexitcode -ne 0) { Exit $lastexitcode }
Write-Output "--- Bundle Execute"

bundle exec rake
If ($lastexitcode -ne 0) { Exit $lastexitcode }
If ($lastexitcode -ne 0) { Exit $lastexitcode }
22 changes: 22 additions & 0 deletions habitat/tests/test.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
param (
[Parameter()]
[string]$PackageIdentifier = $(throw "Usage: test.ps1 [test_pkg_ident] e.g. test.ps1 ci/user-windows/1.0.0/20190812103929")
)


Write-Host "--- :fire: Smokish test"
# Pester the Package
$help_message=hab pkg exec "${pkg_ident}" -- chef-vault -h
$original_message="Usage: chef-vault"

Write-Host "Checking the help message of the package"
Write-Host "Expected: $original_message"
Write-Host "Actual: $help_message"
if ($help_message -like "*$original_message*")
{
Write "Chef-vault is working fine"
}
else {
Write-Error "chef-vault binary doesn't return the correct usage message "
throw "Chef-vault windows pipeline not working for hab pkg"
}
1 change: 1 addition & 0 deletions habitat/tests/test.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
set -euo pipefail

project_root="$(git rev-parse --show-toplevel)"
pkg_ident="$1"

# print error message followed by usage and exit
error () {
Expand Down