Skip to content

Latest commit

 

History

88 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rearm CLI Azure DevOps Extension

Azure DevOps extension that provides a pipeline task to download and install the Rearm CLI.

Listing on Azure DevOps Marketplace is here.

Features

  • Downloads the Rearm CLI from CloudFront CDN
  • Supports both Windows and Linux agents
  • Automatically detects the agent OS and downloads the appropriate binary
  • Sets the RearmCli variable for use in subsequent pipeline steps
  • Adds Rearm CLI to PATH

Installation

Prerequisites

  • Node.js 16+
  • npm
  • tfx-cli for packaging

Build

# Install root dependencies
npm install

# Build the task
npm run build

# Package the extension
npm run package

This will create a .vsix file that can be uploaded to the Visual Studio Marketplace.

Usage

In Azure Pipelines YAML

steps:
  - task: RearmCliInstall@1

  - script: |
      $(RearmCli) --version
    displayName: 'Run Rearm CLI'

This installs the pinned default version, verified against a SHA256 digest hardcoded into the task. To install a different version, you must also supply its SHA256 digest:

steps:
  - task: RearmCliInstall@1
    inputs:
      rearmCliVersion: '26.05.21'
      rearmCliSha256: '<sha256 of rearm-26.05.21-<platform>-<arch>.zip>'

If you override rearmCliVersion without providing rearmCliSha256, the task logs an error and falls back to the default pinned version instead of failing the pipeline.

Task Inputs

Input Required Default Description
rearmCliVersion No 26.05.20 Version of the Rearm CLI to install. Verified against a built-in SHA256 digest for the default version.
rearmCliSha256 No - SHA256 digest of the CLI archive for your platform/arch. Required when overriding rearmCliVersion to a non-default version.

Task Outputs

Variable Description
RearmCli Full path to the Rearm CLI executable (also available as output variable for cross-job use)

Publishing to Marketplace

# Login to your publisher
tfx extension publish --manifest-globs vss-extension.json --token <your-pat>

Development

Project Structure

├── vss-extension.json      # Extension manifest
├── package.json            # Root package.json
├── images/
│   └── icon.png           # Extension icon (128x128)
└── tasks/
    └── RearmCliInstall/
        ├── task.json      # Task manifest
        ├── index.ts       # Task implementation
        ├── package.json   # Task dependencies
        └── tsconfig.json  # TypeScript config

Testing Locally

You can test the task locally using the tfx CLI:

tfx build tasks upload --task-path tasks/RearmCliInstall

This requires a Personal Access Token (PAT) with the correct scopes. When you run tfx for the first time (or without a cached token) it will prompt you interactively, but you can also pass it explicitly via --token.

Obtaining a PAT

  1. Go to your Azure DevOps organization: https://dev.azure.com/<your-org>
  2. Click your profile avatar (top-right, "User Settings") → Personal access tokens
  3. Click New Token
  4. Set the following:
    • Name: anything descriptive (e.g. tfx-local-dev)
    • Organization: your target org
    • Expiration: as needed
    • Scopes: select Custom defined, then enable:
      • Agent Pools → Read & manage
      • Build → Read & execute
      • Extensions → Read & manage (required for publishing/uploading)
  5. Click Create and copy the token — it is only shown once

Configuring tfx with the token

Option 1 — pass inline (one-off):

tfx build tasks upload --task-path tasks/RearmCliInstall \
  --service-url https://dev.azure.com/<your-org> \
  --token <your-pat>

Option 2 — login once and cache credentials:

tfx login --service-url https://dev.azure.com/<your-org> --token <your-pat>
# subsequent tfx commands in the same directory will reuse the cached token
tfx build tasks upload --task-path tasks/RearmCliInstall

Option 3 — environment variable (useful in CI or shell profiles):

export TFX_TOKEN=<your-pat>
export TFX_SERVICE_URL=https://dev.azure.com/<your-org>
tfx build tasks upload --task-path tasks/RearmCliInstall

The same token and setup applies to tfx extension publish used in the Publishing to Marketplace section.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages