Class ContainerImageRule
java.lang.Object
hudson.model.AbstractDescribableImpl<EphemeralContainerStepRule>
io.jenkins.plugins.kubernetes.ephemeral.EphemeralContainerStepRule
io.jenkins.plugins.kubernetes.ephemeral.rules.ContainerImageRule
- All Implemented Interfaces:
ExtensionPoint
,Describable<EphemeralContainerStepRule>
EphemeralContainerStepRule
that validates the step image. This rule is configured with a set of image
name patterns that are applied against a normalized image reference. This rule can either allow or rejects
matched images.
Patterns can use the wildcard character "*
" to match any character sequences. Patterns are separated
by newlines. Lines that start with "#
" will be ignored.
If configured to EphemeralContainerStepRule.Action.ALLOW
, if none of the supplied patterns match
the step will be rejected.
If configured to EphemeralContainerStepRule.Action.REJECT
, if any of the supplied patterns match
the step will be rejected.
- See Also:
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class io.jenkins.plugins.kubernetes.ephemeral.EphemeralContainerStepRule
EphemeralContainerStepRule.Action, EphemeralContainerStepRule.Result
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
Constructor Summary
ConstructorsConstructorDescriptionDefault rule that allows all images.ContainerImageRule
(String names, EphemeralContainerStepRule.Action action) Create new rules with image name patterns and action to perform if one of the patterns match. -
Method Summary
Modifier and TypeMethodDescriptionAction to perform when image pattern matches.getNames()
Get image name patterns to match.test
(EphemeralContainerStep step) Evaluate rule for the current step.stoString()
Methods inherited from class hudson.model.AbstractDescribableImpl
getDescriptor
-
Constructor Details
-
ContainerImageRule
public ContainerImageRule()Default rule that allows all images. -
ContainerImageRule
@DataBoundConstructor public ContainerImageRule(String names, EphemeralContainerStepRule.Action action) Create new rules with image name patterns and action to perform if one of the patterns match.- Parameters:
names
- newline separated image name patternsaction
- action to perform on match, defaults toEphemeralContainerStepRule.Action.ALLOW
ifnull
-
-
Method Details
-
test
@NonNull public Optional<EphemeralContainerStepRule.Result> test(@NonNull EphemeralContainerStep step) Description copied from class:EphemeralContainerStepRule
Evaluate rule for the current step.s- Specified by:
test
in classEphemeralContainerStepRule
- Parameters:
step
- ephemeral container step- Returns:
- rule result
-
getNames
Get image name patterns to match.- Returns:
- newline separated image name patterns
-
getAction
Action to perform when image pattern matches.- Returns:
- action
-
toString
-