Signed-off-by: Bogdan Nechyporenko <bnechyporenko@bol.com>
This commit is contained in:
Bogdan Nechyporenko
2025-02-19 19:12:08 +01:00
parent 6c8e7813ab
commit 12314117c7
7 changed files with 3 additions and 32 deletions
-1
View File
@@ -1,6 +1,5 @@
---
'@backstage/plugin-scaffolder-backend-module-gitlab': patch
'@backstage/plugin-scaffolder-node': patch
---
Made gitlab:issue:edit action idempotent.
@@ -16,10 +16,7 @@
import { InputError } from '@backstage/errors';
import { ScmIntegrationRegistry } from '@backstage/integration';
import {
createTemplateAction,
generateStableHash,
} from '@backstage/plugin-scaffolder-node';
import { createTemplateAction } from '@backstage/plugin-scaffolder-node';
import commonGitlabConfig, {
IssueStateEvent,
IssueType,
@@ -227,9 +224,7 @@ export const editGitlabIssueAction = (options: {
};
const editedIssue = await ctx.checkpoint({
key: `issue.edit.${projectId}.${issueIid}.${generateStableHash(
editIssueOptions,
)}`,
key: `issue.edit.${projectId}.${issueIid}`,
fn: async () => {
const response = (await api.Issues.edit(
projectId,
-1
View File
@@ -62,7 +62,6 @@
"@backstage/plugin-scaffolder-common": "workspace:^",
"@backstage/types": "workspace:^",
"concat-stream": "^2.0.0",
"fast-json-stable-stringify": "^2.1.0",
"fs-extra": "^11.2.0",
"globby": "^11.0.0",
"isomorphic-git": "^1.23.0",
-3
View File
@@ -219,9 +219,6 @@ export function fetchFile(options: {
token?: string;
}): Promise<void>;
// @public
export function generateStableHash(entity: object): string;
// @public (undocumented)
export const getRepoSourceDirectory: (
workspacePath: string,
+1 -5
View File
@@ -33,8 +33,4 @@ export {
createBranch,
cloneRepo,
} from './gitHelpers';
export {
parseRepoUrl,
getRepoSourceDirectory,
generateStableHash,
} from './util';
export { parseRepoUrl, getRepoSourceDirectory } from './util';
@@ -14,8 +14,6 @@
* limitations under the License.
*/
import stableStringify from 'fast-json-stable-stringify';
import { createHash } from 'crypto';
import { InputError } from '@backstage/errors';
import { isChildPath } from '@backstage/backend-plugin-api';
import { join as joinPath, normalize as normalizePath } from 'path';
@@ -126,15 +124,3 @@ function checkRequiredParams(repoUrl: URL, ...params: string[]) {
}
}
}
/**
* @public
*
* Intended to be used in checkpoint function.
* If the object has to be part of the checkpoint's key, this function will help you create a hash for it.
*/
export function generateStableHash(entity: object) {
return createHash('sha1')
.update(stableStringify({ ...entity }))
.digest('hex');
}
-1
View File
@@ -7501,7 +7501,6 @@ __metadata:
"@backstage/plugin-scaffolder-common": "workspace:^"
"@backstage/types": "workspace:^"
concat-stream: ^2.0.0
fast-json-stable-stringify: ^2.1.0
fs-extra: ^11.2.0
globby: ^11.0.0
isomorphic-git: ^1.23.0