Skip to content

Commit 301a9d3

Browse files
committed
copilot-instructions update
Signed-off-by: Corey Hemminger <hemminger@hotmail.com>
1 parent 84efbe1 commit 301a9d3

File tree

1 file changed

+79
-10
lines changed

1 file changed

+79
-10
lines changed

.github/copilot-instructions.md

Lines changed: 79 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,23 @@ Mixlib::Install is a library for interacting with Chef Software Inc's software d
66
**Primary Goal**: Support the widest range of Ruby versions possible to ensure compatibility across diverse Chef environments.
77

88
**Recent Major Changes** (v3.13.0 - v3.15.0):
9-
- Added commercial and trial API support for licensed Chef products (PR #408, #416)
10-
- Added chef-ice product with package_manager parameter support (PR #417)
11-
- Refactored install directory constants to support both Omnibus and Habitat paths
9+
- **PR #417**: Added chef-ice product with package_manager parameter support
10+
- Implemented platform normalization (`Util.normalize_platform_for_commercial`) for chef-ice
11+
- Added package manager detection (`Util.determine_package_manager`) for automatic format selection
12+
- Updated URL construction to use `m`, `p`, `pm` parameters for chef-ice (vs. `p`, `pv`, `m` for standard products)
13+
- Modified shell and PowerShell scripts to handle chef-ice metadata URLs
14+
- **PR #408, #416**: Added commercial and trial API support for licensed Chef products
15+
- Implemented license_id parameter for install scripts and API calls
16+
- Added trial API automatic defaults enforcement (stable channel, latest version only with warnings)
17+
- Created `Dist.trial_license?` and `Dist.commercial_license?` helper methods
18+
- **Install Directory Refactoring**: Support for both Omnibus and Habitat package paths
1219
- Renamed `WINDOWS_INSTALL_DIR``OMNIBUS_WINDOWS_INSTALL_DIR`, `LINUX_INSTALL_DIR``OMNIBUS_LINUX_INSTALL_DIR`
13-
- Added `HABITAT_WINDOWS_INSTALL_DIR` and `HABITAT_LINUX_INSTALL_DIR` for chef-ice support
14-
- Updated all code paths to conditionally use Habitat directories for chef-ice product
15-
- Added `list-products` CLI subcommand (PR #413)
16-
- Added license_id parameter to install script endpoints (PR #416)
17-
- Implemented trial API automatic defaults (stable channel, latest version only)
18-
- Added Habitat package path detection to generated scripts (PR #407)
19-
- Migrated CI from Buildkite to GitHub Actions (PR #411)
20+
- Added `HABITAT_WINDOWS_INSTALL_DIR = "hab\\pkgs"` and `HABITAT_LINUX_INSTALL_DIR = "/hab/pkgs"`
21+
- Updated `root` and `current_version` methods in `lib/mixlib/install.rb` to conditionally use Habitat paths for chef-ice
22+
- Modified script generators to set appropriate install directories based on product type
23+
- **PR #413**: Added `list-products` CLI subcommand for product matrix discovery
24+
- **PR #407**: Added Habitat package path detection to generated install scripts
25+
- **PR #411**: Migrated CI from Buildkite to GitHub Actions with comprehensive test coverage
2026

2127
## Ruby Version Support Strategy
2228

@@ -264,6 +270,10 @@ The library includes sophisticated platform version compatibility logic:
264270
- Fallback: Constructs filename from platform metadata if extraction fails
265271
- Renames temp file to extracted/constructed filename
266272
- Works with all download methods: wget, curl, fetch, perl, python
273+
- **Chef-ICE Support**: Includes platform normalization and package manager detection functions
274+
- `determine_package_manager()` - Detects package format based on platform
275+
- `normalize_platform_name()` - Maps specific platforms to generic categories (linux, macos, windows, unix)
276+
- Conditional URL construction based on product type (chef-ice vs. standard products)
267277

268278
### PowerShell (install.ps1)
269279
- Supports: http_proxy
@@ -274,6 +284,10 @@ The library includes sophisticated platform version compatibility logic:
274284
- Parses JSON responses with `ConvertFrom-Json`
275285
- Extracts `url` and `sha256` from JSON object
276286
- Automatically routes to trial or commercial API based on license_id prefix
287+
- **Chef-ICE Support**: Simplified parameters for Windows
288+
- Uses `p=windows`, `m=<arch>`, `pm=msi` parameters for chef-ice
289+
- Conditional logic to select appropriate metadata URL format based on product type
290+
- Handles both chef-ice and standard product URL construction
277291

278292
### Script Options
279293
- `download_url_override`: Direct URL instead of API lookup
@@ -477,9 +491,21 @@ Automatically determines package format based on platform:
477491

478492
### Implementation Locations:
479493
- **Backend Logic**: `lib/mixlib/install/backend/package_router.rb` (lines 265-270)
494+
- `create_artifact` method checks for `chef-ice` and constructs appropriate download URLs
495+
- Implements platform normalization and package manager parameter addition
480496
- **Utility Functions**: `lib/mixlib/install/util.rb` (lines 182-224)
497+
- `determine_package_manager(platform)` - Returns package format (rpm, deb, dmg, msi, tar)
498+
- `normalize_platform_for_commercial(platform)` - Maps platforms to generic categories
481499
- **Shell Script**: `lib/mixlib/install/generator/bourne/scripts/fetch_metadata.sh`
500+
- Includes `determine_package_manager()` and `normalize_platform_name()` shell functions
501+
- Conditional metadata URL construction for chef-ice
482502
- **PowerShell Script**: `lib/mixlib/install/generator/powershell/scripts/get_project_metadata.ps1`
503+
- Simplified parameter handling for chef-ice on Windows
504+
- Uses `p=windows`, `pm=msi` for chef-ice metadata queries
505+
- **Root Directory Logic**: `lib/mixlib/install.rb` and `lib/mixlib/install/script_generator.rb`
506+
- Methods check product name and conditionally use Habitat paths
507+
- `root` method returns appropriate install directory path
508+
- `current_version` method uses correct version-manifest.json path
483509

484510
### Example Usage:
485511
```ruby
@@ -511,6 +537,26 @@ artifact = Mixlib::Install.new(options).artifact_info
511537
1. **Don't forget chef-ice special handling** - Different URL parameters and platform normalization
512538
1. **Don't bypass trial API defaults** - Trial licenses must use stable channel and latest version
513539

540+
### Common Issues and Solutions
541+
542+
**Chef-ICE Installation Issues**:
543+
- Ensure `package_manager` parameter is included in metadata URLs
544+
- Verify platform normalization returns correct category (linux, macos, windows, unix)
545+
- Check that Habitat install directories are used (not Omnibus paths)
546+
- For Windows: Must use `pm=msi` parameter
547+
548+
**Trial API Restrictions**:
549+
- Trial licenses automatically default to stable channel with warning
550+
- Trial licenses automatically default to latest version with warning
551+
- Users cannot override these defaults for trial API
552+
- Commercial licenses have no such restrictions
553+
554+
**Content-Disposition Filename Extraction**:
555+
- If filename extraction fails, fallback construction should work
556+
- Test with multiple download tools (wget, curl, fetch, perl, python)
557+
- Verify temp file approach doesn't break existing functionality
558+
- Check that filename has correct extension for platform (.rpm, .deb, .msi, etc.)
559+
514560
## Documentation Requirements
515561

516562
When making changes:
@@ -569,11 +615,34 @@ When making changes:
569615
### Environment Variables
570616
- `EXTRA_PRODUCTS_FILE` - Path to custom product definitions
571617
- `http_proxy`, `https_proxy`, `ftp_proxy`, `no_proxy` - Proxy configuration
618+
- `CHEF_LICENSE_KEY` - Fallback license ID for install scripts (if not provided via parameter)
619+
620+
### Quick Reference: Chef-ICE vs Standard Products
621+
622+
| Aspect | Standard Products (chef, chefdk, etc.) | Chef-ICE Product |
623+
|--------|---------------------------------------|------------------|
624+
| **Package System** | Omnibus | Habitat |
625+
| **Install Dir (Windows)** | `C:\opscode\<product>` | `C:\hab\pkgs\chef\chef-infra-client\*\*` |
626+
| **Install Dir (Linux)** | `/opt/<product>` | `/hab/pkgs/chef/chef-infra-client/*/*` |
627+
| **URL Parameters** | `?p=<platform>&pv=<version>&m=<arch>&v=<version>&license_id=<id>` | `?v=<version>&license_id=<id>&m=<arch>&p=<normalized>&pm=<manager>` |
628+
| **Platform Values** | Specific (ubuntu, el, centos, etc.) | Normalized (linux, macos, windows, unix) |
629+
| **Requires PM Param** | No | Yes (rpm, deb, msi, dmg, tar) |
630+
| **Min Version** | Varies by product | Chef 19+ |
631+
632+
### Quick Reference: License Types
633+
634+
| License Type | ID Format | API Endpoint | Channel | Version | Auto-Defaults |
635+
|-------------|-----------|--------------|---------|---------|---------------|
636+
| **Trial** | `free-*` or `trial-*` | https://chefdownload-trial.chef.io | stable only | latest only | Yes (with warnings) |
637+
| **Commercial** | Any other format | https://chefdownload-commercial.chef.io | Any | Any | No |
638+
| **Open Source** | None | https://omnitruck.chef.io | Any | Any | No |
572639

573640
---
574641

575642
**Remember**: When in doubt about Ruby version compatibility, check the Gemfile and gemspec for version-specific patterns, and test with Ruby 2.6+ when possible. The goal is maximum compatibility (Ruby 2.6+) without sacrificing functionality.
576643

644+
For chef-ice products, always verify that platform normalization and package manager detection work correctly for the target platform before deploying changes.
645+
577646
### Ruby 2.6+ Feature Reference
578647

579648
#### Safe to Use (Ruby 2.6+)

0 commit comments

Comments
 (0)