Skip to content
This repository has been archived by the owner on Mar 18, 2024. It is now read-only.

Deploy command #247

Merged
merged 19 commits into from
Dec 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
import ArtifactHelper from "../Common/ArtifactHelper";
const fs = require("fs");
import SFPStatsSender from "@dxatscale/sfpowerscripts.core/lib/utils/SFPStatsSender"
import { PackageInstallationStatus } from "@dxatscale/sfpowerscripts.core/lib/package/PackageInstallationResult";

async function run() {
try {
Expand Down Expand Up @@ -97,44 +98,50 @@ async function run() {
true
)

await installDataPackageImpl.exec();
let result = await installDataPackageImpl.exec();


let elapsedTime=Date.now()-startTime;


if (result.result === PackageInstallationStatus.Succeeded) {
//No environment info available, create and push
if (packageMetadataFromStorage.deployments == null) {
packageMetadataFromStorage.deployments = new Array();
packageMetadataFromStorage.deployments.push({
target_org: target_org,
sub_directory: subdirectory,
installation_time:elapsedTime,
timestamp:Date.now()
});
} else {
//Update existing environment map
packageMetadataFromStorage.deployments.push({
target_org: target_org,
sub_directory: subdirectory,
installation_time:elapsedTime,
timestamp:Date.now()
});
}

//No environment info available, create and push
if (packageMetadataFromStorage.deployments == null) {
packageMetadataFromStorage.deployments = new Array();
packageMetadataFromStorage.deployments.push({
target_org: target_org,
sub_directory: subdirectory,
installation_time:elapsedTime,
timestamp:Date.now()
});
} else {
//Update existing environment map
packageMetadataFromStorage.deployments.push({
target_org: target_org,
sub_directory: subdirectory,
installation_time:elapsedTime,
timestamp:Date.now()
});
}
await updatePackageDeploymentDetails(
packageMetadataFromStorage,
extensionManagementApi,
extensionName
);

await updatePackageDeploymentDetails(
packageMetadataFromStorage,
extensionManagementApi,
extensionName
);

SFPStatsSender.logElapsedTime("package.installation.elapsed_time",elapsedTime,{package:sfdx_package,type:"data", target_org:target_org});
SFPStatsSender.logCount("package.installation",{package:sfdx_package,type:"data",target_org:target_org});

SFPStatsSender.logElapsedTime("package.installation.elapsed_time",elapsedTime,{package:sfdx_package,type:"data", target_org:target_org});
SFPStatsSender.logCount("package.installation",{package:sfdx_package,type:"data",target_org:target_org});

tl.setResult(tl.TaskResult.Succeeded, "Package installed successfully");
} else if (result.result === PackageInstallationStatus.Failed) {
tl.setResult(tl.TaskResult.Failed, result.message);

SFPStatsSender.logCount("package.installation.failure",{package:tl.getInput("package",false),type:"data"});
}

tl.setResult(tl.TaskResult.Succeeded, "Package installed successfully");

} catch (err) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,20 +112,28 @@ async function run() {
sourceDirectory
);

let result: PackageInstallationResult = await installUnlockedPackageImpl.exec();
let elapsedTime=Date.now()-startTime;

SFPStatsSender.logElapsedTime("package.installation.elapsed_time",elapsedTime,{package:sfdx_package,type:"unlocked", target_org:target_org})
SFPStatsSender.logCount("package.installation",{package:sfdx_package,type:"unlocked",target_org:target_org})



let result: PackageInstallationResult = await installUnlockedPackageImpl.exec();
if (result.result == PackageInstallationStatus.Skipped) {
if (result.result === PackageInstallationStatus.Skipped) {
tl.setResult(
tl.TaskResult.Skipped,
"Skipping Package Installation as already installed"
);
} else {
} else if (result.result === PackageInstallationStatus.Failed) {
SFPStatsSender.logCount("package.installation.failure",{package:tl.getInput("package",false),type:"unlocked"})

tl.error(result.message);
tl.setResult(
tl.TaskResult.Failed,
result.message
);
} else if (result.result === PackageInstallationStatus.Succeeded) {

SFPStatsSender.logElapsedTime("package.installation.elapsed_time",elapsedTime,{package:sfdx_package,type:"unlocked", target_org:target_org})
SFPStatsSender.logCount("package.installation",{package:sfdx_package,type:"unlocked",target_org:target_org})

if (package_installedfrom != "Custom") {
//No environment info available, create and push
if (isNullOrUndefined(packageMetadataFromStorage.deployments)) {
Expand Down Expand Up @@ -154,11 +162,12 @@ async function run() {
}

tl.setResult(tl.TaskResult.Succeeded, "Package Installed Successfully");
} else {
throw new Error(`Unhandled package installation result ${result.result}`);
}
} catch (err) {
SFPStatsSender.logCount("package.installation.failure",{package:tl.getInput("package",false),type:"unlocked"})
tl.setResult(tl.TaskResult.Failed, err.message);

}
}

Expand Down
Loading