Skip to content

Commit

Permalink
Allow Jenkins label selector tag to be a comma separated list (#185)
Browse files Browse the repository at this point in the history
Co-authored-by: dhoots <[email protected]>
  • Loading branch information
dlhoots and dhoots authored May 12, 2023
1 parent 8723b82 commit dc33a68
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import java.net.URL;
import java.time.Duration;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
Expand Down Expand Up @@ -124,9 +125,12 @@ private static Collection<IdCredentials> fetchCredentials() {
tags = new HashMap<>();
}

if (StringUtils.isNotBlank(labelSelector) && !labelSelector.equals(tags.get("jenkins-label"))) {
// User specified a label selector in config, but current credential does not contain a matching tag, skip iteration
continue;
if (StringUtils.isNotBlank(labelSelector)) {
String jenkinsLabels = tags.getOrDefault("jenkins-label", "");
List<String> labelSelectors = Arrays.asList(jenkinsLabels.split(","));
if (!labelSelectors.contains(labelSelector)) {
continue;
}
}

String type = tags.getOrDefault("type", DEFAULT_TYPE);
Expand Down

0 comments on commit dc33a68

Please sign in to comment.