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

Test pr to test expeditor validation #432

Closed
wants to merge 48 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
062a032
added plan.sh and plan.ps1 to build chef-vault as hab package
nikhil2611 Sep 9, 2024
a4775f9
updating min ruby version to 3.1
nikhil2611 Sep 9, 2024
764a668
updated plan.sh
nikhil2611 Sep 23, 2024
fe2b295
updated gemspec and version.rb
nikhil2611 Sep 23, 2024
bba07ed
updated the plan file for linux
nikhil2611 Dec 3, 2024
59741b7
updated the plan file for win
nikhil2611 Dec 3, 2024
3ed8ff9
reverted the version
nikhil2611 Dec 3, 2024
ccc80c4
Merge pull request #413 from chef/nikhil-CHEF-14471-chef-vault-hab-pa…
nikhil2611 Dec 4, 2024
ab33aec
Automated pipelines for the build and publish hab pkgs
ashiqueps Dec 5, 2024
974b728
Committed config for testing
ashiqueps Dec 5, 2024
1e130d8
Linting updates
ashiqueps Dec 5, 2024
683c0b2
Linting updates
ashiqueps Dec 5, 2024
5d73c08
Subscription changes
ashiqueps Dec 5, 2024
99d777d
Linting updates
ashiqueps Dec 5, 2024
3849995
Added the release branch config
ashiqueps Dec 5, 2024
98fe9b7
Merge pull request #419 from chef/CHEF-17477-buildkite-automated-pipe…
ashiqueps Dec 6, 2024
ed39cde
Merge branch 'workstation-LTS' of github.com:chef/chef-vault into ash…
ashiqueps Dec 9, 2024
0d96d14
Config updates
ashiqueps Dec 9, 2024
15bb959
Pipeline fixes
ashiqueps Dec 9, 2024
c9b3530
Test updates
ashiqueps Dec 9, 2024
a6111f0
Fixed the verify tests for windows
ashiqueps Dec 9, 2024
d82159d
Testing the linux habitat verify test
ashiqueps Dec 9, 2024
71a2091
Fixed the issue with the shell script parameter
ashiqueps Dec 9, 2024
1581903
Removed the logs added for testing
ashiqueps Dec 9, 2024
6964e66
Updated the file permissions and changed the notify channel
ashiqueps Dec 10, 2024
11619ce
Merge pull request #423 from chef/ashique/test-hab-pipelines
ashiqueps Dec 10, 2024
5e3f3ff
Test commit for pipeline testing - 1
ashiqueps Dec 10, 2024
b3b66f2
Merge pull request #424 from chef/ashique/test-hab-pipelines
ashiqueps Dec 10, 2024
17cb3d9
Bump version to 4.1.14 by Chef Expeditor
chef-ci Dec 10, 2024
d834206
removed the manually created pipelines and added the channels
nikhil2611 Jan 6, 2025
2d73a04
added the workload to promote packages
nikhil2611 Jan 6, 2025
bad9d07
Merge pull request #425 from chef/removing_pipelines
sanghinitin Jan 6, 2025
01e9e9e
Bump version to 0.1.0 by Chef Expeditor
chef-ci Jan 6, 2025
a834141
added the pipelines to get create automatically
nikhil2611 Jan 6, 2025
c9a0b09
updated the workload
nikhil2611 Jan 6, 2025
3072511
updated the workload
nikhil2611 Jan 6, 2025
8237aaa
Merge pull request #426 from chef/adding_pipelines
sanghinitin Jan 6, 2025
92809fe
Bump version to 0.1.1 by Chef Expeditor
chef-ci Jan 6, 2025
0edf8e7
empty commit to test pipelines
nikhil2611 Jan 6, 2025
9d42d45
Merge pull request #427 from chef/test_pipeline
sanghinitin Jan 6, 2025
4ff900c
Bump version to 0.1.2 by Chef Expeditor
chef-ci Jan 6, 2025
32f8dfd
Chef-18535 Removed the release branch changes and fixed pipeline (#428)
nikhil2611 Jan 23, 2025
9cc13de
updated workload and removed release branch
nikhil2611 Jan 23, 2025
29c0026
test pr to test the expeditor validation
nikhil2611 Jan 23, 2025
3081ec4
test pr to test the expeditor validation
nikhil2611 Jan 23, 2025
5fcf4f0
test pr to test the expeditor validation
nikhil2611 Jan 23, 2025
dacb7b4
testing expeditor validation
nikhil2611 Jan 23, 2025
b6da1b6
testing expeditor validation
nikhil2611 Jan 23, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .expeditor/build.habitat.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
env:
HAB_REFRESH_CHANNEL: "LTS-2024"

origin: chef

expeditor:
defaults:
buildkite:
retry:
automatic:
limit: 1
84 changes: 84 additions & 0 deletions .expeditor/buildkite/artifact.habitat.test.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
#!/usr/bin/env powershell

#Requires -Version 5
# https://stackoverflow.com/questions/9948517
# TODO: Set-StrictMode -Version Latest
$PSDefaultParameterValues['*:ErrorAction']='Stop'
$ErrorActionPreference = 'Stop'
$env:HAB_ORIGIN = 'ci'
$env:CHEF_LICENSE = 'accept-no-persist'
$env:HAB_LICENSE = 'accept-no-persist'
$Plan = 'chef-vault'

Write-Host "--- system details"
$Properties = 'Caption', 'CSName', 'Version', 'BuildType', 'OSArchitecture'
Get-CimInstance Win32_OperatingSystem | Select-Object $Properties | Format-Table -AutoSize

Write-Host "--- Installing the version of Habitat required"

function Stop-HabProcess {
$habProcess = Get-Process hab -ErrorAction SilentlyContinue
if ($habProcess) {
Write-Host "Stopping hab process..."
Stop-Process -Name hab -Force
}
}

function Install-Habitat {
Write-Host "Downloading and installing Habitat..."
Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/habitat-sh/habitat/main/components/hab/install.ps1'))
}

try {
hab --version
}
catch {
Set-ExecutionPolicy Bypass -Scope Process -Force

Stop-HabProcess

# Remove the existing hab.exe if it exists and if you have permissions
$habPath = "C:\ProgramData\Habitat\hab.exe"
if (Test-Path $habPath) {
Write-Host "Attempting to remove existing hab.exe..."
Remove-Item $habPath -Force -ErrorAction SilentlyContinue
if (Test-Path $habPath) {
Write-Host "Failed to remove hab.exe, re-running script with elevated permissions."
Start-Process powershell -Verb runAs -ArgumentList "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`""
exit
}
}

Install-Habitat
}
finally {
Write-Host ":habicat: I think I have the version I need to build."
}


Write-Host "--- Generating fake origin key"
hab origin key generate $env:HAB_ORIGIN

Write-Host "--- Building $Plan"
$project_root = "$(git rev-parse --show-toplevel)"
Set-Location $project_root

$env:DO_CHECK=$true; hab pkg build .

. $project_root/results/last_build.ps1

Write-Host "--- Installing $pkg_ident/$pkg_artifact"
hab pkg install -b $project_root/results/$pkg_artifact

Write-Host "+++ Testing $Plan"

Push-Location $project_root

try {
$scriptPath = Join-Path $project_root "habitat/tests/test.ps1"
& $scriptPath $pkg_ident
}
finally {
# Ensure we always return to the original directory
Pop-Location
}
70 changes: 70 additions & 0 deletions .expeditor/buildkite/artifact.habitat.test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#!/usr/bin/env bash

set -eo pipefail

export HAB_ORIGIN='ci'
export PLAN='chef-vault'
export CHEF_LICENSE="accept-no-persist"
export HAB_LICENSE="accept-no-persist"

echo "--- checking if git is installed"
if ! command -v git &> /dev/null; then
echo "Git is not installed. Installing Git..."
sudo yum install -y git
else
echo "Git is already installed."
git --version
fi

echo "--- add an exception for this directory since detected dubious ownership in repository at /workdir"
git config --global --add safe.directory /workdir

echo "--- git status for this workdir"
git status

echo "--- ruby version"
ruby -v

export project_root="$(git rev-parse --show-toplevel)"
echo "The value for project_root is: $project_root"

export HAB_NONINTERACTIVE=true
export HAB_NOCOLORING=true
export HAB_STUDIO_SECRET_HAB_NONINTERACTIVE=true

echo "--- system details"
uname -a

echo "--- Installing Habitat"
id -a
curl https://raw.githubusercontent.com/habitat-sh/habitat/main/components/hab/install.sh | bash

echo "--- :key: Generating fake origin key"
hab origin key generate "$HAB_ORIGIN"


echo "--- Building $PLAN"
cd "$project_root"
DO_CHECK=true hab pkg build .

echo "--- Sourcing 'results/last_build.sh'"
if [ -f ./results/last_build.env ]; then
cat ./results/last_build.env
. ./results/last_build.env
export pkg_artifact
fi

echo "+++ Installing ${pkg_ident:?is undefined}"
echo "++++"
echo $project_root
echo "+++"
hab pkg install -b "${project_root:?is undefined}/results/${pkg_artifact:?is undefined}"

echo "+++ Testing $PLAN"

PATH="$(hab pkg path ci/chef-vault)/bin:$PATH"
export PATH
echo "PATH is $PATH"

echo "--- :mag_right: Testing $PLAN"
"${project_root}/habitat/tests/test.sh" "$pkg_ident"
45 changes: 38 additions & 7 deletions .expeditor/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,15 @@

# 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.*
artifact_channels:
- unstable
- chef-dke-lts2024

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

release_branches:
- main:
version_constraint: 4.*

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

Expand All @@ -46,12 +48,41 @@ subscriptions:
- "Expeditor: Skip All"
- built_in:build_gem:
only_if: built_in:bump_version
- trigger_pipeline:habitat/build:
only_if: built_in:bump_version
ignore_labels:
- "Expeditor: Skip Habitat"
- "Expeditor: Skip All"

- workload: project_promoted:{{agent_id}}:*
actions:
- built_in:rollover_changelog

# the habitat chain
- workload: buildkite_hab_build_group_published:{{agent_id}}:*
actions:
# when all of the hab package publish to the unstable channel, test and promote them
- built_in:promote_habitat_packages


- workload: project_promoted:{{agent_id}}:unstable:*
actions:
- built_in:promote_habitat_packages
- built_in:publish_rubygems

pipelines:
- verify:
description: Pull Request validation tests
public: true
- habitat/build:
env:
- HAB_NONINTERACTIVE: "true"
- HAB_NOCOLORING: "true"
- HAB_STUDIO_SECRET_HAB_NONINTERACTIVE: "true"
- habitat/test:
description: Execute tests against the habitat artifact
definition: .expeditor/habitat-test.pipeline.yml
env:
- HAB_NONINTERACTIVE: "true"
- HAB_NOCOLORING: "true"
- HAB_STUDIO_SECRET_HAB_NONINTERACTIVE: "true"
trigger: pull_request
36 changes: 36 additions & 0 deletions .expeditor/habitat-test.pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
expeditor:
defaults:
buildkite:
timeout_in_minutes: 30
env:
HAB_REFRESH_CHANNEL: "LTS-2024"
retry:
automatic:
limit: 1

steps:

- label: ":linux: Validate Habitat Builds of Chef-vault"
commands:
- .expeditor/buildkite/artifact.habitat.test.sh
expeditor:
executor:
docker:
image: ruby:3.1
privileged: true

- label: ":windows: Validate Habitat Builds of Chef-vault"
commands:
- .expeditor/buildkite/artifact.habitat.test.ps1
expeditor:
executor:
docker:
host_os: windows
shell: ["powershell", "-Command"]
image: rubydistros/windows-2019:3.1
user: 'NT AUTHORITY\SYSTEM'
environment:
- FORCE_FFI_YAJL=ext
- EXPIRE_CACHE=true
- CHEF_LICENSE=accept-no-persist
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 }
10 changes: 7 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
# chef-vault Change Log

