Skip to content

Commit

Permalink
Update InstallSheriffCLI task to fix Windows bug (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
frasdav committed Feb 28, 2024
1 parent 3d0bf8d commit e9e2ad6
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 8 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1 +1,13 @@
# Sheriff Azure DevOps Extension Changelog

## 0.0.4

* `InstallSheriffCLI` task updated to bug fix HTTP 404 when running on Windows agents.

## 0.0.3

* Logo files updated.

## 0.0.2

* Extension made public.
4 changes: 2 additions & 2 deletions overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

This is an Azure DevOps extension that provides tasks for installing and running
[Sheriff](https://github.com/gofrontier-com/sheriff), a command line tool to
manage Azure role-based access control (Azure RBAC) and Microsoft Entra
Privileged Identity Management (Microsoft Entra PIM) using desired state configuration.
manage Microsoft Entra Privileged Identity Management (Microsoft Entra PIM)
using desired state configuration.

## Usage

Expand Down
4 changes: 2 additions & 2 deletions tasks/InstallSheriffCLI/InstallSheriffCLIV0/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tasks/InstallSheriffCLI/InstallSheriffCLIV0/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "install-sheriff-cli-task",
"version": "0.0.1",
"version": "0.0.2",
"description": "",
"scripts": {
"test": "run-p test:*",
Expand Down
20 changes: 17 additions & 3 deletions tasks/InstallSheriffCLI/InstallSheriffCLIV0/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,34 @@ async function run() {
const agentTempDirectory = tl.getVariable('Agent.TempDirectory');
const agentToolsDirectory = tl.getVariable('Agent.ToolsDirectory');

let os;
if (agentOS === 'Windows_NT') {
os = 'Windows';
} else {
os = agentOS;
}

let platform;
if (agentOSArchitecture === 'X64' || agentOSArchitecture === 'X86') {
platform = 'x86_64';
} else {
platform = agentOSArchitecture;
}

let fileExtension;
if (os === 'Windows') {
fileExtension = 'zip';
} else {
fileExtension = 'tar.gz';
}

let downloadUrl;
if (version === 'latest') {
downloadUrl = `https://github.com/gofrontier-com/sheriff/releases/latest/download/sheriff_${agentOS}_${platform}.tar.gz`;
downloadUrl = `https://github.com/gofrontier-com/sheriff/releases/latest/download/sheriff_${os}_${platform}.${fileExtension}`;
} else {
downloadUrl = `https://github.com/gofrontier-com/sheriff/releases/download/${version}/sheriff_${agentOS}_${platform}.tar.gz`;
downloadUrl = `https://github.com/gofrontier-com/sheriff/releases/download/${version}/sheriff_${os}_${platform}.${fileExtension}`;
}
const downloadPath = path.join(agentTempDirectory, `sheriff_${agentOS}_${platform}.tar.gz`);
const downloadPath = path.join(agentTempDirectory, `sheriff_${os}_${platform}.${fileExtension}`);
const toolDirPath = `${agentToolsDirectory}/sheriff/${version}/${platform}`;

tl.debug(`Download URL: ${downloadUrl}`);
Expand Down

0 comments on commit e9e2ad6

Please sign in to comment.