Skip to content

Commit f2f28a7

Browse files
committed
Support TTY (pseudoTerminal) field in ContainerDefinition
1 parent 56081f8 commit f2f28a7

File tree

7 files changed

+12
-0
lines changed

7 files changed

+12
-0
lines changed

ecs-cli/modules/cli/compose/adapter/containerconfig.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ type ContainerConfig struct {
2828
MountPoints []*ecs.MountPoint
2929
PortMappings []*ecs.PortMapping
3030
Privileged bool
31+
PseudoTerminal bool
3132
ReadOnly bool
3233
ShmSize int64
3334
Tmpfs []*ecs.Tmpfs

ecs-cli/modules/cli/compose/logger/logger.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ var supportedComposeV1V2YamlOptions = []string{
5454
"security_opt",
5555
"shm_size",
5656
"tmpfs",
57+
"tty",
5758
"ulimits",
5859
"user",
5960
"volumes", // v2
@@ -85,6 +86,7 @@ var supportedFieldsInV3 = map[string]bool{
8586
"ReadOnly": true,
8687
"SecurityOpt": true,
8788
"Tmpfs": true,
89+
"Tty": true,
8890
"Ulimits": true,
8991
"User": true,
9092
"Volumes": true,

ecs-cli/modules/cli/compose/project/project_parseV1V2.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ func convertV1V2ToContainerConfig(context *project.Context, serviceName string,
129129
MemoryReservation: memoryReservation,
130130
MountPoints: mountPoints,
131131
PortMappings: portMappings,
132+
PseudoTerminal: service.Tty,
132133
Privileged: service.Privileged,
133134
ReadOnly: service.ReadOnly,
134135
ShmSize: shmSize,

ecs-cli/modules/cli/compose/project/project_parseV1V2_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ func TestParseV1V2_Version1_HappyPath(t *testing.T) {
8585
}
8686
privileged := true
8787
readonly := true
88+
tty := true
8889
securityOpts := []string{"label:type:test_virt"}
8990
shmSize := int64(128)
9091
user := "user"
@@ -144,6 +145,7 @@ func TestParseV1V2_Version1_HappyPath(t *testing.T) {
144145
security_opt:
145146
- label:type:test_virt
146147
shm_size: 128M
148+
tty: true
147149
ulimits:
148150
nproc: 65535
149151
nofile:
@@ -207,6 +209,7 @@ redis:
207209
assert.Equal(t, mountPoints, web.MountPoints, "Expected MountPoints to match")
208210
assert.ElementsMatch(t, ports, web.PortMappings, "Expected PortMappings to match")
209211
assert.Equal(t, privileged, web.Privileged, "Expected Privileged to match")
212+
assert.Equal(t, tty, web.PseudoTerminal, "Expected PseudoTerminal to match")
210213
assert.Equal(t, readonly, web.ReadOnly, "Expected ReadOnly to match")
211214
assert.Equal(t, shmSize, web.ShmSize, "Expected ShmSize to match")
212215
assert.Equal(t, user, web.User, "Expected User to match")

ecs-cli/modules/cli/compose/project/project_parseV3.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ func convertToContainerConfig(serviceConfig types.ServiceConfig, serviceVols *ad
103103
Links: serviceConfig.Links,
104104
Name: serviceConfig.Name,
105105
Privileged: serviceConfig.Privileged,
106+
PseudoTerminal: serviceConfig.Tty,
106107
ReadOnly: serviceConfig.ReadOnly,
107108
User: serviceConfig.User,
108109
WorkingDirectory: serviceConfig.WorkingDir,

ecs-cli/modules/cli/compose/project/project_parseV3_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ func TestParseV3WithOneFile(t *testing.T) {
8282
}
8383
wordpressCon.Privileged = true
8484
wordpressCon.ReadOnly = true
85+
wordpressCon.PseudoTerminal = true
8586
wordpressCon.DockerSecurityOptions = []string{"label:role:ROLE", "label:user:USER"}
8687
wordpressCon.Ulimits = []*ecs.Ulimit{
8788
{
@@ -160,6 +161,7 @@ services:
160161
awslogs-stream-prefix: wordpress
161162
tmpfs:
162163
- "/run:rw,size=1gb"
164+
tty: true
163165
read_only: true
164166
hostname: wrdhost
165167
security_opt:
@@ -746,6 +748,7 @@ func verifyContainerConfig(t *testing.T, expected, actual adapter.ContainerConfi
746748
assert.Equal(t, expected.Privileged, actual.Privileged, "Expected Privileged to match")
747749
assert.Equal(t, expected.ReadOnly, actual.ReadOnly, "Expected ReadOnly to match")
748750
assert.ElementsMatch(t, expected.Tmpfs, actual.Tmpfs, "Expected Tmpfs to match")
751+
assert.Equal(t, expected.PseudoTerminal, actual.PseudoTerminal, "Expected PseuoTerminal to match")
749752
assert.ElementsMatch(t, expected.Ulimits, actual.Ulimits, "Expected Ulimits to match")
750753
assert.Equal(t, expected.User, actual.User, "Expected User to match")
751754
assert.Equal(t, expected.WorkingDirectory, actual.WorkingDirectory, "Expected WorkingDirectory to match")

ecs-cli/modules/utils/compose/reconcile_container_def.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ func reconcileContainerDef(inputCfg *adapter.ContainerConfig, ecsConDef *Contain
5353
outputContDef.SetName(inputCfg.Name)
5454
outputContDef.SetPrivileged(inputCfg.Privileged)
5555
outputContDef.SetPortMappings(inputCfg.PortMappings)
56+
outputContDef.SetPseudoTerminal(inputCfg.PseudoTerminal)
5657
outputContDef.SetReadonlyRootFilesystem(inputCfg.ReadOnly)
5758
outputContDef.SetUlimits(inputCfg.Ulimits)
5859

0 commit comments

Comments
 (0)