Skip to content

Commit

Permalink
Make action homebrew_bin_path public which is used in other hombrew r…
Browse files Browse the repository at this point in the history
…esources (chef#13810)

* Make action homebrew_bin_path public which is used in other hombrew resources
* Add appbundler upgrade for testing latest codebase for macos kitchen tests
* Add sudo to appbundler-updater
* Use github actions ruby/setup-ruby@v1 the current one using brew is not ruby being used in kitchen tests. Kitchen block again installs ruby with rbenv

---------

Signed-off-by: Neha Pansare <[email protected]>
  • Loading branch information
neha-p6 authored Jun 22, 2023
1 parent 448d438 commit c89c12b
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 47 deletions.
83 changes: 38 additions & 45 deletions .github/workflows/kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,51 +135,44 @@ jobs:
ruby: ["3.1"] # macos-11.0 is not public for now
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
with:
clean: true
- name: 'Upgrade Ruby Devkit on Macos'
id: upgrade_ruby
run: |
echo "This is the installed version of Ruby:"
brew info ruby
- name: 'Install Chef/Ohai from Omnitruck'
id: install_chef
run: |
brew install coreutils
curl -L https://omnitruck.chef.io/install.sh | sudo bash -s -- -c current
/opt/chef/bin/chef-client -v
/opt/chef/bin/ohai -v
/opt/chef/embedded/bin/rake --version
# echo "Updating Bundler"
# gem install bundler:2.3.18
# echo "finished updating Bundler, now getting the version"
# /opt/chef/embedded/bin/bundle -v
# echo "finished getting the bundler version"
- name: 'Run end_to_end::default recipe'
id: run
run: |
brew install rbenv ruby-build
touch ~/.zshrc
export PATH="$HOME/.rbenv/bin:$PATH"
export HOMEBREW_NO_ENV_HINTS="true"
echo 'eval "$(rbenv init - zsh)"' >> ~/.zshrc
source ~/.zshrc
rbenv install 3.1.2
rbenv global 3.1.2
gem install bundler:2.3.18
echo "which bundler are we using?"
which bundle
echo "what version is that?"
bundle --version
cd /Users/runner/work/chef/chef
sudo bundle install
cd kitchen-tests
sudo bundle install --jobs=3 --retry=3
sudo gem install kitchen
sudo gem install berkshelf --no-doc
sudo berks vendor cookbooks
sudo /opt/chef/bin/chef-client -z -o end_to_end --chef-license accept-no-persist
- name: Check out code
uses: actions/checkout@v3
with:
clean: true
- name: 'Setup Ruby'
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.1"
bundler-cache: false
working-directory: kitchen-tests
- name: 'Install Chef/Ohai from Omnitruck'
id: install_chef
run: |
brew install coreutils
curl -L https://omnitruck.chef.io/install.sh | sudo bash -s -- -c current
/opt/chef/bin/chef-client -v
/opt/chef/bin/ohai -v
/opt/chef/embedded/bin/rake --version
- name: 'Upgrade Chef/Ohai via Appbundler'
id: upgrade
run: |
OHAI_VERSION=$(sed -n '/ohai .[0-9]/{s/.*(//;s/)//;p;}' Gemfile.lock)
sudo /opt/chef/embedded/bin/gem install appbundler appbundle-updater --no-doc
sudo /opt/chef/embedded/bin/appbundle-updater chef chef $GITHUB_SHA --tarball --github $GITHUB_REPOSITORY
echo "Installed Chef / Ohai release:"
/opt/chef/bin/chef-client -v
/opt/chef/bin/ohai -v
- name: 'Run end_to_end::default recipe'
id: run
run: |
cd kitchen-tests
sudo /opt/chef/embedded/bin/bundle config set --local without 'omnibus_package'
sudo /opt/chef/embedded/bin/bundle config set --local path 'vendor/bundle'
sudo /opt/chef/embedded/bin/bundle install --jobs=3 --retry=3
sudo rm -f /opt/chef/embedded/bin/{htmldiff,ldiff}
sudo /opt/chef/embedded/bin/gem install berkshelf --no-doc
sudo /opt/chef/embedded/bin/berks vendor cookbooks
sudo /opt/chef/bin/chef-client -z -o end_to_end --chef-license accept-no-persist
linux:
strategy:
Expand Down
4 changes: 2 additions & 2 deletions lib/chef/mixin/homebrew_user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ def find_homebrew_username(provided_user = nil)
@homebrew_owner_username
end

private

def homebrew_bin_path(brew_bin_path = nil)
if brew_bin_path && ::File.exist?(brew_bin_path)
brew_bin_path
Expand All @@ -68,6 +66,8 @@ def homebrew_bin_path(brew_bin_path = nil)
end
end

private

def calculate_owner
brew_path = homebrew_bin_path
if brew_path
Expand Down

0 comments on commit c89c12b

Please sign in to comment.