Skip to content

Commit

Permalink
fix(3012): add tests for trigger helper (#3136)
Browse files Browse the repository at this point in the history
  • Loading branch information
yk634 authored Jun 10, 2024
1 parent b29780f commit a73ce46
Show file tree
Hide file tree
Showing 2 changed files with 1,894 additions and 7 deletions.
23 changes: 16 additions & 7 deletions plugins/builds/triggers/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -464,8 +464,7 @@ function parseJobInfo({ joinObj, currentBuild, currentPipeline, currentJob, next

return {
parentBuilds,
joinListNames,
joinParentBuilds
joinListNames
};
}

Expand All @@ -480,11 +479,21 @@ async function getBuildsForGroupEvent(groupEventId, buildFactory) {

builds.forEach(b => {
try {
b.environment = JSON.parse(b.environment);
b.parentBuilds = JSON.parse(b.parentBuilds);
b.stats = JSON.parse(b.stats);
b.meta = JSON.parse(b.meta);
b.parentBuildId = JSON.parse(b.parentBuildId);
if (typeof b.environment === 'string') {
b.environment = JSON.parse(b.environment);
}
if (typeof b.parentBuilds === 'string') {
b.parentBuilds = JSON.parse(b.parentBuilds);
}
if (typeof b.stats === 'string') {
b.stats = JSON.parse(b.stats);
}
if (typeof b.meta === 'string') {
b.meta = JSON.parse(b.meta);
}
if (typeof b.parentBuildId === 'string') {
b.parentBuildId = JSON.parse(b.parentBuildId);
}

if (b.parentBuildId) {
// parentBuildId could be the string '123', the number 123, or an array
Expand Down
Loading

0 comments on commit a73ce46

Please sign in to comment.