- Notifications
You must be signed in to change notification settings - Fork1k
fix(agent/agentcontainers): fix devcontainer integration tests#19109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -161,8 +161,8 @@ func WithContainerCLI(ccli ContainerCLI) Option { | ||
// WithContainerLabelIncludeFilter sets a label filter for containers. | ||
// This option can be given multiple times to filter by multiple labels. | ||
// The behavior is such that only containers matchingallof the provided | ||
// labels will be included. | ||
func WithContainerLabelIncludeFilter(label, value string) Option { | ||
return func(api *API) { | ||
api.containerLabelIncludeFilter[label] = value | ||
@@ -927,17 +927,22 @@ func (api *API) processUpdatedContainersLocked(ctx context.Context, updated code | ||
slog.F("config_file", configFile), | ||
) | ||
// If we haven't set any include filters, we should explicitly ignore test devcontainers. | ||
if len(api.containerLabelIncludeFilter) == 0 && container.Labels[DevcontainerIsTestRunLabel] == "true" { | ||
continue | ||
} | ||
// Filter out devcontainer tests, unless explicitly set in include filters. | ||
if len(api.containerLabelIncludeFilter) > 0 { | ||
includeContainer := true | ||
for label, value := range api.containerLabelIncludeFilter { | ||
v, found := container.Labels[label] | ||
includeContainer = includeContainer && (found && v == value) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. no break when matched? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. The change is to ensureevery filter is found, instead of just one. | ||
} | ||
// Verbose debug logging is fine here since typically filters | ||
// are only used in development or testing environments. | ||
if !includeContainer { | ||
logger.Debug(ctx, "container does not match include filter, ignoring devcontainer", slog.F("container_labels", container.Labels), slog.F("include_filter", api.containerLabelIncludeFilter)) | ||
continue | ||
} | ||
Uh oh!
There was an error while loading.Please reload this page.