Skip to content

Commit

Permalink
Fix handling of release / contract param as string
Browse files Browse the repository at this point in the history
Change-type: patch
  • Loading branch information
dcaputo-harmoni committed Dec 12, 2023
1 parent 58a2391 commit bb9254f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/features/ci-cd/hooks/release-versioning.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,16 @@ hooks.addPureHook('POST', 'resin', 'release', {
const custom = request.custom as CustomObjectBase;
// Releases are by final by default
custom.is_final ??= true;
// Handle case where contracts provided as stringified object
if (typeof request.values.contract === 'string') {
try {
request.values.contract = JSON.parse(request.values.contract);
} catch (err) {
throw new BadRequestError(
'Invalid contract format. Must be a valid JSON object.',
);
}
}
},
POSTRUN: async ({ api, request, result: releaseId, tx }) => {
const custom = request.custom as CustomObjectBase;
Expand Down

0 comments on commit bb9254f

Please sign in to comment.