@@ -39,8 +39,6 @@ async function runTask(ecs, clusterName, taskDefArn, waitForMinutes, enableECSMa
39
39
const assignPublicIP = core.getInput('run-task-assign-public-IP', { required: false }) || 'DISABLED';
40
40
const tags = JSON.parse(core.getInput('run-task-tags', { required: false }) || '[]');
41
41
const capacityProviderStrategy = JSON.parse(core.getInput('run-task-capacity-provider-strategy', { required: false }) || '[]');
42
- const runTaskManagedEBSVolumeName = core.getInput('run-task-managed-ebs-volume-name', { required: false }) || '';
43
- const runTaskManagedEBSVolume = core.getInput('run-task-managed-ebs-volume', { required: false }) || '{}';
44
42
45
43
let awsvpcConfiguration = {}
46
44
@@ -55,20 +53,6 @@ async function runTask(ecs, clusterName, taskDefArn, waitForMinutes, enableECSMa
55
53
if(assignPublicIP != "" && (subnetIds != "" || securityGroupIds != "")){
56
54
awsvpcConfiguration["assignPublicIp"] = assignPublicIP
57
55
}
58
- let volumeConfigurations = [];
59
- let taskManagedEBSVolumeObject;
60
-
61
- if (runTaskManagedEBSVolumeName != '') {
62
- if (runTaskManagedEBSVolume != '{}') {
63
- taskManagedEBSVolumeObject = convertToManagedEbsVolumeObject(runTaskManagedEBSVolume);
64
- volumeConfigurations = [{
65
- name: runTaskManagedEBSVolumeName,
66
- managedEBSVolume: taskManagedEBSVolumeObject
67
- }];
68
- } else {
69
- core.warning(`run-task-managed-ebs-volume-name provided without run-task-managed-ebs-volume value. VolumeConfigurations property will not be included in the RunTask API call`);
70
- }
71
- }
72
56
73
57
const runTaskResponse = await ecs.runTask({
74
58
startedBy: startedBy,
@@ -81,8 +65,7 @@ async function runTask(ecs, clusterName, taskDefArn, waitForMinutes, enableECSMa
81
65
launchType: capacityProviderStrategy.length === 0 ? launchType : null,
82
66
networkConfiguration: Object.keys(awsvpcConfiguration).length === 0 ? null : { awsvpcConfiguration: awsvpcConfiguration },
83
67
enableECSManagedTags: enableECSManagedTags,
84
- tags: tags,
85
- volumeConfigurations: volumeConfigurations
68
+ tags: tags
86
69
});
87
70
88
71
core.debug(`Run task response ${JSON.stringify(runTaskResponse)}`)
@@ -109,47 +92,6 @@ async function runTask(ecs, clusterName, taskDefArn, waitForMinutes, enableECSMa
109
92
}
110
93
}
111
94
112
- function convertToManagedEbsVolumeObject(managedEbsVolume) {
113
- managedEbsVolumeObject = {}
114
- const ebsVolumeObject = JSON.parse(managedEbsVolume);
115
- if ('roleArn' in ebsVolumeObject){ // required property
116
- managedEbsVolumeObject.roleArn = ebsVolumeObject.roleArn;
117
- core.debug(`Found RoleArn ${ebsVolumeObject['roleArn']}`);
118
- } else {
119
- throw new Error('managed-ebs-volume must provide "role-arn" to associate with the EBS volume')
120
- }
121
-
122
- if ('encrypted' in ebsVolumeObject) {
123
- managedEbsVolumeObject.encrypted = ebsVolumeObject.encrypted;
124
- }
125
- if ('filesystemType' in ebsVolumeObject) {
126
- managedEbsVolumeObject.filesystemType = ebsVolumeObject.filesystemType;
127
- }
128
- if ('iops' in ebsVolumeObject) {
129
- managedEbsVolumeObject.iops = ebsVolumeObject.iops;
130
- }
131
- if ('kmsKeyId' in ebsVolumeObject) {
132
- managedEbsVolumeObject.kmsKeyId = ebsVolumeObject.kmsKeyId;
133
- }
134
- if ('sizeInGiB' in ebsVolumeObject) {
135
- managedEbsVolumeObject.sizeInGiB = ebsVolumeObject.sizeInGiB;
136
- }
137
- if ('snapshotId' in ebsVolumeObject) {
138
- managedEbsVolumeObject.snapshotId = ebsVolumeObject.snapshotId;
139
- }
140
- if ('tagSpecifications' in ebsVolumeObject) {
141
- managedEbsVolumeObject.tagSpecifications = ebsVolumeObject.tagSpecifications;
142
- }
143
- if (('throughput' in ebsVolumeObject) && (('volumeType' in ebsVolumeObject) && (ebsVolumeObject.volumeType == 'gp3'))){
144
- managedEbsVolumeObject.throughput = ebsVolumeObject.throughput;
145
- }
146
- if ('volumeType' in ebsVolumeObject) {
147
- managedEbsVolumeObject.volumeType = ebsVolumeObject.volumeType;
148
- }
149
- core.debug(`Created managedEbsVolumeObject: ${JSON.stringify(managedEbsVolumeObject)}`);
150
- return managedEbsVolumeObject;
151
- }
152
-
153
95
// Poll tasks until they enter a stopped state
154
96
async function waitForTasksStopped(ecs, clusterName, taskArns, waitForMinutes) {
155
97
if (waitForMinutes > MAX_WAIT_MINUTES) {
@@ -200,32 +142,13 @@ async function tasksExitCode(ecs, clusterName, taskArns) {
200
142
async function updateEcsService(ecs, clusterName, service, taskDefArn, waitForService, waitForMinutes, forceNewDeployment, desiredCount, enableECSManagedTags, propagateTags) {
201
143
core.debug('Updating the service');
202
144
203
- const serviceManagedEBSVolumeName = core.getInput('service-managed-ebs-volume-name', { required: false }) || '';
204
- const serviceManagedEBSVolume = core.getInput('service-managed-ebs-volume', { required: false }) || '{}';
205
-
206
- let volumeConfigurations = [];
207
- let serviceManagedEbsVolumeObject;
208
-
209
- if (serviceManagedEBSVolumeName != '') {
210
- if (serviceManagedEBSVolume != '{}') {
211
- serviceManagedEbsVolumeObject = convertToManagedEbsVolumeObject(serviceManagedEBSVolume);
212
- volumeConfigurations = [{
213
- name: serviceManagedEBSVolumeName,
214
- managedEBSVolume: serviceManagedEbsVolumeObject
215
- }];
216
- } else {
217
- core.warning('service-managed-ebs-volume-name provided without service-managed-ebs-volume value. VolumeConfigurations property will not be included in the UpdateService API call');
218
- }
219
- }
220
-
221
145
let params = {
222
146
cluster: clusterName,
223
147
service: service,
224
148
taskDefinition: taskDefArn,
225
149
forceNewDeployment: forceNewDeployment,
226
150
enableECSManagedTags: enableECSManagedTags,
227
- propagateTags: propagateTags,
228
- volumeConfigurations: volumeConfigurations
151
+ propagateTags: propagateTags
229
152
};
230
153
231
154
// Add the desiredCount property only if it is defined and a number.
@@ -486,11 +409,7 @@ async function run() {
486
409
if (enableECSManagedTagsInput !== '') {
487
410
enableECSManagedTags = enableECSManagedTagsInput.toLowerCase() === 'true';
488
411
}
489
- const propagateTagsInput = core.getInput('propagate-tags', { required: false }) || '';
490
- let propagateTags = null;
491
- if (propagateTagsInput !== '') {
492
- propagateTags = propagateTagsInput;
493
- }
412
+ let propagateTags = core.getInput('propagate-tags', { required: false }) || '';
494
413
495
414
// Register the task definition
496
415
core.debug('Registering the task definition');
@@ -538,6 +457,11 @@ async function run() {
538
457
if (serviceResponse.status != 'ACTIVE') {
539
458
throw new Error(`Service is ${serviceResponse.status}`);
540
459
}
460
+ // set propagateTags to the current value if no input provided
461
+ if (describeResponse.services[0].propagateTags != null && propagateTags === '') {
462
+ propagateTags = describeResponse.services[0].propagateTags;
463
+ core.debug(`Current service 'propagateTags' value '${describeResponse.services[0].propagateTags}' will be set to service`);
464
+ }
541
465
542
466
if (!serviceResponse.deploymentController || !serviceResponse.deploymentController.type || serviceResponse.deploymentController.type === 'ECS') {
543
467
// Service uses the 'ECS' deployment controller, so we can call UpdateService
0 commit comments