Skip to content
Open
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
4 changes: 2 additions & 2 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ async function runTask(ecs, clusterName, taskDefArn, waitForMinutes, enableECSMa
networkConfiguration: Object.keys(awsvpcConfiguration).length === 0 ? null : { awsvpcConfiguration: awsvpcConfiguration },
enableECSManagedTags: enableECSManagedTags,
tags: tags,
volumeConfigurations: volumeConfigurations
...(volumeConfigurations.length > 0 && { volumeConfigurations })
});

core.debug(`Run task response ${JSON.stringify(runTaskResponse)}`)
Expand Down Expand Up @@ -231,7 +231,7 @@ async function updateEcsService(ecs, clusterName, service, taskDefArn, waitForSe
forceNewDeployment: forceNewDeployment,
enableECSManagedTags: enableECSManagedTags,
propagateTags: propagateTags,
volumeConfigurations: volumeConfigurations
...(volumeConfigurations.length > 0 && { volumeConfigurations })
};

// Add the desiredCount property only if it is defined and a number.
Expand Down
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ async function runTask(ecs, clusterName, taskDefArn, waitForMinutes, enableECSMa
networkConfiguration: Object.keys(awsvpcConfiguration).length === 0 ? null : { awsvpcConfiguration: awsvpcConfiguration },
enableECSManagedTags: enableECSManagedTags,
tags: tags,
volumeConfigurations: volumeConfigurations
...(volumeConfigurations.length > 0 && { volumeConfigurations })
});

core.debug(`Run task response ${JSON.stringify(runTaskResponse)}`)
Expand Down Expand Up @@ -225,7 +225,7 @@ async function updateEcsService(ecs, clusterName, service, taskDefArn, waitForSe
forceNewDeployment: forceNewDeployment,
enableECSManagedTags: enableECSManagedTags,
propagateTags: propagateTags,
volumeConfigurations: volumeConfigurations
...(volumeConfigurations.length > 0 && { volumeConfigurations })
};

// Add the desiredCount property only if it is defined and a number.
Expand Down
89 changes: 0 additions & 89 deletions index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,6 @@ describe('Deploy to ECS', () => {
forceNewDeployment: false,
enableECSManagedTags: null,
propagateTags: null,
volumeConfigurations: []
});
expect(waitUntilServicesStable).toHaveBeenCalledTimes(0);
expect(core.info).toBeCalledWith("Deployment started. Watch this deployment's progress in the Amazon ECS console: https://fake-region.console.aws.amazon.com/ecs/v2/clusters/cluster-789/services/service-456/deployments?region=fake-region");
Expand Down Expand Up @@ -236,7 +235,6 @@ describe('Deploy to ECS', () => {
forceNewDeployment: false,
enableECSManagedTags: null,
propagateTags: null,
volumeConfigurations: []
});
expect(waitUntilServicesStable).toHaveBeenCalledTimes(0);
expect(core.info).toBeCalledWith("Deployment started. Watch this deployment's progress in the Amazon ECS console: https://fake-region.console.aws.amazon.com/ecs/v2/clusters/cluster-789/services/service-456/deployments?region=fake-region");
Expand Down Expand Up @@ -1217,7 +1215,6 @@ describe('Deploy to ECS', () => {
forceNewDeployment: false,
enableECSManagedTags: null,
propagateTags: null,
volumeConfigurations: []
});
expect(waitUntilServicesStable).toHaveBeenNthCalledWith(
1,
Expand Down Expand Up @@ -1276,7 +1273,6 @@ describe('Deploy to ECS', () => {
forceNewDeployment: false,
enableECSManagedTags: null,
propagateTags: null,
volumeConfigurations: []
});
expect(waitUntilServicesStable).toHaveBeenNthCalledWith(
1,
Expand Down Expand Up @@ -1363,7 +1359,6 @@ describe('Deploy to ECS', () => {
forceNewDeployment: true,
enableECSManagedTags: null,
propagateTags: null,
volumeConfigurations: []
});
});

Expand All @@ -1390,7 +1385,6 @@ describe('Deploy to ECS', () => {
forceNewDeployment: false,
enableECSManagedTags: null,
propagateTags: null,
volumeConfigurations: []
});
});

Expand Down Expand Up @@ -1438,7 +1432,6 @@ describe('Deploy to ECS', () => {
networkConfiguration: null,
enableECSManagedTags: null,
tags: [],
volumeConfigurations: []
});

