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

Package new chef-analyze binary #553

Merged
merged 4 commits into from
Oct 2, 2019
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
5 changes: 5 additions & 0 deletions omnibus/config/projects/chef-workstation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@
dependency "uninstall-scripts"
dependency "ruby-cleanup"

dependency "go"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you shouldn't need the go dependency here if the analyze project config also deps on it

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We discussed this and wanted to make it explicit because there's no clear indication of what's installing the go binary, or even if it's installed, at the time we add the cleanup dependency further down. It was more for humans than for omnibus.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What Marc said ☝️ -- Though, I would like to ask @tyler-ball for his point of view. This is just a matter of clarity for the team since now we will be shipping Ruby, Rust and Go binaries.

dependency "chef-analyze"
# removes the go language installed at embedded/go
dependency "go-uninstall"

exclude "**/.git"
exclude "**/bundler/git"

Expand Down
30 changes: 30 additions & 0 deletions omnibus/config/software/chef-analyze.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#
# Copyright 2019 Chef Software, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

name "chef-analyze"
default_version "master"
license "Apache-2.0"
license_file "LICENSE"
source git: "https://github.com/chef/chef-analyze.git"

dependency "go"

build do
env = with_standard_compiler_flags(with_embedded_path)
env["CGO_ENABLED"] = "0"
file_extension = windows? ? ".exe" : ""
command "#{install_dir}/embedded/go/bin/go build -o #{install_dir}/bin/#{name}#{file_extension}", env: env
end
6 changes: 5 additions & 1 deletion omnibus/omnibus-test.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,14 @@ git config --global user.name "Your Name"

$Env:CHEF_LICENSE = "accept-no-persist"

# Ensure our Chef Workstation works
Write-Output "--- Ensure the 'chef' cli works (chef env)"
chef env
If ($lastexitcode -ne 0) { Exit $lastexitcode }

Write-Output "--- Ensure the 'chef-analyze' cli works (chef-analyze help)"
chef-analyze help
If ($lastexitcode -ne 0) { Exit $lastexitcode }

# Run Workstation verification suite
C:/opscode/chef-workstation/embedded/bin/ruby.exe omnibus/verification/run.rb
If ($lastexitcode -ne 0) { Exit $lastexitcode }
7 changes: 5 additions & 2 deletions omnibus/omnibus-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,15 @@ git config --global user.name "Your Name"

export CHEF_LICENSE="accept-no-persist"

# Ensure our chef cli works
echo "--- Ensure the 'chef' cli works (chef env)"
chef env

echo "--- Ensure the 'chef-analyze' cli works (chef-analyze help)"
chef-analyze help

# Verify that the chef-workstation-app was installed (MacOS only)
if is_darwin; then
echo "Verifying that chef-workstation-app exist in /Applications directory"
echo "--- Verifying that chef-workstation-app exist in /Applications directory"
test -d "/Applications/Chef Workstation App.app"
fi

Expand Down
2 changes: 1 addition & 1 deletion omnibus/package-scripts/chef-workstation/postinst
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ else
PREFIX="/usr"
fi

binaries="chef-run berks chef-cli chef-apply chef-shell chef-solo chef-vault cookstyle delivery foodcritic inspec kitchen knife ohai push-apply pushy-client pushy-service-manager chef-client"
binaries="chef-run berks chef-cli chef-apply chef-shell chef-solo chef-vault cookstyle delivery foodcritic inspec kitchen knife ohai push-apply pushy-client pushy-service-manager chef-client chef-analyze"

for binary in $binaries; do
ln -sf "$INSTALLER_DIR/bin/$binary" $PREFIX/bin || error_exit "Cannot link $binary to $PREFIX/bin"
Expand Down
2 changes: 1 addition & 1 deletion omnibus/package-scripts/chef-workstation/postrm
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ cleanup_symlinks() {
# Keep removed symlinks in this list, so that removal of upgraded packages still cleans up
# leftovers from older versions.
chefdk_binaries="berks chef chef-cli chef-apply chef-shell chef-solo chef-vault cookstyle dco delivery foodcritic inspec kitchen knife ohai push-apply pushy-client pushy-service-manager chef-client"
binaries="chef-run chef-workstation-app $chefdk_binaries"
binaries="chef-run chef-workstation-app $chefdk_binaries chef-analyze"

for binary in $binaries; do
rm -f "$PREFIX/bin/$binary"
Expand Down