Conversation
Signed-off-by: Dan Webb <dan.webb@damacus.io>
There was a problem hiding this comment.
Pull request overview
This PR updates the composite GitHub Action to support installing Chef via the Chef Community/Commercial download APIs (license-based) while also supporting Cinc installs via omnitruck-compatible endpoints, and updates the README accordingly.
Changes:
- Adds
chefDownloadUrl+licenseinputs and uses the Chef download API flow whenlicenseis provided. - Switches the non-license install path to download-and-validate the installer script before executing it (Linux/macOS + Windows).
- Updates documentation to include Chef Community/Commercial usage and Cinc omnibus usage.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 7 comments.
| File | Description |
|---|---|
| action.yml | Adds new inputs and implements conditional Chef-download vs omnitruck install flows across Linux/macOS and Windows. |
| README.md | Documents the new Chef download API flow (license-based) and the Cinc/omnitruck usage patterns and parameters. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| TEMP_SCRIPT="$(mktemp)" | ||
| TEMP_HEADERS="$(mktemp)" |
There was a problem hiding this comment.
mktemp without a template is not portable to macOS/BSD (it errors with a usage message on many runners). Since this step targets Linux/macOS, use a portable form like mktemp -t <prefix>.XXXXXX (and/or place the temp files under $RUNNER_TEMP) to avoid failing on macOS.
| TEMP_SCRIPT="$(mktemp)" | |
| TEMP_HEADERS="$(mktemp)" | |
| TEMP_SCRIPT="$(mktemp -t chef-install-script.XXXXXX)" | |
| TEMP_HEADERS="$(mktemp -t chef-install-headers.XXXXXX)" |
| case "$EFFECTIVE_URL" in | ||
| *"/${SCRIPT_SUFFIX}"* ) ;; | ||
| *) | ||
| echo "Installer download redirected to an unexpected URL: $EFFECTIVE_URL" >&2 | ||
| if [ -n "$LICENSE" ]; then | ||
| echo "This usually means the supplied Chef license_id is missing or invalid." >&2 | ||
| fi | ||
| exit 1 | ||
| ;; | ||
| esac |
There was a problem hiding this comment.
The redirect validation only checks that the effective URL contains /${SCRIPT_SUFFIX}, but it does not ensure the redirect stays on the expected host ($CHEF_DOWNLOAD_URL / $OMNITRUCK_URL). A cross-domain redirect to a different host with the same path would pass this check.
Tighten the validation to require the effective URL to start with the expected base (e.g. https://${CHEF_DOWNLOAD_URL}/ or https://${OMNITRUCK_URL}/) in addition to the suffix/path check.
| if ($effectiveUrl -notlike "*/$scriptSuffix*") { | ||
| $message = "Installer download redirected to an unexpected URL: $effectiveUrl" | ||
| if ($env:LICENSE) { | ||
| $message += ". This usually means the supplied Chef license_id is missing or invalid." | ||
| } | ||
| throw $message | ||
| } |
There was a problem hiding this comment.
The Windows redirect validation ($effectiveUrl -notlike "*/$scriptSuffix*") only checks the path segment and doesn't ensure the redirect stayed on the expected host ($env:CHEF_DOWNLOAD_URL / $env:OMNITRUCK_URL). Tighten this to validate the effective URL begins with the expected base URL as well, to avoid accepting cross-domain redirects.
| } else { | ||
| $installRoot = "C:\opscode\$installProject\" | ||
| } | ||
| "$($installRoot)bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append |
There was a problem hiding this comment.
windowsPath is treated as an install root and the code appends bin via string concatenation ("$($installRoot)bin"). If a user supplies a path without a trailing \ (e.g. C:\opscode\chef-workstation), the resulting PATH entry becomes invalid (...chef-workstationbin). Prefer Join-Path $installRoot "bin" and/or normalize $installRoot to include a trailing separator.
| "$($installRoot)bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | |
| (Join-Path -Path $installRoot -ChildPath "bin") | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append |
| project: | ||
| description: 'which chef project to install, chef-workstation or chefdk' | ||
| description: 'Which Chef or Cinc project to install' | ||
| required: false | ||
| default: 'chef-workstation' | ||
| default: 'cinc-workstation' | ||
| version: | ||
| description: 'Version to install. Defaults to latest for chef-workstation' | ||
| description: 'Version to install. Defaults to latest for workstation installs' | ||
| required: false | ||
| chefDownloadUrl: | ||
| description: 'Chef download base url' | ||
| required: false | ||
| default: 'chefdownload-community.chef.io' | ||
| license: | ||
| description: 'Chef Downloads license ID. Required for Chef Community/Commercial downloads; not used for Cinc.' | ||
| required: false | ||
| omnitruckUrl: | ||
| description: 'Omnitruck base url' | ||
| description: 'Deprecated: Omnitruck base url. Use for Cinc or other omnitruck-compatible endpoints.' | ||
| required: false | ||
| default: 'omnitruck.chef.io' | ||
| default: 'omnitruck.cinc.sh' |
There was a problem hiding this comment.
Changing the defaults to project: cinc-workstation and omnitruckUrl: omnitruck.cinc.sh changes the action’s behavior for consumers who rely on defaults (it will install Cinc instead of Chef). Given the PR goal of avoiding breaking existing consumers, consider keeping the previous Chef defaults (or making the new behavior opt-in) and documenting the breaking change/versioning expectations if this is intentional.
| Note you will need to accept the Chef license, you can find more information at <https://docs.chef.io/chef_license.html> | ||
| By default this action installs Cinc from `omnitruck.cinc.sh`. Chef installs use the | ||
| [Chef Community download API](https://docs.chef.io/download/community/) or the Chef commercial API | ||
| when you provide a `license_id`. |
There was a problem hiding this comment.
The README says Chef installs use the commercial API when you provide a license_id, but the action input is named license (and license_id is only the query parameter passed to the download endpoint). To avoid confusion for users, align the docs to the actual input name (e.g. “provide license (Chef license_id)”).
| when you provide a `license_id`. | |
| when you provide the `license` input (Chef license_id). |
Summary
Why
Omnitruck is no longer the right default path for Chef installs, but this action still needs to support Cinc and avoid breaking existing omnitruck-based consumers. This keeps the newer Chef download flow as the default while preserving omnitruckUrl precedence for backwards compatibility and Cinc.
Verification
Notes