2.2.0 • Published 4 years ago

@rajzik/az-pipelines-cli v2.2.0

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

@rajzik/az-pipelines-cli

Azure pipelines tool that can create or update pipelines via npx command

Usage

We support two commands update and create.

All commands needs url to the template pipelines.

Create command:

npx @rajzik/az-pipelines-cli create git@github.com:rajzik/pipelines.git [branch-to-checkout]

Update command:

npx @rajzik/az-pipelines-cli update git@github.com:rajzik/pipelines.git [branch-to-checkout]

Examples

npx @rajzik/az-pipelines-cli update git@github.com:rajzik/pipelines.git develop
npx @rajzik/az-pipelines-cli update git@github.com:rajzik/pipelines.git
npx @rajzik/az-pipelines-cli create git@github.com:rajzik/pipelines.git develop
npx @rajzik/az-pipelines-cli create git@github.com:rajzik/pipelines.git

Setting up template pipelines repository

Add config to your repository

Config

module.exports = {
  rootDir: '.',
  targetDir: 'tools/pipelines',
  variables: 'variables.yml',
  files: 'azure-pipelines.yml',
};

Config file names:

  • .azpipelinesrc
  • .azpipelinesrc.json
  • .azpipelinesrc.yaml
  • .azpipelinesrc.yml
  • .azpipelinesrc.js

Config interface:

export interface IConfig {
  rootDir: string; // Root directory of template repository
  targetDir?: string; // Destination directory of target project
  variables: string; // Variable path
  files: string | string[]; // File/files which you want to copy to the target project
}

Variables.yml

Only supported format of variables is as follow

variables:
  - name: nodeVersion
    value: '12.x'

azure-pipelines.yml

variables:
  - template: variables.yml

stages:
  - stage: code_validation
    displayName: Primary code validation
    dependsOn: []
    condition: not(contains(variables['Build.SourceVersionMessage'], 'ci skip'))
    jobs:
      - template: templates/jobs/validation.yml
        parameters:
          useYarn: ${{ variables['useYarn'] }}
          fixNpmAndYarn: ${{ variables['fixNpmAndYarn'] }}
          fixNpmTimeout: ${{ variables['fixNpmTimeout'] }}
          nodeVersion: ${{ variables['nodeVersion'] }}