Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
36 changes: 36 additions & 0 deletions source/tasks/Deploy/DeployV6/inputCommandBuilder.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,40 @@ describe("getInputCommand", () => {
const command = createCommandFromInputs(logger, task);
expect(command.EnvironmentNames).toStrictEqual(["dev", "test", "prod"]);
});

test("DeployAt populates RunAt", () => {
task.addVariableString("Space", "Default");
task.addVariableString("Environments", "test");
task.addVariableString("Project", "project 1");
task.addVariableString("ReleaseNumber", "1.2.3");
task.addVariableString("DeployAt", "2026-04-02T09:00:00+10:00");

const command = createCommandFromInputs(logger, task);
expect(command.RunAt).toStrictEqual(new Date("2026-04-02T09:00:00+10:00"));
expect(command.NoRunAfter).toBeUndefined();
});

test("DeployAtExpiry populates NoRunAfter", () => {
task.addVariableString("Space", "Default");
task.addVariableString("Environments", "test");
task.addVariableString("Project", "project 1");
task.addVariableString("ReleaseNumber", "1.2.3");
task.addVariableString("DeployAt", "2026-04-02T09:00:00+10:00");
task.addVariableString("DeployAtExpiry", "2026-04-02T17:00:00+10:00");

const command = createCommandFromInputs(logger, task);
expect(command.RunAt).toStrictEqual(new Date("2026-04-02T09:00:00+10:00"));
expect(command.NoRunAfter).toStrictEqual(new Date("2026-04-02T17:00:00+10:00"));
});

test("DeployAt and DeployAtExpiry absent when inputs not provided", () => {
task.addVariableString("Space", "Default");
task.addVariableString("Environments", "test");
task.addVariableString("Project", "project 1");
task.addVariableString("ReleaseNumber", "1.2.3");

const command = createCommandFromInputs(logger, task);
expect(command.RunAt).toBeUndefined();
expect(command.NoRunAfter).toBeUndefined();
});
});
5 changes: 5 additions & 0 deletions source/tasks/Deploy/DeployV6/inputCommandBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,18 @@ export function createCommandFromInputs(logger: Logger, task: TaskWrapper): Crea
}
logger.debug?.("Environments:" + environmentsField);

const deployAt = task.getInput("DeployAt");
const deployAtExpiry = task.getInput("DeployAtExpiry");

const command: CreateDeploymentUntenantedCommandV1 = {
spaceName: task.getInput("Space", true) || "",
ProjectName: task.getInput("Project", true) || "",
ReleaseVersion: task.getInput("ReleaseNumber", true) || "",
EnvironmentNames: environments,
UseGuidedFailure: task.getBoolean("UseGuidedFailure") || undefined,
Variables: variablesMap || undefined,
RunAt: deployAt ? new Date(deployAt) : undefined,
NoRunAfter: deployAtExpiry ? new Date(deployAtExpiry) : undefined,
};

const errors: string[] = [];
Expand Down
18 changes: 18 additions & 0 deletions source/tasks/Deploy/DeployV6/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,24 @@
"required": false,
"helpMarkDown": "Whether to use guided failure mode if errors occur during the deployment."
},
{
"name": "DeployAt",
"type": "string",
"label": "Scheduled deployment time",
"defaultValue": "",
"required": false,
"helpMarkDown": "Schedule the deployment to run at a specific time. Accepts an ISO 8601 date-time string.",
"groupName": "advanced"
},
{
"name": "DeployAtExpiry",
"type": "string",
"label": "Deployment expiry time",
"defaultValue": "",
"required": false,
"helpMarkDown": "Cancel the deployment if it has not started by this time. Accepts an ISO 8601 date-time string.",
"groupName": "advanced"
},
{
"name": "AdditionalArguments",
"type": "string",
Expand Down
36 changes: 36 additions & 0 deletions source/tasks/Deploy/DeployV7/inputCommandBuilder.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,40 @@ describe("getInputCommand", () => {
const command = createCommandFromInputs(logger, task);
expect(command.EnvironmentNames).toStrictEqual(["dev", "test", "prod"]);
});

test("DeployAt populates RunAt", () => {
task.addVariableString("Space", "Default");
task.addVariableString("Environments", "test");
task.addVariableString("Project", "project 1");
task.addVariableString("ReleaseNumber", "1.2.3");
task.addVariableString("DeployAt", "2026-04-02T09:00:00+10:00");

const command = createCommandFromInputs(logger, task);
expect(command.RunAt).toStrictEqual(new Date("2026-04-02T09:00:00+10:00"));
expect(command.NoRunAfter).toBeUndefined();
});

test("DeployAtExpiry populates NoRunAfter", () => {
task.addVariableString("Space", "Default");
task.addVariableString("Environments", "test");
task.addVariableString("Project", "project 1");
task.addVariableString("ReleaseNumber", "1.2.3");
task.addVariableString("DeployAt", "2026-04-02T09:00:00+10:00");
task.addVariableString("DeployAtExpiry", "2026-04-02T17:00:00+10:00");

const command = createCommandFromInputs(logger, task);
expect(command.RunAt).toStrictEqual(new Date("2026-04-02T09:00:00+10:00"));
expect(command.NoRunAfter).toStrictEqual(new Date("2026-04-02T17:00:00+10:00"));
});

test("DeployAt and DeployAtExpiry absent when inputs not provided", () => {
task.addVariableString("Space", "Default");
task.addVariableString("Environments", "test");
task.addVariableString("Project", "project 1");
task.addVariableString("ReleaseNumber", "1.2.3");

const command = createCommandFromInputs(logger, task);
expect(command.RunAt).toBeUndefined();
expect(command.NoRunAfter).toBeUndefined();
});
});
5 changes: 5 additions & 0 deletions source/tasks/Deploy/DeployV7/inputCommandBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,18 @@ export function createCommandFromInputs(logger: Logger, task: TaskWrapper): Crea
}
logger.debug?.("Environments:" + environmentsField);

const deployAt = task.getInput("DeployAt");
const deployAtExpiry = task.getInput("DeployAtExpiry");

const command: CreateDeploymentUntenantedCommandV1 = {
spaceName: task.getInput("Space", true) || "",
ProjectName: task.getInput("Project", true) || "",
ReleaseVersion: task.getInput("ReleaseNumber", true) || "",
EnvironmentNames: environments,
UseGuidedFailure: task.getBoolean("UseGuidedFailure") || undefined,
Variables: variablesMap || undefined,
RunAt: deployAt ? new Date(deployAt) : undefined,
NoRunAfter: deployAtExpiry ? new Date(deployAtExpiry) : undefined,
};

const errors: string[] = [];
Expand Down
18 changes: 18 additions & 0 deletions source/tasks/Deploy/DeployV7/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,24 @@
"required": false,
"helpMarkDown": "Whether to use guided failure mode if errors occur during the deployment."
},
{
"name": "DeployAt",
"type": "string",
"label": "Scheduled deployment time",
"defaultValue": "",
"required": false,
"helpMarkDown": "Schedule the deployment to run at a specific time. Accepts an ISO 8601 date-time string.",
"groupName": "advanced"
},
{
"name": "DeployAtExpiry",
"type": "string",
"label": "Deployment expiry time",
"defaultValue": "",
"required": false,
"helpMarkDown": "Cancel the deployment if it has not started by this time. Accepts an ISO 8601 date-time string.",
"groupName": "advanced"
},
{
"name": "AdditionalArguments",
"type": "string",
Expand Down