Skip to content

Commit

Permalink
Merge pull request #423 from chef/ashique/test-hab-pipelines
Browse files Browse the repository at this point in the history
Fixing the buildkite pipelines for hab
  • Loading branch information
ashiqueps authored Dec 10, 2024
2 parents 98fe9b7 + 6964e66 commit 11619ce
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 20 deletions.
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

0 comments on commit 11619ce

Please sign in to comment.