<!-- latest_release 4.1.13 -->
## [v4.1.13](https://github.com/chef/chef-vault/tree/v4.1.13) (2024-09-25)
<!-- latest_release 0.1.2 -->
## [v0.1.2](https://github.com/chef/chef-vault/tree/v0.1.2) (2025-01-06)

#### Merged Pull Requests
- CHEF-3710-chef-vault warning message includes sensitive info [#414](https://github.com/chef/chef-vault/pull/414) ([nikhil2611](https://github.com/nikhil2611))
- Empty commit to test pipelines [#427](https://github.com/chef/chef-vault/pull/427) ([nikhil2611](https://github.com/nikhil2611))
<!-- latest_release -->

<!-- release_rollup since=4.1.11 -->
### Changes not yet released to rubygems.org

#### Merged Pull Requests
- Empty commit to test pipelines [#427](https://github.com/chef/chef-vault/pull/427) ([nikhil2611](https://github.com/nikhil2611)) <!-- 0.1.2 -->
- Adding pipelines to trigger pipeline automatically [#426](https://github.com/chef/chef-vault/pull/426) ([nikhil2611](https://github.com/nikhil2611)) <!-- 0.1.1 -->
- Removed the manually created pipelines and added the channels [#425](https://github.com/chef/chef-vault/pull/425) ([nikhil2611](https://github.com/nikhil2611)) <!-- 0.1.0 -->
- Test commit for pipeline testing [#424](https://github.com/chef/chef-vault/pull/424) ([ashiqueps](https://github.com/ashiqueps)) <!-- 4.1.14 -->
- CHEF-3710-chef-vault warning message includes sensitive info [#414](https://github.com/chef/chef-vault/pull/414) ([nikhil2611](https://github.com/nikhil2611)) <!-- 4.1.13 -->
- Integrating with sonarQube [#406](https://github.com/chef/chef-vault/pull/406) ([nikhil2611](https://github.com/nikhil2611)) <!-- 4.1.12 -->
<!-- release_rollup -->
Expand Down
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ gemspec
group :development do
gem "chefstyle"
gem "rake"
gem "appbundler"
if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("3.0.0")
gem "contracts", "~> 0.16.1" # pin until we drop ruby < 2.7
gem "chef-zero"
Expand Down
Loading
Loading