Skip to content

Update Chef Git Customizations for Chef Client 17 Compatibility - #49789

Merged
Hamms merged 9 commits into
stagingfrom
fix-chef-git
Jan 19, 2023
Merged

Update Chef Git Customizations for Chef Client 17 Compatibility#49789
Hamms merged 9 commits into
stagingfrom
fix-chef-git

Conversation

@Hamms

@Hamms Hamms commented Jan 13, 2023

Copy link
Copy Markdown
Contributor

Specifically, stop relying on the deprecated Ruby functionality which treats a final hash argument as representing keyword parameters, and start either explicitly passing keyword parameters or using a splat argument. Also updated a couple places we were manually calling shell_out to instead call the git helper.

This is required for Chef 17 compatibility, since Chef 17 embeds Ruby 3.0, which is the version of Ruby which fully separated positional and keyword arguments.

Note also that this codepath is only executed when the cdo-repository cookbook's sync attribute is set to true, which is not the case for most of our servers.

Links

Testing story

Tested on an adhoc, by manually overriding the sync attribute and manually restting git history.

Follow-up work

PR Checklist:

  • Tests provide adequate coverage
  • Privacy and Security impacts have been assessed
  • Code is well-commented
  • New features are translatable or updates will not break translations
  • Relevant documentation has been added or updated
  • User impact is well-understood and desirable
  • Pull Request is labeled appropriately
  • Follow-up work items (including potential tech debt) are tracked and linked

@Hamms Hamms changed the title fix chef git issues Update Chef Git Customizations for Chef Client 17 Compatibility Jan 17, 2023
@Hamms Hamms added the Chef Upgrade Work related to upgrading between major versions of chef label Jan 17, 2023
@Hamms
Hamms marked this pull request as ready for review January 17, 2023 23:38
@Hamms
Hamms requested a review from a team January 17, 2023 23:38
@Hamms Hamms added the Ruby Update Everything related to work to update the version of Ruby our codebase runs on label Jan 18, 2023
Comment on lines +69 to +72
ref_exists = [
"config --get remote.#{remote}.fetch '^\\+refs/heads/#{branch}:refs/remotes/#{remote}/#{branch}$'",
"config --get remote.#{remote}.fetch '^\\+refs/heads/\*:refs/remotes/#{remote}/\*$'"
].any? do |cmd|

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

😍

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

this little cleanup was easily the most fun part of this whole investigation 😄

@Hamms
Hamms merged commit d036c9f into staging Jan 19, 2023
@Hamms
Hamms deleted the fix-chef-git branch January 19, 2023 18:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Chef Upgrade Work related to upgrading between major versions of chef Ruby Update Everything related to work to update the version of Ruby our codebase runs on

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants