Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .github/workflows/gem_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ concurrency:
env:
CHEF_LICENSE: accept-no-persist
FORCE_FFI_YAJL: ext
BUNDLE_WITHOUT: habitat

jobs:
knife-windows:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
cookstyle:
runs-on: ubuntu-latest
env:
BUNDLE_WITHOUT: ruby_shadow:packaging
BUNDLE_WITHOUT: ruby_shadow:packaging:habitat
steps:
- uses: actions/checkout@v7
- uses: ruby/setup-ruby@v1
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/unit_specs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ concurrency:
env:
CHEF_LICENSE: accept-no-persist
FORCE_FFI_YAJL: ext
BUNDLE_WITHOUT: habitat

jobs:
unit:
Expand Down
6 changes: 6 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,9 @@ group :omnibus_package, :pry do
gem "pry-byebug"
gem "pry-stack_explorer"
end

group :habitat do
gem 'knife-ec2', '~> 2.2.0'
gem 'knife-google', '~> 5.0.15'
gem 'knife-windows', '~> 5.0.7'
end
101 changes: 99 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,35 @@ GEM
remote: https://rubygems.org/
specs:
abbrev (0.1.2)
activesupport (8.1.3)
base64
bigdecimal
concurrent-ruby (~> 1.0, >= 1.3.1)
connection_pool (>= 2.2.5)
drb
i18n (>= 1.6, < 2)
json
logger (>= 1.4.2)
minitest (>= 5.1)
securerandom (>= 0.3)
tzinfo (~> 2.0, >= 2.0.5)
uri (>= 0.13.1)
addressable (2.9.0)
public_suffix (>= 2.0.2, < 8.0)
ast (2.4.3)
aws-eventstream (1.4.0)
aws-partitions (1.1235.0)
aws-sdk-core (3.244.0)
aws-sdk-core (3.252.0)
aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.992.0)
aws-sigv4 (~> 1.9)
base64
bigdecimal
jmespath (~> 1, >= 1.6.1)
logger
aws-sdk-ec2 (1.624.0)
aws-sdk-core (~> 3, >= 3.248.0)
aws-sigv4 (~> 1.5)
aws-sdk-kms (1.123.0)
aws-sdk-core (~> 3, >= 3.244.0)
aws-sigv4 (~> 1.5)
Expand Down Expand Up @@ -177,8 +193,10 @@ GEM
csv (3.3.5)
date (3.5.1)
debug_inspector (1.2.0)
declarative (0.0.20)
diff-lcs (1.6.2)
domain_name (0.6.20240107)
drb (2.2.3)
ed25519 (1.4.0)
erubi (1.13.1)
erubis (2.7.0)
Expand Down Expand Up @@ -208,6 +226,40 @@ GEM
ffi-yajl (2.7.11)
libyajl2 (>= 2.1)
fuzzyurl (0.9.0)
gcewinpass (1.1.0)
google-api-client (~> 0.13)
gems (1.3.0)
google-api-client (0.53.0)
google-apis-core (~> 0.1)
google-apis-generator (~> 0.1)
google-apis-core (0.18.0)
addressable (~> 2.5, >= 2.5.1)
googleauth (~> 1.9)
httpclient (>= 2.8.3, < 3.a)
mini_mime (~> 1.0)
mutex_m
representable (~> 3.0)
retriable (>= 2.0, < 4.a)
google-apis-discovery_v1 (0.21.0)
google-apis-core (>= 0.15.0, < 2.a)
google-apis-generator (0.19.0)
activesupport (>= 5.0)
gems (~> 1.2)
google-apis-core (>= 0.15.0, < 2.a)
google-apis-discovery_v1 (~> 0.18)
thor (>= 0.20, < 2.a)
google-cloud-env (2.3.1)
base64 (~> 0.2)
faraday (>= 1.0, < 3.a)
google-logging-utils (0.2.0)
googleauth (1.17.1)
faraday (>= 1.0, < 3.a)
google-cloud-env (~> 2.2)
google-logging-utils (~> 0.1)
jwt (>= 1.4, < 4.0)
os (>= 0.9, < 2.0)
pstore (~> 0.1)
signet (>= 0.16, < 2.a)
gssapi (1.3.1)
ffi (>= 1.0.1)
hashdiff (1.2.1)
Expand All @@ -220,6 +272,8 @@ GEM
domain_name (~> 0.5)
httpclient (2.9.0)
mutex_m
i18n (1.15.1)
concurrent-ruby (~> 1.0)
iniparse (1.5.0)
inspec-core (7.0.107)
addressable (~> 2.4)
Expand Down Expand Up @@ -253,6 +307,28 @@ GEM
ipaddress (0.8.3)
jmespath (1.6.2)
json (2.19.9)
jwt (3.2.0)
base64
knife-cloud (4.0.15)
chef (>= 15.11)
excon (>= 0.50)
mixlib-shellout
knife-ec2 (2.2.0)
abbrev (~> 0.1)
aws-sdk-ec2 (~> 1.95)
aws-sdk-s3 (~> 1.43)
knife (>= 18.0)
syslog (~> 0.3)
knife-google (5.0.15)
gcewinpass (~> 1.1)
google-api-client (>= 0.23.9, <= 0.53.0)
knife (>= 18.0)
knife-cloud (>= 4.0.0)
syslog (~> 0.3)
knife-windows (5.0.7)
chef (>= 18.2)
chef-winrm (~> 2.3)
chef-winrm-elevated (~> 1.2)
language_server-protocol (3.17.0.5)
libyajl2 (2.1.0)
license-acceptance (2.1.13)
Expand All @@ -271,6 +347,10 @@ GEM
logger
mime-types-data (~> 3.2025, >= 3.2025.0507)
mime-types-data (3.2026.0331)
mini_mime (1.1.5)
minitest (6.0.6)
drb (~> 2.0)
prism (~> 1.5)
mixlib-archive (1.3.3)
mixlib-log
mixlib-authentication (3.0.10)
Expand Down Expand Up @@ -318,6 +398,7 @@ GEM
plist (~> 3.1)
train-core
wmi-lite (~> 1.0)
os (1.1.4)
ostruct (0.6.3)
parallel (1.28.0)
parser (3.3.11.1)
Expand Down Expand Up @@ -350,11 +431,16 @@ GEM
regexp_parser (2.12.0)
reline (0.6.3)
io-console (~> 0.5)
representable (3.2.0)
declarative (< 0.1.0)
trailblazer-option (>= 0.1.1, < 0.2.0)
uber (< 0.2.0)
rest-client (2.1.0)
http-accept (>= 1.7.0, < 2.0)
http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 4.0)
netrc (~> 0.8)
retriable (3.8.0)
rexml (3.4.4)
rspec (3.13.2)
rspec-core (~> 3.13.0)
Expand Down Expand Up @@ -390,7 +476,12 @@ GEM
rubyntlm (0.6.5)
base64
rubyzip (2.4.1)
securerandom (0.4.1)
semverse (3.0.2)
signet (0.22.0)
addressable (~> 2.8)
faraday (>= 0.17.5, < 3.a)
jwt (>= 1.5, < 4.0)
socksify (1.8.1)
sslshake (1.3.1)
strings (0.2.1)
Expand Down Expand Up @@ -442,6 +533,9 @@ GEM
pastel (~> 0.8)
strings (~> 0.2.0)
tty-screen (~> 0.8)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
uber (0.1.0)
unf_ext (0.0.9.1)
unicode-display_width (2.6.0)
unicode_utils (1.4.0)
Expand Down Expand Up @@ -481,6 +575,9 @@ DEPENDENCIES
csv
faraday (>= 2.14.3)
knife!
knife-ec2 (~> 2.2.0)
knife-google (~> 5.0.15)
knife-windows (~> 5.0.7)
libyajl2 (>= 2.1)
mixlib-authentication (= 3.0.10)
ohai (>= 19.1)
Expand All @@ -495,4 +592,4 @@ DEPENDENCIES
webmock

