Skip to content

Commit

Permalink
Merge pull request #661 from HaveAGitGat/tags_fix
Browse files Browse the repository at this point in the history
Trim and filter tags
  • Loading branch information
HaveAGitGat committed Jun 10, 2024
2 parents c132a2f + b6a2df1 commit 6d6ff0b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ var plugin = function (args) {
var currentTags = [];
requiredTags.push("require".concat(requiredWorkerType));
if (requiredNodeTags) {
requiredTags = requiredTags.concat(requiredNodeTags.split(',').map(function (tag) { return tag.trim(); }));
requiredTags = requiredTags.concat(requiredNodeTags.split(','));
}
var currentWorkerType = args.workerType;
if (requiredWorkerType === 'CPUorGPU') {
Expand All @@ -86,8 +86,10 @@ var plugin = function (args) {
}
}
if (args.nodeTags) {
currentTags = currentTags.concat(args.nodeTags.split(',').map(function (tag) { return tag.trim(); }));
currentTags = currentTags.concat(args.nodeTags.split(','));
}
requiredTags = requiredTags.map(function (tag) { return tag.trim(); }).filter(function (tag) { return tag !== ''; });
currentTags = currentTags.map(function (tag) { return tag.trim(); }).filter(function (tag) { return tag !== ''; });
args.jobLog("Required Tags: ".concat(requiredTags.join(',')));
args.jobLog("Current Tags: ".concat(currentTags.join(',')));
var isSubset = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ const plugin = (args: IpluginInputArgs): IpluginOutputArgs => {

requiredTags.push(`require${requiredWorkerType}`);
if (requiredNodeTags) {
requiredTags = requiredTags.concat(requiredNodeTags.split(',').map((tag) => tag.trim()));
requiredTags = requiredTags.concat(requiredNodeTags.split(','));
}

const currentWorkerType = args.workerType;
Expand All @@ -102,9 +102,12 @@ const plugin = (args: IpluginInputArgs): IpluginOutputArgs => {
}

if (args.nodeTags) {
currentTags = currentTags.concat(args.nodeTags.split(',').map((tag) => tag.trim()));
currentTags = currentTags.concat(args.nodeTags.split(','));
}

requiredTags = requiredTags.map((tag) => tag.trim()).filter((tag) => tag !== '');
currentTags = currentTags.map((tag) => tag.trim()).filter((tag) => tag !== '');

args.jobLog(`Required Tags: ${requiredTags.join(',')}`);
args.jobLog(`Current Tags: ${currentTags.join(',')}`);

Expand Down

0 comments on commit 6d6ff0b

Please sign in to comment.