Back to all reviewers

Parameterize version requirements

nestjs/nest
Based on 3 comments
Yaml

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.

CI/CD Yaml

Reviewer 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:

  1. Define versions as parameters at the top of your configuration
  2. Reference these parameters throughout your configuration
  3. Consider separate parameters for maintenance and legacy versions
  4. 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.

3
Comments Analyzed
Yaml
Primary Language
CI/CD
Category

Source Discussions