-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Updated CLI installer - v6 (#279)
- Loading branch information
Showing
15 changed files
with
583 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,9 +21,9 @@ on: | |
required: true | ||
|
||
env: | ||
PACKAGE_VERSION: 5.2.${{ github.run_number }} | ||
OCTOPUS_CLI_SERVER: ${{ secrets.OCTOPUS_URL }} | ||
OCTOPUS_CLI_API_KEY: ${{ secrets.INTEGRATIONS_API_KEY }} | ||
PACKAGE_VERSION: 6.0.${{ github.run_number }} | ||
OCTOPUS_URL: ${{ secrets.OCTOPUS_URL }} | ||
OCTOPUS_API_KEY: ${{ secrets.INTEGRATIONS_API_KEY }} | ||
|
||
jobs: | ||
build: | ||
|
@@ -32,9 +32,9 @@ jobs: | |
outputs: | ||
package_version: ${{ steps.build.outputs.package_version }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/checkout@v3 | ||
- name: Use Node.js | ||
uses: actions/setup-node@v2 | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: "16" | ||
cache: "npm" | ||
|
@@ -45,7 +45,7 @@ jobs: | |
npm ci | ||
npm run build -- --extensionVersion $PACKAGE_VERSION | ||
echo "::set-output name=package_version::$PACKAGE_VERSION" | ||
- uses: actions/upload-artifact@v2 | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: dist | ||
path: dist/ | ||
|
@@ -62,9 +62,9 @@ jobs: | |
matrix: | ||
os: [windows-2022, ubuntu-20.04, macos-11] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/checkout@v3 | ||
- name: Use Node.js | ||
uses: actions/setup-node@v2 | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: "16" | ||
cache: "npm" | ||
|
@@ -88,21 +88,21 @@ jobs: | |
if: github.event_name == 'release' || (github.actor != 'dependabot[bot]' && github.actor != 'dependabot-preview[bot]') | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/download-artifact@v2 | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: dist | ||
path: dist | ||
|
||
- name: Use Node.js | ||
uses: actions/setup-node@v2 | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: "16" | ||
cache: "npm" | ||
|
||
- name: Install Go | ||
uses: actions/setup-go@v2 | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: "^1.17.7" | ||
go-version: "^1.19.5" | ||
|
||
- name: Embed octo portable | ||
run: | | ||
|
@@ -120,13 +120,8 @@ jobs: | |
tar -czf OctoTFS.vsix.${{ needs.build.outputs.package_version }}.tar.gz ./Artifacts/**/*.vsix | ||
tar -czf OctoTFS.publish.${{ needs.build.outputs.package_version }}.tar.gz ./publish.ps1 ./dist/extension-manifest*.json | ||
- name: Install Octopus CLI 🐙 | ||
uses: OctopusDeploy/[email protected] | ||
with: | ||
version: "*" | ||
|
||
- name: Push Package 🐙 | ||
uses: OctopusDeploy/push-package-action@v1.1.2 | ||
uses: OctopusDeploy/push-package-action@v3 | ||
with: | ||
space: "Integrations" | ||
packages: | | ||
|
@@ -143,7 +138,7 @@ jobs: | |
echo "::set-output name=release-note-file::$OUTPUT_FILE" | ||
- name: Create a release in Octopus Deploy 🐙 | ||
uses: OctopusDeploy/create-release-action@v1.1.1 | ||
uses: OctopusDeploy/create-release-action@v3 | ||
with: | ||
space: "Integrations" | ||
project: "Azure DevOps Extension" | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
124 changes: 124 additions & 0 deletions
124
source/tasks/OctoInstaller/OctoInstallerV6/downloadEndpointRetriever.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
import { DownloadEndpointRetriever } from "./downloadEndpointRetriever"; | ||
import { mkdtemp, rm } from "fs/promises"; | ||
import * as path from "path"; | ||
import os from "os"; | ||
import express from "express"; | ||
import { Server } from "http"; | ||
import { AddressInfo } from "net"; | ||
import { Logger } from "@octopusdeploy/api-client"; | ||
|
||
describe("OctopusInstaller", () => { | ||
let tempOutDir: string; | ||
let releasesUrl: string; | ||
let server: Server; | ||
|
||
const msgs: string[] = []; | ||
const logger: Logger = { | ||
debug: (message) => { | ||
msgs.push(message); | ||
}, | ||
info: (message) => { | ||
msgs.push(message); | ||
}, | ||
warn: (message) => { | ||
msgs.push(message); | ||
}, | ||
error: (message, err) => { | ||
if (err !== undefined) { | ||
msgs.push(err.message); | ||
} else { | ||
msgs.push(message); | ||
} | ||
}, | ||
}; | ||
|
||
jest.setTimeout(100000); | ||
|
||
beforeEach(async () => { | ||
tempOutDir = await mkdtemp(path.join(os.tmpdir(), "octopus_")); | ||
process.env["AGENT_TOOLSDIRECTORY"] = tempOutDir; | ||
process.env["AGENT_TEMPDIRECTORY"] = tempOutDir; | ||
|
||
const app = express(); | ||
|
||
app.get("/repos/OctopusDeploy/cli/releases", (_, res) => { | ||
const latestToolsPayload = `[ | ||
{ | ||
"tag_name": "v7.4.1", | ||
"assets": [ | ||
{ | ||
"name": "octopus_7.4.1_windows_amd64.zip", | ||
"browser_download_url": "http://localhost:${address.port}/OctopusDeploy/cli/releases/download/v7.4.1/octopus_7.4.1_windows_amd64.zip" | ||
} | ||
] | ||
}, | ||
{ | ||
"tag_name": "v8.0.0", | ||
"assets": [ | ||
{ | ||
"name": "octopus_8.0.0_windows_amd64.zip", | ||
"browser_download_url": "http://localhost:${address.port}/OctopusDeploy/cli/releases/download/v8.0.0/octopus_8.0.0_windows_amd64.zip" | ||
} | ||
] | ||
}, | ||
{ | ||
"tag_name": "v8.2.0", | ||
"assets": [ | ||
{ | ||
"name": "octopus_8.2.0_windows_amd64.zip", | ||
"browser_download_url": "http://localhost:${address.port}/OctopusDeploy/cli/releases/download/v8.2.0/octopus_8.2.0_windows_amd64.zip" | ||
} | ||
] | ||
} | ||
]`; | ||
|
||
res.send(latestToolsPayload); | ||
}); | ||
|
||
app.get("/OctopusDeploy/cli/releases/download/v7.4.1/octopus_7.4.1_windows_amd64.zip", (_, res) => { | ||
res.statusCode = 200; | ||
}); | ||
|
||
app.get("/OctopusDeploy/cli/releases/download/v8.0.0/octopus_8.0.0_windows_amd64.zip", (_, res) => { | ||
res.statusCode = 200; | ||
}); | ||
|
||
app.get("/OctopusDeploy/cli/releases/download/v8.2.0/octopus_8.2.0_windows_amd64.zip", (_, res) => { | ||
res.statusCode = 200; | ||
}); | ||
|
||
server = await new Promise<Server>((resolve) => { | ||
const r = app.listen(() => { | ||
resolve(r); | ||
}); | ||
}); | ||
|
||
const address = server.address() as AddressInfo; | ||
releasesUrl = `http://localhost:${address.port}/repos/OctopusDeploy/cli/releases`; | ||
}); | ||
|
||
afterEach(async () => { | ||
await new Promise<void>((resolve) => { | ||
server.close(() => { | ||
resolve(); | ||
}); | ||
}); | ||
|
||
await rm(tempOutDir, { recursive: true }); | ||
}); | ||
|
||
test("Installs specific version", async () => { | ||
const result = await new DownloadEndpointRetriever(releasesUrl, "win32", "amd64", logger).getEndpoint("8.0.0"); | ||
expect(result.version).toBe("8.0.0"); | ||
}); | ||
|
||
test("Installs wildcard version", async () => { | ||
const result = await new DownloadEndpointRetriever(releasesUrl, "win32", "amd64", logger).getEndpoint("7.*"); | ||
expect(result.version).toBe("7.4.1"); | ||
}); | ||
|
||
test("Installs latest of latest", async () => { | ||
const result = await new DownloadEndpointRetriever(releasesUrl, "win32", "amd64", logger).getEndpoint("*"); | ||
expect(result.version).toBe("8.2.0"); | ||
}); | ||
}); |
Oops, something went wrong.