diff --git a/source/tasks/BuildInformation/BuildInformationV5/buildInformation.ts b/source/tasks/BuildInformation/BuildInformationV5/buildInformation.ts index b66799ae..c8a74f8e 100644 --- a/source/tasks/BuildInformation/BuildInformationV5/buildInformation.ts +++ b/source/tasks/BuildInformation/BuildInformationV5/buildInformation.ts @@ -93,7 +93,7 @@ export class BuildInformation { this.tool.arg(["--package-id", item]); } - await executeTask(this.tool, this.connection, "Build information successfully pushed.", "Failed to push build information.", additionalArguments); + await executeTask(this.tool, "(build-information;push;v5)", this.connection, "Build information successfully pushed.", "Failed to push build information.", additionalArguments); } private getVcsTypeFromProvider = (buildRepositoryProvider: string) => { diff --git a/source/tasks/CreateOctopusRelease/CreateOctopusReleaseV5/createRelease.ts b/source/tasks/CreateOctopusRelease/CreateOctopusReleaseV5/createRelease.ts index 4bfb4d2d..bcb9250e 100644 --- a/source/tasks/CreateOctopusRelease/CreateOctopusReleaseV5/createRelease.ts +++ b/source/tasks/CreateOctopusRelease/CreateOctopusReleaseV5/createRelease.ts @@ -39,6 +39,6 @@ export class CreateRelease { this.tool.arg(["--tenantTag", item]); } - await executeTask(this.tool, this.connection, "Create release succeeded.", "Failed to create release.", additionalArguments); + await executeTask(this.tool, "(release;create;v5)", this.connection, "Create release succeeded.", "Failed to create release.", additionalArguments); } } diff --git a/source/tasks/Deploy/DeployV5/deploy.ts b/source/tasks/Deploy/DeployV5/deploy.ts index 7832f552..f9c5460e 100644 --- a/source/tasks/Deploy/DeployV5/deploy.ts +++ b/source/tasks/Deploy/DeployV5/deploy.ts @@ -31,6 +31,11 @@ export class Deploy { this.tool.arg(["--tenantTag", item]); } - await executeTask(this.tool, this.connection, "Deployment succeeded.", "Failed to deploy release.", additionalArguments); + let stepIdentifier = "(release;deploy;v5)"; + if (deployForTenants.length > 0 || deployForTenantTags.length > 0) { + stepIdentifier = "(release;deploy-tenanted;v5)"; + } + + await executeTask(this.tool, stepIdentifier, this.connection, "Deployment succeeded.", "Failed to deploy release.", additionalArguments); } } diff --git a/source/tasks/OctoCli/OctoCliV5/octoCli.ts b/source/tasks/OctoCli/OctoCliV5/octoCli.ts index b9c02a6a..0abb837d 100644 --- a/source/tasks/OctoCli/OctoCliV5/octoCli.ts +++ b/source/tasks/OctoCli/OctoCliV5/octoCli.ts @@ -7,6 +7,6 @@ export class OctoCli { public async run(args: string | undefined) { this.tool.arg(this.command); - await executeTask(this.tool, this.connection, "Succeeded executing octo command.", "Failed to execute octo command.", args); + await executeTask(this.tool, "(cli;run;v5)", this.connection, "Succeeded executing octo command.", "Failed to execute octo command.", args); } } diff --git a/source/tasks/Promote/PromoteV5/promote.ts b/source/tasks/Promote/PromoteV5/promote.ts index ffe4f746..c1e5b442 100644 --- a/source/tasks/Promote/PromoteV5/promote.ts +++ b/source/tasks/Promote/PromoteV5/promote.ts @@ -22,6 +22,6 @@ export class Promote { this.tool.arg(["--tenantTag", item]); } - await executeTask(this.tool, this.connection, "Promote release succeeded.", "Failed to promote release.", additionalArguments); + await executeTask(this.tool, "(release;promote;v5)", this.connection, "Promote release succeeded.", "Failed to promote release.", additionalArguments); } } diff --git a/source/tasks/Push/PushV5/push.ts b/source/tasks/Push/PushV5/push.ts index 6f81a9ee..0c89ae30 100644 --- a/source/tasks/Push/PushV5/push.ts +++ b/source/tasks/Push/PushV5/push.ts @@ -18,7 +18,7 @@ export class Push { this.tool.arg(["--package", item]); } - await executeTask(this.tool, this.connection, "Package(s) pushed.", "Failed to push package(s).", additionalArguments); + await executeTask(this.tool, "(package;push;v5)", this.connection, "Package(s) pushed.", "Failed to push package(s).", additionalArguments); } private resolveGlobs = async (globs: string[]): Promise => { diff --git a/source/tasks/Utils/octopusTasks.ts b/source/tasks/Utils/octopusTasks.ts index dda2ad09..d87d0886 100644 --- a/source/tasks/Utils/octopusTasks.ts +++ b/source/tasks/Utils/octopusTasks.ts @@ -4,13 +4,13 @@ import { OctoServerConnectionDetails } from "./connection"; import { connectionArguments, includeAdditionalArgumentsAndProxyConfig } from "./inputs"; import { OctopusToolRunner, runOctopusCli } from "./tool"; -export async function executeTask(tool: OctopusToolRunner, connection: OctoServerConnectionDetails, successMessage: string, failureMessage: string, additionalArguments?: string | undefined) { +export async function executeTask(tool: OctopusToolRunner, stepIdentifier: string, connection: OctoServerConnectionDetails, successMessage: string, failureMessage: string, additionalArguments?: string | undefined) { return executeWithSetResult( async () => { connectionArguments(connection, tool); includeAdditionalArgumentsAndProxyConfig(connection.url, additionalArguments, tool); - await runOctopusCli(tool); + await runOctopusCli(tool, stepIdentifier); }, successMessage, failureMessage diff --git a/source/tasks/Utils/tool.ts b/source/tasks/Utils/tool.ts index a89b1a63..788967c0 100644 --- a/source/tasks/Utils/tool.ts +++ b/source/tasks/Utils/tool.ts @@ -2,12 +2,12 @@ import { IExecOptions } from "azure-pipelines-task-lib/toolrunner"; import Q from "q"; import * as tasks from "azure-pipelines-task-lib"; -function getExecOptions(): IExecOptions { - return { env: { OCTOEXTENSION: process.env.EXTENSION_VERSION, ...process.env } }; +function getExecOptions(stepIdentifier: string): IExecOptions { + return { env: { OCTOEXTENSION: `${process.env.EXTENSION_VERSION} ${stepIdentifier}`, ...process.env } }; } -export function runOctopusCli(tool: OctopusToolRunner) { - return tool.exec(getExecOptions()); +export function runOctopusCli(tool: OctopusToolRunner, stepIdentifier: string) { + return tool.exec(getExecOptions(stepIdentifier)); } export interface OctopusToolRunner { diff --git a/source/tasksLegacy/BuildInformation/BuildInformationV4/index.ts b/source/tasksLegacy/BuildInformation/BuildInformationV4/index.ts index 6a094906..973ac51a 100644 --- a/source/tasksLegacy/BuildInformation/BuildInformationV4/index.ts +++ b/source/tasksLegacy/BuildInformation/BuildInformationV4/index.ts @@ -81,7 +81,7 @@ async function run() { ]; const code: number = await octo - .map((x) => x.launchOcto(configure)) + .map((x) => x.launchOcto(configure, "(build-information;push;v4)")) .getOrElseL((x) => { throw new Error(x); }); diff --git a/source/tasksLegacy/CreateOctopusRelease/CreateOctopusReleaseV3/index.ts b/source/tasksLegacy/CreateOctopusRelease/CreateOctopusReleaseV3/index.ts index 03167815..ebab652b 100644 --- a/source/tasksLegacy/CreateOctopusRelease/CreateOctopusReleaseV3/index.ts +++ b/source/tasksLegacy/CreateOctopusRelease/CreateOctopusReleaseV3/index.ts @@ -59,7 +59,7 @@ async function run() { ]; const code: number = await octo - .map((x) => x.launchOcto(configure)) + .map((x) => x.launchOcto(configure, "(release;create;v3)")) .getOrElseL((x) => { throw new Error(x); }); diff --git a/source/tasksLegacy/CreateOctopusRelease/CreateOctopusReleaseV4/index.ts b/source/tasksLegacy/CreateOctopusRelease/CreateOctopusReleaseV4/index.ts index 148a716f..b9f2fc0a 100644 --- a/source/tasksLegacy/CreateOctopusRelease/CreateOctopusReleaseV4/index.ts +++ b/source/tasksLegacy/CreateOctopusRelease/CreateOctopusReleaseV4/index.ts @@ -67,7 +67,7 @@ async function run() { configure.push(includeAdditionalArgumentsAndProxyConfig(connection.url, additionalArguments)); const code: number = await octo - .map((x) => x.launchOcto(configure)) + .map((x) => x.launchOcto(configure, "(release;create;v4)")) .getOrElseL((x) => { throw new Error(x); }); diff --git a/source/tasksLegacy/Deploy/DeployV3/index.ts b/source/tasksLegacy/Deploy/DeployV3/index.ts index 73a9c40b..e99444b5 100644 --- a/source/tasksLegacy/Deploy/DeployV3/index.ts +++ b/source/tasksLegacy/Deploy/DeployV3/index.ts @@ -37,8 +37,13 @@ async function run() { includeAdditionalArgumentsAndProxyConfig(connection.url, additionalArguments), ]; + let stepIdentifier = "(release;deploy;v3)"; + if (deploymentForTenants.length > 0 || deployForTenantTags.length > 0) { + stepIdentifier = "(release;deploy-tenanted;v3)"; + } + const code: number = await octo - .map((x) => x.launchOcto(configure)) + .map((x) => x.launchOcto(configure, stepIdentifier)) .getOrElseL((x) => { throw new Error(x); }); diff --git a/source/tasksLegacy/Deploy/DeployV4/index.ts b/source/tasksLegacy/Deploy/DeployV4/index.ts index 8344b3b2..d2dd6cec 100644 --- a/source/tasksLegacy/Deploy/DeployV4/index.ts +++ b/source/tasksLegacy/Deploy/DeployV4/index.ts @@ -37,8 +37,13 @@ async function run() { includeAdditionalArgumentsAndProxyConfig(connection.url, additionalArguments), ]; + let stepIdentifier = "(release;deploy;v4)"; + if (deployForTenants.length > 0 || deployForTenantTags.length > 0) { + stepIdentifier = "(release;deploy-tenanted;v4)"; + } + const code: number = await octo - .map((x) => x.launchOcto(configure)) + .map((x) => x.launchOcto(configure, stepIdentifier)) .getOrElseL((x) => { throw new Error(x); }); diff --git a/source/tasksLegacy/OctoCli/OctoCliV4/index.ts b/source/tasksLegacy/OctoCli/OctoCliV4/index.ts index 1e529988..fcf7a196 100644 --- a/source/tasksLegacy/OctoCli/OctoCliV4/index.ts +++ b/source/tasksLegacy/OctoCli/OctoCliV4/index.ts @@ -17,7 +17,7 @@ async function run() { const configure = [connectionArguments(connection), includeAdditionalArguments(args)]; const code: number = await octo - .map((x) => x.launchOcto(configure)) + .map((x) => x.launchOcto(configure, "(cli;run;v4)")) .getOrElseL((x) => { throw new Error(x); }); diff --git a/source/tasksLegacy/Pack/PackV4/index.ts b/source/tasksLegacy/Pack/PackV4/index.ts index ba1c667c..1c5b5135 100644 --- a/source/tasksLegacy/Pack/PackV4/index.ts +++ b/source/tasksLegacy/Pack/PackV4/index.ts @@ -99,7 +99,7 @@ Alternatively, if NuGet package metadata is required, consider using the 'NuGet' const configureTool = configure(getInputs()); const code: number = await octo - .map((x) => x.launchOcto(configureTool)) + .map((x) => x.launchOcto(configureTool, "(package;pack;v4)")) .getOrElseL((x) => { throw new Error(x); }); diff --git a/source/tasksLegacy/Promote/PromoteV3/index.ts b/source/tasksLegacy/Promote/PromoteV3/index.ts index 31eca73b..53b5eb44 100644 --- a/source/tasksLegacy/Promote/PromoteV3/index.ts +++ b/source/tasksLegacy/Promote/PromoteV3/index.ts @@ -39,7 +39,7 @@ async function run() { ]; const code: number = await octo - .map((x) => x.launchOcto(configure)) + .map((x) => x.launchOcto(configure, "(release;promote;v3)")) .getOrElseL((x) => { throw new Error(x); }); diff --git a/source/tasksLegacy/Promote/PromoteV4/index.ts b/source/tasksLegacy/Promote/PromoteV4/index.ts index 366fca51..672fc0bd 100644 --- a/source/tasksLegacy/Promote/PromoteV4/index.ts +++ b/source/tasksLegacy/Promote/PromoteV4/index.ts @@ -39,7 +39,7 @@ async function run() { ]; const code: number = await octo - .map((x) => x.launchOcto(configure)) + .map((x) => x.launchOcto(configure, "(release;promote;v4)")) .getOrElseL((x) => { throw new Error(x); }); diff --git a/source/tasksLegacy/Push/PushV3/index.ts b/source/tasksLegacy/Push/PushV3/index.ts index 2f1ffaeb..e002e3a0 100644 --- a/source/tasksLegacy/Push/PushV3/index.ts +++ b/source/tasksLegacy/Push/PushV3/index.ts @@ -31,7 +31,7 @@ async function run() { ]; const code: number = await octo - .map((x) => x.launchOcto(configure)) + .map((x) => x.launchOcto(configure, "(package;push;v3)")) .getOrElseL((x) => { throw new Error(x); }); diff --git a/source/tasksLegacy/Push/PushV4/index.ts b/source/tasksLegacy/Push/PushV4/index.ts index d24bc7d2..bd8d0671 100644 --- a/source/tasksLegacy/Push/PushV4/index.ts +++ b/source/tasksLegacy/Push/PushV4/index.ts @@ -33,7 +33,7 @@ async function run() { ]; const code: number = await octo - .map((x) => x.launchOcto(configure)) + .map((x) => x.launchOcto(configure, "(package;push;v4)")) .getOrElseL((x) => { throw new Error(x); }); diff --git a/source/tasksLegacy/Utils/tool.ts b/source/tasksLegacy/Utils/tool.ts index 1d1b1bff..e892e3e7 100644 --- a/source/tasksLegacy/Utils/tool.ts +++ b/source/tasksLegacy/Utils/tool.ts @@ -25,20 +25,20 @@ export class OctoLauncher { this.runner = runner; } - private getExecOptions(): IExecOptions { - return { env: { OCTOEXTENSION: process.env.EXTENSION_VERSION, ...process.env } }; + private getExecOptions(stepIdentifier: string): IExecOptions { + return { env: { OCTOEXTENSION: `${process.env.EXTENSION_VERSION} ${stepIdentifier}`, ...process.env } }; } - public launchOcto(configurations: Array<(tool: ToolRunner) => ToolRunner>): Q.Promise { + public launchOcto(configurations: Array<(tool: ToolRunner) => ToolRunner>, stepIdentifier: string): Q.Promise { configureTool(configurations)(this.runner); - return this.runner.exec(this.getExecOptions()); + return this.runner.exec(this.getExecOptions(stepIdentifier)); } - public launchOctoSync(configurations: Array<(tool: ToolRunner) => ToolRunner>): IExecSyncResult { + public launchOctoSync(configurations: Array<(tool: ToolRunner) => ToolRunner>, stepIdentifier: string): IExecSyncResult { configureTool(configurations)(this.runner); - return this.runner.execSync(this.getExecOptions()); + return this.runner.execSync(this.getExecOptions(stepIdentifier)); } } @@ -90,7 +90,7 @@ export function getPortableOctoCommandRunner(command: string): Option { const octo = await getOrInstallOctoCommandRunner("version"); const result = octo - .map((x) => x.launchOctoSync([])) + .map((x) => x.launchOctoSync([], "version")) .getOrElseL((x) => { throw new Error(x); });