Prompt
Always parameterize tool and runtime versions in CI/CD configurations rather than hardcoding them. This makes your pipelines more maintainable when dependencies need updates and provides a single source of truth for version requirements.
For critical dependencies like Node.js or package managers:
- Define versions as parameters at the top of your configuration
- Reference these parameters throughout your configuration
- Consider separate parameters for maintenance and legacy versions
- Use version ranges when appropriate to get compatible updates
Example:
# Good practice
parameters:
maintenance-node-version:
type: string
default: "16.20"
jobs:
build:
docker:
- image: cimg/node:<< pipeline.parameters.maintenance-node-version >>
steps:
- run:
command: 'npm install -g npm@^8' # Version range for compatible updates
This approach helps prevent CI failures when new incompatible versions are released and simplifies the process of updating dependencies across multiple workflow steps.