expect(core.setOutput).toHaveBeenNthCalledWith(2, 'run-task-arn', ["arn:aws:ecs:fake-region:account_id:task/arn"]);
Expand Down Expand Up @@ -1480,7 +1473,6 @@ describe('Deploy to ECS', () => {
networkConfiguration: { awsvpcConfiguration: { subnets: ['a', 'b'], securityGroups: ['c', 'd'], assignPublicIp: "DISABLED" } },
enableECSManagedTags: false,
tags: [{"key": "project", "value": "myproject"}],
volumeConfigurations: []
});
expect(core.setOutput).toHaveBeenNthCalledWith(2, 'run-task-arn', ["arn:aws:ecs:fake-region:account_id:task/arn"]);
});
Expand Down Expand Up @@ -1521,7 +1513,6 @@ describe('Deploy to ECS', () => {
networkConfiguration: { awsvpcConfiguration: { subnets: ['a', 'b'], securityGroups: ['c', 'd'], assignPublicIp: "DISABLED" } },
enableECSManagedTags: false,
tags: [{"key": "project", "value": "myproject"}],
volumeConfigurations: []
});
expect(core.setOutput).toHaveBeenNthCalledWith(2, 'run-task-arn', ["arn:aws:ecs:fake-region:account_id:task/arn"]);
});
Expand Down Expand Up @@ -1576,7 +1567,6 @@ describe('Deploy to ECS', () => {
forceNewDeployment: false,
enableECSManagedTags: null,
propagateTags: null,
volumeConfigurations: []
});
expect(mockRunTask).toHaveBeenCalledWith({
startedBy: 'someJoe',
Expand All @@ -1588,7 +1578,6 @@ describe('Deploy to ECS', () => {
networkConfiguration: { awsvpcConfiguration: { subnets: ['a', 'b'], securityGroups: ['c', 'd'], assignPublicIp: "DISABLED" } },
enableECSManagedTags: null,
tags: [],
volumeConfigurations: []
});
expect(core.setOutput).toHaveBeenNthCalledWith(2, 'run-task-arn', ["arn:aws:ecs:fake-region:account_id:task/arn"]);
});
Expand Down Expand Up @@ -1700,7 +1689,6 @@ describe('Deploy to ECS', () => {
networkConfiguration: null,
enableECSManagedTags: null,
tags: [],
volumeConfigurations: []
});
});

Expand Down Expand Up @@ -1731,7 +1719,6 @@ describe('Deploy to ECS', () => {
networkConfiguration: null,
enableECSManagedTags: true,
tags: [],
volumeConfigurations: []
});
});

Expand Down Expand Up @@ -1762,7 +1749,6 @@ describe('Deploy to ECS', () => {
networkConfiguration: null,
enableECSManagedTags: false,
tags: [],
volumeConfigurations: []
});
});

Expand Down Expand Up @@ -1958,7 +1944,6 @@ describe('Deploy to ECS', () => {
forceNewDeployment: false,
enableECSManagedTags: null,
propagateTags: 'SERVICE',
volumeConfigurations: []
});
});

Expand Down Expand Up @@ -1988,7 +1973,6 @@ describe('Deploy to ECS', () => {
forceNewDeployment: false,
enableECSManagedTags: true,
propagateTags: 'SERVICE',
volumeConfigurations: []
});
});

Expand Down Expand Up @@ -2018,7 +2002,6 @@ describe('Deploy to ECS', () => {
forceNewDeployment: false,
enableECSManagedTags: false,
propagateTags: 'SERVICE',
volumeConfigurations: []
});
});

Expand Down Expand Up @@ -2129,78 +2112,6 @@ describe('Deploy to ECS', () => {
});
});

test('remove service EBS volume configuration', async () => {

// First call - create service with EBS configuration
core.getInput = jest
.fn()
.mockImplementation((name) => {
const inputs = {
'task-definition': 'task-definition.json',
'service': 'service-456',
'cluster': 'cluster-789',
'service-managed-ebs-volume-name': 'ebs1',
'service-managed-ebs-volume': JSON.stringify({
filesystemType: "xfs",
roleArn: "arn:aws:iam::123:role/ebs-role",
encrypted: false,
sizeInGiB: 30
}),
'run-task': 'false'
};
return inputs[name] || '';
});

await run();

// Second call - remove EBS configuration
core.getInput = jest
.fn()
.mockImplementation((name) => {
const inputs = {
'task-definition': 'task-definition.json',
'service': 'service-456',
'cluster': 'cluster-789',
'run-task': 'false'
};
return inputs[name] || '';
});

await run();

// Verify both calls were made correctly
expect(mockEcsUpdateService).toHaveBeenCalledTimes(2);

// Verify first call had the EBS configuration
expect(mockEcsUpdateService.mock.calls[0][0]).toEqual({
cluster: 'cluster-789',
service: 'service-456',
taskDefinition: 'task:def:arn',
forceNewDeployment: false,
enableECSManagedTags: null,
propagateTags: null,
volumeConfigurations: [{
name: 'ebs1',
managedEBSVolume: {
filesystemType: "xfs",
roleArn: "arn:aws:iam::123:role/ebs-role",
encrypted: false,
sizeInGiB: 30
}
}]
});

// Verify second call had empty volume configurations
expect(mockEcsUpdateService.mock.calls[1][0]).toEqual({
cluster: 'cluster-789',
service: 'service-456',
taskDefinition: 'task:def:arn',
forceNewDeployment: false,
enableECSManagedTags: null,
propagateTags: null,
volumeConfigurations: []
});
});

test('run task with EBS volume configuration', async () => {
core.getInput = jest
Expand Down
Loading