Skip to content

Commit 9945a76

Browse files
avoid waiting for release tasks during deployment (#1398)
1 parent 048f89e commit 9945a76

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

src/pkg/cli/composeUp_test.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,23 @@ func TestSplitManagedAndUnmanagedServices(t *testing.T) {
217217
t.Errorf("Expected 1 unmanaged resource, got %d (%s)", len(unmanaged), unmanaged)
218218
}
219219
})
220+
221+
t.Run("release task with restart: 'no'", func(t *testing.T) {
222+
project := compose.Services{
223+
"service1": compose.ServiceConfig{
224+
Restart: "no",
225+
},
226+
}
227+
228+
managed, unmanaged := splitManagedAndUnmanagedServices(project)
229+
if len(managed) != 1 {
230+
t.Errorf("Expected 1 managed resource, got %d (%v)", len(managed), managed)
231+
}
232+
233+
if len(unmanaged) != 0 {
234+
t.Errorf("Expected 0 unmanaged resource, got %d (%v)", len(unmanaged), unmanaged)
235+
}
236+
})
220237
}
221238

222239
func TestComposeUpStops(t *testing.T) {

src/pkg/cli/tailAndMonitor.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,12 @@ func TailAndMonitor(ctx context.Context, project *compose.Project, provider clie
102102
}
103103

104104
func CanMonitorService(service compose.ServiceConfig) bool {
105+
// Services with "restart: no" are assumed to be one-off
106+
// tasks, so they are not monitored.
107+
if service.Restart == "no" {
108+
return false
109+
}
110+
105111
if service.Extensions == nil {
106112
return true
107113
}

0 commit comments

Comments
 (0)