Skip to content

label.InitLabels: optimize - #269

Merged
kolyshkin merged 1 commit into
opencontainers:mainfrom
kolyshkin:init-labels-opt
May 12, 2026
Merged

kolyshkin merged 1 commit into
opencontainers:mainfrom
kolyshkin:init-labels-opt

Conversation

@kolyshkin

@kolyshkin kolyshkin commented May 8, 2026 •

Copy link
Copy Markdown
Collaborator

A few shortcuts for specific usage scenarios:

  1. When there are no options specified, label.InitLabels is equivalent to selinux.ContainerLabels. Return its result with no further processing.

  2. When the only option specified is "disable", don't call selinux.ContainerLabels as the call is somewhat expensive and we won't use its results (moreover, we have to free the just-generated MCS).

We still allow "disable" to be set together with other options for backward compatibility, but this should eventually be forbidden.

Also, previously "disable:" option was silently ignored, now it results in an error (as it should be).

@rhatdan

rhatdan commented May 8, 2026

Copy link
Copy Markdown
Collaborator

Needs a rebase

@kolyshkin

Copy link
Copy Markdown
Collaborator Author

Rebased; PTAL @thaJeztah

@rhatdan rhatdan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@thaJeztah thaJeztah left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@thaJeztah

Copy link
Copy Markdown
Member

Is this blocking the merge? Wondering if we should disable that requirement; it rarely really works;

Screenshot 2026-05-12 at 19 56 38

A few shortcuts for specific usage scenarios:

1. When there are no options specified, label.InitLabels is equivalent
   to selinux.ContainerLabels. Return its result with no further
   processing.

2. When the only option specified is "disable", don't call
   selinux.ContainerLabels as the call is somewhat expensive and we
   won't use its results (moreover, we have to free the just-generated
   MCS).

We still allow "disable" to be set together with other options for
backward compatibility, but this should eventually be forbidden.

Also, previously "disable:<value>" option was silently ignored,
now it results in an error.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
@kolyshkin

Copy link
Copy Markdown
Collaborator Author

Is this blocking the merge? Wondering if we should disable that requirement; it rarely really works;

It works by ensuring the CI run for a PR is done against the latest code. Once a year or so I am seeing a case when CI is green, but when a PR is merged everything is broken. In short, this is why I enabled this setting.

@kolyshkin

Copy link
Copy Markdown
Collaborator Author

Is this blocking the merge? Wondering if we should disable that requirement; it rarely really works;

It works by ensuring the CI run for a PR is done against the latest code. Once a year or so I am seeing a case when CI is green, but when a PR is merged everything is broken. In short, this is why I enabled this setting.

We also have a "update via rebase" button (unfortunately I don't know how to disable the "update via merge") that can be used to rebase (and re-run CI against current HEAD).

@thaJeztah

Copy link
Copy Markdown
Member

Yeah, it's really rare to happen though, and probably using a merge queue could help with that?

@kolyshkin

Copy link
Copy Markdown
Collaborator Author

Yeah, it's really rare to happen though, and probably using a merge queue could help with that?

Sorry for my ignorance; what is a merge queue?

@thaJeztah

Copy link
Copy Markdown
Member

github allows stacking merges instead of merging directly; I think that also does a merge (and running CI) before doing the actual merge;

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/incorporating-changes-from-a-pull-request/merging-a-pull-request-with-a-merge-queue

The merge queue provides the same benefits as the Require branches to be up to date before merging branch protection, but does not require a pull request author to update their pull request branch and wait for status checks to finish before trying to merge.

@kolyshkin
kolyshkin merged commit fb9b5b2 into opencontainers:main May 12, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants