Skip to content
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
11 changes: 9 additions & 2 deletions src/actions/importSolution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ export async function importSolution(parameters: ImportSolutionParameters, runne

validator.pushInput(pacArgs, "--path", parameters.path, resolveFolder);
validator.pushInput(pacArgs, "--async", parameters.async);
validator.pushInput(pacArgs, "--import-as-holding", parameters.importAsHolding);
validator.pushInput(pacArgs, "--stage-and-upgrade", parameters.stageAndUpgrade);
validator.pushInput(pacArgs, "--force-overwrite", parameters.forceOverwrite);
validator.pushInput(pacArgs, "--publish-changes", parameters.publishChanges);
validator.pushInput(pacArgs, "--skip-dependency-check", parameters.skipDependencyCheck);
Expand All @@ -55,6 +53,15 @@ export async function importSolution(parameters: ImportSolutionParameters, runne
validator.pushInput(pacArgs, "--activate-plugins", parameters.activatePlugins);
validator.pushInput(pacArgs, "--skip-lower-version", parameters.skipLowerVersion);

// --import-as-holding and --stage-and-upgrade are mutually exclusive
// Only send these switch arguments to PAC if their value is true
if (validator.getInput(parameters.importAsHolding)?.toLowerCase() === "true") {
validator.pushInput(pacArgs, "--import-as-holding", parameters.importAsHolding);
}
if (validator.getInput(parameters.stageAndUpgrade)?.toLowerCase() === "true") {
validator.pushInput(pacArgs, "--stage-and-upgrade", parameters.stageAndUpgrade);
}

if (validator.getInput(parameters.useDeploymentSettingsFile)?.toLowerCase() === "true") {
validator.pushInput(pacArgs, "--settings-file", parameters.deploymentSettingsFile);
}
Expand Down
6 changes: 3 additions & 3 deletions test/actions/importSolution.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,9 @@ describe("action: importSolution", () => {

authenticateEnvironmentStub.should.have.been.calledOnceWith(pacStub, mockClientCredentials, environmentUrl);
pacStub.should.have.been.calledOnceWith("solution", "import", "--path", host.absoluteSolutionPath,
"--async", "true", "--import-as-holding", "true", "--force-overwrite", "true", "--publish-changes", "true",
"--async", "true", "--force-overwrite", "true", "--publish-changes", "true",
"--skip-dependency-check", "true", "--convert-to-managed", "true", "--max-async-wait-time", host.maxAsyncWaitTime,
"--activate-plugins", "true", "--skip-lower-version", "false", "--settings-file", host.deploymentSettingsFile);
"--activate-plugins", "true", "--skip-lower-version", "false", "--import-as-holding", "true", "--settings-file", host.deploymentSettingsFile);
});

it("with optional inputs set to default values, calls pac runner stub with correct arguments", async () => {
Expand All @@ -146,7 +146,7 @@ describe("action: importSolution", () => {

authenticateEnvironmentStub.should.have.been.calledOnceWith(pacStub, mockClientCredentials, environmentUrl);
pacStub.should.have.been.calledOnceWith("solution", "import", "--path", host.absoluteSolutionPath,
"--async", "true", "--import-as-holding", "false", "--force-overwrite", "true", "--publish-changes", "false",
"--async", "true", "--force-overwrite", "true", "--publish-changes", "false",
"--skip-dependency-check", "true", "--convert-to-managed", "false", "--max-async-wait-time", "180", "--activate-plugins", "true", "--skip-lower-version", "false");
});
});