chore: added gitlab module

Signed-off-by: blam <ben@blam.sh>
This commit is contained in:
blam
2023-12-06 12:45:30 +01:00
parent fbb1071987
commit 88c9a158c2
9 changed files with 42 additions and 15 deletions
@@ -31,16 +31,18 @@
"postpack": "backstage-cli package postpack"
},
"dependencies": {
"@backstage/backend-common": "workspace:^",
"@backstage/config": "workspace:^",
"@backstage/errors": "workspace:^",
"@backstage/integration": "workspace:^",
"@backstage/plugin-scaffolder-node": "workspace:^",
"@gitbeaker/node": "^35.8.0",
"@gitbeaker/core": "^35.8.0",
"@gitbeaker/node": "^35.1.0",
"yaml": "^2.0.0",
"zod": "^3.21.4"
},
"devDependencies": {
"@backstage/backend-common": "workspace:^",
"@backstage/backend-test-utils": "workspace:^",
"@backstage/cli": "workspace:^",
"@backstage/core-app-api": "workspace:^"
},
@@ -15,8 +15,9 @@
*/
import yaml from 'yaml';
jest.mock('../helpers', () => {
jest.mock('@backstage/plugin-scaffolder-node', () => {
return {
...jest.requireActual('@backstage/plugin-scaffolder-node'),
initRepoAndPush: jest.fn().mockResolvedValue({
commitHash: '220f19cc36b551763d157f1b5e4a4b446165dbd6',
}),
@@ -27,11 +28,11 @@ jest.mock('../helpers', () => {
});
import { createPublishGitlabAction } from './gitlab';
import { initRepoAndPush } from '@backstage/plugin-scaffolder-node';
import { ScmIntegrations } from '@backstage/integration';
import { ConfigReader } from '@backstage/config';
import { getVoidLogger } from '@backstage/backend-common';
import { PassThrough } from 'stream';
import { initRepoAndPush } from '../helpers';
import { examples } from './gitlab.examples';
const mockGitlabClient = {
@@ -14,8 +14,9 @@
* limitations under the License.
*/
jest.mock('../helpers', () => {
jest.mock('@backstage/plugin-scaffolder-node', () => {
return {
...jest.requireActual('@backstage/plugin-scaffolder-node'),
initRepoAndPush: jest.fn().mockResolvedValue({
commitHash: '220f19cc36b551763d157f1b5e4a4b446165dbd6',
}),
@@ -30,7 +31,7 @@ import { ScmIntegrations } from '@backstage/integration';
import { ConfigReader } from '@backstage/config';
import { getVoidLogger } from '@backstage/backend-common';
import { PassThrough } from 'stream';
import { initRepoAndPush } from '../helpers';
import { initRepoAndPush } from '@backstage/plugin-scaffolder-node';
const mockGitlabClient = {
Namespaces: {
@@ -18,8 +18,11 @@ import { InputError } from '@backstage/errors';
import { ScmIntegrationRegistry } from '@backstage/integration';
import { createTemplateAction } from '@backstage/plugin-scaffolder-node';
import { Gitlab } from '@gitbeaker/node';
import { initRepoAndPush } from '../helpers';
import { getRepoSourceDirectory, parseRepoUrl } from './util';
import {
initRepoAndPush,
getRepoSourceDirectory,
parseRepoUrl,
} from '@backstage/plugin-scaffolder-node';
import { Config } from '@backstage/config';
import { examples } from './gitlab.examples';
@@ -14,15 +14,17 @@
* limitations under the License.
*/
import { createTemplateAction } from '@backstage/plugin-scaffolder-node';
import {
createTemplateAction,
parseRepoUrl,
serializeDirectoryContents,
} from '@backstage/plugin-scaffolder-node';
import { Gitlab } from '@gitbeaker/node';
import { Types } from '@gitbeaker/core';
import path from 'path';
import { ScmIntegrationRegistry } from '@backstage/integration';
import { InputError } from '@backstage/errors';
import { parseRepoUrl } from './util';
import { resolveSafeChildPath } from '@backstage/backend-common';
import { serializeDirectoryContents } from '../../../../lib/files';
/**
* Create a new action that creates a gitlab merge request.
@@ -0,0 +1,21 @@
/*
* Copyright 2023 The Backstage Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export * from './createGitlabGroupEnsureExistsAction';
export * from './createGitlabProjectDeployTokenAction';
export * from './createGitlabProjectAccessTokenAction';
export * from './createGitlabProjectVariableAction';
export * from './gitlab';
export * from './gitlabMergeRequest';
@@ -19,7 +19,4 @@
*
* @packageDocumentation
*/
export * from './actions/createGitlabGroupEnsureExistsAction';
export * from './actions/createGitlabProjectDeployTokenAction';
export * from './actions/createGitlabProjectAccessTokenAction';
export * from './actions/createGitlabProjectVariableAction';
export * from './actions';