BUNDLED WITH
2.6.6
2.6.9
1 change: 1 addition & 0 deletions habitat/plan.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ function Invoke-Build {

Write-BuildLine " ** Configuring bundler for this build environment"
bundle config --local without integration deploy maintenance development omnibus_package test
bundle config --local with habitat
bundle config --local jobs 4
bundle config --local retry 5
bundle config --local silence_root_warning 1
Expand Down
1 change: 1 addition & 0 deletions habitat/plan.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ do_build() {
pushd "$HAB_CACHE_SRC_PATH/$pkg_dirname"
bundle config set --local path "$GEM_HOME"
bundle config --local without integration deploy maintenance development omnibus_package test
bundle config --local with habitat
bundle config --local jobs 4
bundle config --local retry 5
bundle config --local silence_root_warning 1
Expand Down
21 changes: 21 additions & 0 deletions habitat/tests/test.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,24 @@ Write-Output $actual_version
if ($actual_version -notlike "*$package_version*") {
Error "knife version is not the expected version. Expected '$package_version', got '$actual_version'"
}

Write-Output "Verifying bundled knife plugins are available"
$plugin_checks = @(
@{name = "ec2"; pattern = "Available ec2 subcommands"},
@{name = "google"; pattern = "Available google subcommands"},
@{name = "windows"; pattern = "Available windows subcommands"}
)

foreach ($check in $plugin_checks) {
$output = & {
$ErrorActionPreference = "Continue"
& hab pkg exec $pkg_ident knife $($check.name) 2>&1
} | Out-String
if ($output -match $check.pattern) {
Write-Output "Plugin '$($check.name)' is available"
} else {
Write-Error "knife plugin '$($check.name)' is not available in package '$pkg_ident'"
exit 1
}
}
Write-Output "All bundled plugins verified successfully"
21 changes: 21 additions & 0 deletions habitat/tests/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,24 @@ echo $actual_version
if [[ "$actual_version" != *"$package_version"* ]]; then
error "knife version is not the expected version. Expected '$package_version', got '$actual_version'"
fi

echo "Verifying bundled knife plugins are available"
plugin_checks=(
"ec2:Available ec2 subcommands"
"google:Available google subcommands"
"windows:Available windows subcommands"
)

for plugin_check in "${plugin_checks[@]}"; do
plugin_name="${plugin_check%%:*}"
expected_output="${plugin_check#*:}"

output=$(hab pkg exec "${pkg_ident}" bash -c "knife ${plugin_name} 2>&1" || true)
if echo "${output}" | grep -q "${expected_output}"; then
echo "Plugin '${plugin_name}' is available"
else
echo -e "\nERROR: knife plugin '${plugin_name}' is not available in package '${pkg_ident}'\n" >&2
exit 1
fi
done
echo "All bundled plugins verified successfully"
Loading