Skip to content

Commit

Permalink
Issue #3534: Tag compute resources according to the tool's metadata -…
Browse files Browse the repository at this point in the history
… cleanup
  • Loading branch information
ekazachkova committed May 30, 2024
1 parent 5552586 commit bb7ab70
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
import org.apache.commons.lang.math.NumberUtils;
import org.apache.commons.lang3.EnumUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.util.Strings;
import org.springframework.scheduling.support.CronTrigger;
import org.springframework.util.AntPathMatcher;

Expand All @@ -51,6 +50,7 @@
import java.util.Map;
import java.util.Optional;
import java.util.function.BiPredicate;
import java.util.stream.Stream;

import static com.epam.pipeline.manager.preference.SystemPreferences.DOCKER_SECURITY_TOOL_SCAN_CLAIR_ROOT_URL;

Expand Down Expand Up @@ -305,10 +305,12 @@ public static BiPredicate<String, Map<String, Preference>> isNullOrValidEnum(fin

public static final BiPredicate<String, Map<String, Preference>> isValidInstanceTags =
(pref, dependencies) -> {
if (Arrays.stream(Optional.ofNullable(pref)
.filter(StringUtils::isNotBlank)
.map(value -> value.split(","))
.orElse(Strings.EMPTY_ARRAY))
if (Optional.ofNullable(pref)
.filter(StringUtils::isNotBlank)
.map(value -> value.split(","))
.map(Arrays::stream)
.orElseGet(Stream::empty)
.filter(StringUtils::isNotBlank)
.anyMatch(tag -> tag.toUpperCase(Locale.ROOT).equals(NOT_ALLOWED_INSTANCE_TAG))) {
throw new IllegalArgumentException("Tag 'Name' is not allowed for custom instance tags.");
}
Expand Down

0 comments on commit bb7ab70

Please sign in to comment.