@backstage/plugin-scaffolder-backend-module-gitea 0.0.0-nightly-20240219021126 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @backstage/plugin-scaffolder-backend-module-gitea
2
2
 
3
- ## 0.0.0-nightly-20240219021126
3
+ ## 0.1.0
4
4
 
5
5
  ### Minor Changes
6
6
 
@@ -8,9 +8,11 @@
8
8
 
9
9
  ### Patch Changes
10
10
 
11
+ - ef0f44e: - Fix issue for infinite loop when repository already exists
12
+ - Log the root cause of error reported by `checkGiteaOrg`
11
13
  - Updated dependencies
12
- - @backstage/backend-plugin-api@0.0.0-nightly-20240219021126
13
- - @backstage/integration@0.0.0-nightly-20240219021126
14
- - @backstage/plugin-scaffolder-node@0.0.0-nightly-20240219021126
14
+ - @backstage/backend-plugin-api@0.6.10
15
+ - @backstage/integration@1.9.0
16
+ - @backstage/plugin-scaffolder-node@0.3.0
15
17
  - @backstage/config@1.1.1
16
18
  - @backstage/errors@1.2.3
package/README.md CHANGED
@@ -28,8 +28,8 @@ integrations:
28
28
  password: '<GITEA_LOCALHOST_PASSWORD>'
29
29
  ```
30
30
 
31
- **NOTE**: As backstage will issue HTTPS/TLS requests to the gitea instance, it is needed to configure `gitea` with a valid certificate or at least with a
32
- self-signed certificate `gitea cert --host localhost -ca`. Don't forget to set the env var `NODE_EXTRA_CA_CERTS` to point to the CA file before launching backstage !
31
+ **Important**: As backstage will issue HTTPS/TLS requests to the gitea instance, it is needed to configure `gitea` with a valid certificate or at least with a
32
+ self-signed certificate `gitea cert --host localhost -ca` trusted by a CA authority. Don't forget to set the env var `NODE_EXTRA_CA_CERTS` to point to the CA file before launching backstage !
33
33
 
34
34
  When done, you can create a template which:
35
35
 
@@ -69,18 +69,8 @@ spec:
69
69
  action: fetch:template
70
70
  input:
71
71
  url: ./skeleton
72
- copyWithoutTemplating:
73
- - .github/workflows/*
74
72
  values:
75
- component_id: ${{ parameters.component_id }}
76
- namespace: ${{ parameters.component_id }}-dev
77
- description: ${{ parameters.description }}
78
- group_id: ${{ parameters.group_id }}
79
- artifact_id: ${{ parameters.artifact_id }}
80
- java_package_name: ${{ parameters.java_package_name }}
81
- owner: ${{ parameters.owner }}
82
- destination: ${{ (parameters.repoUrl | parseRepoUrl).owner }}/${{ (parameters.repoUrl | parseRepoUrl).repo }
83
- port: 8080
73
+ name: ${{ parameters.name }}
84
74
 
85
75
  - id: publish
86
76
  name: Publishing to a gitea git repository
package/dist/index.cjs.js CHANGED
@@ -184,7 +184,9 @@ const checkGiteaOrg = async (config, options) => {
184
184
  getOptions
185
185
  );
186
186
  } catch (e) {
187
- throw new Error(`Unable to get the Organization: ${owner}, ${e}`);
187
+ throw new Error(
188
+ `Unable to get the Organization: ${owner}; Error cause: ${e.cause.message}`
189
+ );
188
190
  }
189
191
  if (response.status !== 200) {
190
192
  throw new Error(
@@ -243,6 +245,8 @@ async function checkAvailabilityGiteaRepository(maxDuration, integrationConfig,
243
245
  });
244
246
  if (response.status !== 200) {
245
247
  await sleep(1e3);
248
+ } else {
249
+ break;
246
250
  }
247
251
  }
248
252
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs.js","sources":["../src/actions/gitea.examples.ts","../src/actions/gitea.ts","../src/module.ts"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { TemplateExample } from '@backstage/plugin-scaffolder-node';\nimport yaml from 'yaml';\n\nexport const examples: TemplateExample[] = [\n {\n description:\n 'Initializes a Gitea repository using the content of the workspace and publish it to Gitea with default configuration.',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:gitea',\n name: 'Publish to Gitea',\n input: {\n repoUrl: 'gitea.com?repo=repo&owner=owner',\n },\n },\n ],\n }),\n },\n {\n description: 'Initializes a Gitea repository with a description.',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:gitea',\n name: 'Publish to Gitea',\n input: {\n repoUrl: 'gitea.com?repo=repo&owner=owner',\n description: 'Initialize a gitea repository',\n },\n },\n ],\n }),\n },\n {\n description:\n 'Initializes a Gitea repository with a default Branch, if not set defaults to main',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:gitea',\n name: 'Publish to Gitea',\n input: {\n repoUrl: 'gitea.com?repo=repo&owner=owner',\n defaultBranch: 'main',\n },\n },\n ],\n }),\n },\n {\n description:\n 'Initializes a Gitea repository with an initial commit message, if not set defaults to initial commit',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:gitea',\n name: 'Publish to Gitea',\n input: {\n repoUrl: 'gitea.com?repo=repo&owner=owner',\n gitCommitMessage: 'Initial Commit Message',\n },\n },\n ],\n }),\n },\n {\n description:\n 'Initializes a Gitea repository with a repo Author Name, if not set defaults to Scaffolder',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:gitea',\n name: 'Publish to Gitea',\n input: {\n repoUrl: 'gitea.com?repo=repo&owner=owner',\n gitAuthorName: 'John Doe',\n },\n },\n ],\n }),\n },\n {\n description: 'Initializes a Gitea repository with a repo Author Email',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:gitea',\n name: 'Publish to Gitea',\n input: {\n repoUrl: 'gitea.com?repo=repo&owner=owner',\n gitAuthorEmail: 'johndoe@email.com',\n },\n },\n ],\n }),\n },\n {\n description:\n 'Path within the workspace that will be used as the repository root. If omitted, the entire workspace will be published as the repository',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:gitea',\n name: 'Publish to Gitea',\n input: {\n repoUrl: 'gitea.com?repo=repo&owner=owner',\n sourcePath: 'repository/',\n },\n },\n ],\n }),\n },\n {\n description: 'Initializes a Gitea repository with all properties being set',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:gitea',\n name: 'Publish to Gitea',\n input: {\n repoUrl: 'gitea.com?repo=repo&owner=owner',\n description: 'Initialize a gitea repository',\n defaultBranch: 'staging',\n gitCommitMessage: 'Initial Commit Message',\n gitAuthorName: 'John Doe',\n gitAuthorEmail: 'johndoe@email.com',\n sourcePath: 'repository/',\n },\n },\n ],\n }),\n },\n];\n","/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { InputError } from '@backstage/errors';\nimport { Config } from '@backstage/config';\nimport {\n getGiteaRequestOptions,\n GiteaIntegrationConfig,\n ScmIntegrationRegistry,\n} from '@backstage/integration';\nimport {\n ActionContext,\n createTemplateAction,\n getRepoSourceDirectory,\n initRepoAndPush,\n parseRepoUrl,\n} from '@backstage/plugin-scaffolder-node';\nimport { examples } from './gitea.examples';\nimport crypto from 'crypto';\n\nconst checkGiteaContentUrl = async (\n config: GiteaIntegrationConfig,\n options: {\n owner?: string;\n repo: string;\n defaultBranch?: string;\n },\n): Promise<Response> => {\n const { owner, repo, defaultBranch } = options;\n let response: Response;\n const getOptions: RequestInit = {\n method: 'GET',\n };\n\n try {\n response = await fetch(\n `${config.baseUrl}/${owner}/${repo}/src/branch/${defaultBranch}`,\n getOptions,\n );\n } catch (e) {\n throw new Error(\n `Unable to get the repository: ${owner}/${repo} metadata , ${e}`,\n );\n }\n return response;\n};\n\nconst checkGiteaOrg = async (\n config: GiteaIntegrationConfig,\n options: {\n owner: string;\n },\n): Promise<void> => {\n const { owner } = options;\n let response: Response;\n // check first if the org = owner exists\n const getOptions: RequestInit = {\n method: 'GET',\n headers: {\n ...getGiteaRequestOptions(config).headers,\n 'Content-Type': 'application/json',\n },\n };\n try {\n response = await fetch(\n `${config.baseUrl}/api/v1/orgs/${owner}`,\n getOptions,\n );\n } catch (e) {\n throw new Error(`Unable to get the Organization: ${owner}, ${e}`);\n }\n if (response.status !== 200) {\n throw new Error(\n `Organization ${owner} do not exist. Please create it first !`,\n );\n }\n};\n\nconst createGiteaProject = async (\n config: GiteaIntegrationConfig,\n options: {\n projectName: string;\n owner?: string;\n description: string;\n },\n): Promise<void> => {\n const { projectName, description, owner } = options;\n\n /*\n Several options exist to create a repository using either the user or organisation\n User: https://gitea.com/api/swagger#/user/createCurrentUserRepo\n Api: URL/api/v1/user/repos\n Remark: The user is the username defined part of the backstage integration config for the gitea URL !\n\n Org: https://gitea.com/api/swagger#/organization/createOrgRepo\n Api: URL/api/v1/orgs/${org_owner}/repos\n This is the default scenario that we support currently\n */\n let response: Response;\n\n const postOptions: RequestInit = {\n method: 'POST',\n body: JSON.stringify({\n name: projectName,\n description,\n }),\n headers: {\n ...getGiteaRequestOptions(config).headers,\n 'Content-Type': 'application/json',\n },\n };\n try {\n response = await fetch(\n `${config.baseUrl}/api/v1/orgs/${owner}/repos`,\n postOptions,\n );\n } catch (e) {\n throw new Error(`Unable to create repository, ${e}`);\n }\n if (response.status !== 201) {\n throw new Error(\n `Unable to create repository, ${response.status} ${\n response.statusText\n }, ${await response.text()}`,\n );\n }\n};\n\nconst generateCommitMessage = (\n config: Config,\n commitSubject?: string,\n): string => {\n const changeId = crypto.randomBytes(20).toString('hex');\n const msg = `${\n config.getOptionalString('scaffolder.defaultCommitMessage') || commitSubject\n }\\n\\nChange-Id: I${changeId}`;\n return msg;\n};\n\nasync function checkAvailabilityGiteaRepository(\n maxDuration: number,\n integrationConfig: GiteaIntegrationConfig,\n options: {\n owner?: string;\n repo: string;\n defaultBranch: string;\n ctx: ActionContext<any>;\n },\n) {\n const startTimestamp = Date.now();\n\n const { owner, repo, defaultBranch, ctx } = options;\n const sleep = (ms: number | undefined) => new Promise(r => setTimeout(r, ms));\n let response: Response;\n\n while (Date.now() - startTimestamp < maxDuration) {\n if (ctx.signal?.aborted) return;\n\n response = await checkGiteaContentUrl(integrationConfig, {\n owner,\n repo,\n defaultBranch,\n });\n\n if (response.status !== 200) {\n // Repository is not yet available/accessible ...\n await sleep(1000);\n }\n }\n}\n\n/**\n * Creates a new action that initializes a git repository using the content of the workspace.\n * and publishes it to a Gitea instance.\n * @public\n */\nexport function createPublishGiteaAction(options: {\n integrations: ScmIntegrationRegistry;\n config: Config;\n}) {\n const { integrations, config } = options;\n\n return createTemplateAction<{\n repoUrl: string;\n description: string;\n defaultBranch?: string;\n gitCommitMessage?: string;\n gitAuthorName?: string;\n gitAuthorEmail?: string;\n sourcePath?: string;\n }>({\n id: 'publish:gitea',\n description:\n 'Initializes a git repository using the content of the workspace, and publishes it to Gitea.',\n examples,\n schema: {\n input: {\n type: 'object',\n required: ['repoUrl'],\n properties: {\n repoUrl: {\n title: 'Repository Location',\n type: 'string',\n },\n description: {\n title: 'Repository Description',\n type: 'string',\n },\n defaultBranch: {\n title: 'Default Branch',\n type: 'string',\n description: `Sets the default branch on the repository. The default value is 'main'`,\n },\n gitCommitMessage: {\n title: 'Git Commit Message',\n type: 'string',\n description: `Sets the commit message on the repository. The default value is 'initial commit'`,\n },\n gitAuthorName: {\n title: 'Default Author Name',\n type: 'string',\n description: `Sets the default author name for the commit. The default value is 'Scaffolder'`,\n },\n gitAuthorEmail: {\n title: 'Default Author Email',\n type: 'string',\n description: `Sets the default author email for the commit.`,\n },\n sourcePath: {\n title: 'Source Path',\n type: 'string',\n description: `Path within the workspace that will be used as the repository root. If omitted, the entire workspace will be published as the repository.`,\n },\n },\n },\n output: {\n type: 'object',\n properties: {\n remoteUrl: {\n title: 'A URL to the repository with the provider',\n type: 'string',\n },\n repoContentsUrl: {\n title: 'A URL to the root of the repository',\n type: 'string',\n },\n commitHash: {\n title: 'The git commit hash of the initial commit',\n type: 'string',\n },\n },\n },\n },\n async handler(ctx) {\n const {\n repoUrl,\n description,\n defaultBranch = 'main',\n gitAuthorName,\n gitAuthorEmail,\n gitCommitMessage = 'initial commit',\n sourcePath,\n } = ctx.input;\n\n const { repo, host, owner } = parseRepoUrl(repoUrl, integrations);\n\n const integrationConfig = integrations.gitea.byHost(host);\n if (!integrationConfig) {\n throw new InputError(\n `No matching integration configuration for host ${host}, please check your integrations config`,\n );\n }\n const { username, password } = integrationConfig.config;\n\n if (!username || !password) {\n throw new Error('Credentials for the gitea ${host} required.');\n }\n\n // check if the org exists within the gitea server\n if (owner) {\n await checkGiteaOrg(integrationConfig.config, { owner });\n }\n\n await createGiteaProject(integrationConfig.config, {\n description,\n owner: owner,\n projectName: repo,\n });\n\n const auth = {\n username: username,\n password: password,\n };\n const gitAuthorInfo = {\n name: gitAuthorName\n ? gitAuthorName\n : config.getOptionalString('scaffolder.defaultAuthor.name'),\n email: gitAuthorEmail\n ? gitAuthorEmail\n : config.getOptionalString('scaffolder.defaultAuthor.email'),\n };\n // The owner to be used should be either the org name or user authenticated with the gitea server\n const remoteUrl = `${integrationConfig.config.baseUrl}/${owner}/${repo}.git`;\n const commitResult = await initRepoAndPush({\n dir: getRepoSourceDirectory(ctx.workspacePath, sourcePath),\n remoteUrl,\n auth,\n defaultBranch,\n logger: ctx.logger,\n commitMessage: generateCommitMessage(config, gitCommitMessage),\n gitAuthorInfo,\n });\n\n // Check if the gitea repo URL is available before to exit\n const maxDuration = 20000; // 20 seconds\n await checkAvailabilityGiteaRepository(\n maxDuration,\n integrationConfig.config,\n {\n owner,\n repo,\n defaultBranch,\n ctx,\n },\n );\n\n const repoContentsUrl = `${integrationConfig.config.baseUrl}/${owner}/${repo}/src/branch/${defaultBranch}/`;\n ctx.output('remoteUrl', remoteUrl);\n ctx.output('commitHash', commitResult?.commitHash);\n ctx.output('repoContentsUrl', repoContentsUrl);\n },\n });\n}\n","/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n createBackendModule,\n coreServices,\n} from '@backstage/backend-plugin-api';\nimport { scaffolderActionsExtensionPoint } from '@backstage/plugin-scaffolder-node/alpha';\nimport { createPublishGiteaAction } from './actions';\nimport { ScmIntegrations } from '@backstage/integration';\n\n/**\n * @public\n * The Gitea Module for the Scaffolder Backend\n */\nexport const giteaModule = createBackendModule({\n pluginId: 'scaffolder',\n moduleId: 'gitea',\n register({ registerInit }) {\n registerInit({\n deps: {\n scaffolder: scaffolderActionsExtensionPoint,\n config: coreServices.rootConfig,\n },\n async init({ scaffolder, config }) {\n const integrations = ScmIntegrations.fromConfig(config);\n scaffolder.addActions(\n createPublishGiteaAction({\n integrations,\n config,\n }),\n );\n },\n });\n },\n});\n"],"names":["yaml","getGiteaRequestOptions","crypto","createTemplateAction","parseRepoUrl","InputError","initRepoAndPush","getRepoSourceDirectory","createBackendModule","scaffolderActionsExtensionPoint","coreServices","ScmIntegrations"],"mappings":";;;;;;;;;;;;;;;;;AAmBO,MAAM,QAA8B,GAAA;AAAA,EACzC;AAAA,IACE,WACE,EAAA,uHAAA;AAAA,IACF,OAAA,EAASA,yBAAK,SAAU,CAAA;AAAA,MACtB,KAAO,EAAA;AAAA,QACL;AAAA,UACE,EAAI,EAAA,SAAA;AAAA,UACJ,MAAQ,EAAA,eAAA;AAAA,UACR,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H;AACF,CAAC;;;;;"}
1
+ {"version":3,"file":"index.cjs.js","sources":["../src/actions/gitea.examples.ts","../src/actions/gitea.ts","../src/module.ts"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { TemplateExample } from '@backstage/plugin-scaffolder-node';\nimport yaml from 'yaml';\n\nexport const examples: TemplateExample[] = [\n {\n description:\n 'Initializes a Gitea repository using the content of the workspace and publish it to Gitea with default configuration.',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:gitea',\n name: 'Publish to Gitea',\n input: {\n repoUrl: 'gitea.com?repo=repo&owner=owner',\n },\n },\n ],\n }),\n },\n {\n description: 'Initializes a Gitea repository with a description.',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:gitea',\n name: 'Publish to Gitea',\n input: {\n repoUrl: 'gitea.com?repo=repo&owner=owner',\n description: 'Initialize a gitea repository',\n },\n },\n ],\n }),\n },\n {\n description:\n 'Initializes a Gitea repository with a default Branch, if not set defaults to main',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:gitea',\n name: 'Publish to Gitea',\n input: {\n repoUrl: 'gitea.com?repo=repo&owner=owner',\n defaultBranch: 'main',\n },\n },\n ],\n }),\n },\n {\n description:\n 'Initializes a Gitea repository with an initial commit message, if not set defaults to initial commit',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:gitea',\n name: 'Publish to Gitea',\n input: {\n repoUrl: 'gitea.com?repo=repo&owner=owner',\n gitCommitMessage: 'Initial Commit Message',\n },\n },\n ],\n }),\n },\n {\n description:\n 'Initializes a Gitea repository with a repo Author Name, if not set defaults to Scaffolder',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:gitea',\n name: 'Publish to Gitea',\n input: {\n repoUrl: 'gitea.com?repo=repo&owner=owner',\n gitAuthorName: 'John Doe',\n },\n },\n ],\n }),\n },\n {\n description: 'Initializes a Gitea repository with a repo Author Email',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:gitea',\n name: 'Publish to Gitea',\n input: {\n repoUrl: 'gitea.com?repo=repo&owner=owner',\n gitAuthorEmail: 'johndoe@email.com',\n },\n },\n ],\n }),\n },\n {\n description:\n 'Path within the workspace that will be used as the repository root. If omitted, the entire workspace will be published as the repository',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:gitea',\n name: 'Publish to Gitea',\n input: {\n repoUrl: 'gitea.com?repo=repo&owner=owner',\n sourcePath: 'repository/',\n },\n },\n ],\n }),\n },\n {\n description: 'Initializes a Gitea repository with all properties being set',\n example: yaml.stringify({\n steps: [\n {\n id: 'publish',\n action: 'publish:gitea',\n name: 'Publish to Gitea',\n input: {\n repoUrl: 'gitea.com?repo=repo&owner=owner',\n description: 'Initialize a gitea repository',\n defaultBranch: 'staging',\n gitCommitMessage: 'Initial Commit Message',\n gitAuthorName: 'John Doe',\n gitAuthorEmail: 'johndoe@email.com',\n sourcePath: 'repository/',\n },\n },\n ],\n }),\n },\n];\n","/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { InputError } from '@backstage/errors';\nimport { Config } from '@backstage/config';\nimport {\n getGiteaRequestOptions,\n GiteaIntegrationConfig,\n ScmIntegrationRegistry,\n} from '@backstage/integration';\nimport {\n ActionContext,\n createTemplateAction,\n getRepoSourceDirectory,\n initRepoAndPush,\n parseRepoUrl,\n} from '@backstage/plugin-scaffolder-node';\nimport { examples } from './gitea.examples';\nimport crypto from 'crypto';\n\nconst checkGiteaContentUrl = async (\n config: GiteaIntegrationConfig,\n options: {\n owner?: string;\n repo: string;\n defaultBranch?: string;\n },\n): Promise<Response> => {\n const { owner, repo, defaultBranch } = options;\n let response: Response;\n const getOptions: RequestInit = {\n method: 'GET',\n };\n\n try {\n response = await fetch(\n `${config.baseUrl}/${owner}/${repo}/src/branch/${defaultBranch}`,\n getOptions,\n );\n } catch (e) {\n throw new Error(\n `Unable to get the repository: ${owner}/${repo} metadata , ${e}`,\n );\n }\n return response;\n};\n\nconst checkGiteaOrg = async (\n config: GiteaIntegrationConfig,\n options: {\n owner: string;\n },\n): Promise<void> => {\n const { owner } = options;\n let response: Response;\n // check first if the org = owner exists\n const getOptions: RequestInit = {\n method: 'GET',\n headers: {\n ...getGiteaRequestOptions(config).headers,\n 'Content-Type': 'application/json',\n },\n };\n try {\n response = await fetch(\n `${config.baseUrl}/api/v1/orgs/${owner}`,\n getOptions,\n );\n } catch (e) {\n throw new Error(\n `Unable to get the Organization: ${owner}; Error cause: ${e.cause.message}`,\n );\n }\n if (response.status !== 200) {\n throw new Error(\n `Organization ${owner} do not exist. Please create it first !`,\n );\n }\n};\n\nconst createGiteaProject = async (\n config: GiteaIntegrationConfig,\n options: {\n projectName: string;\n owner?: string;\n description: string;\n },\n): Promise<void> => {\n const { projectName, description, owner } = options;\n\n /*\n Several options exist to create a repository using either the user or organisation\n User: https://gitea.com/api/swagger#/user/createCurrentUserRepo\n Api: URL/api/v1/user/repos\n Remark: The user is the username defined part of the backstage integration config for the gitea URL !\n\n Org: https://gitea.com/api/swagger#/organization/createOrgRepo\n Api: URL/api/v1/orgs/${org_owner}/repos\n This is the default scenario that we support currently\n */\n let response: Response;\n\n const postOptions: RequestInit = {\n method: 'POST',\n body: JSON.stringify({\n name: projectName,\n description,\n }),\n headers: {\n ...getGiteaRequestOptions(config).headers,\n 'Content-Type': 'application/json',\n },\n };\n try {\n response = await fetch(\n `${config.baseUrl}/api/v1/orgs/${owner}/repos`,\n postOptions,\n );\n } catch (e) {\n throw new Error(`Unable to create repository, ${e}`);\n }\n if (response.status !== 201) {\n throw new Error(\n `Unable to create repository, ${response.status} ${\n response.statusText\n }, ${await response.text()}`,\n );\n }\n};\n\nconst generateCommitMessage = (\n config: Config,\n commitSubject?: string,\n): string => {\n const changeId = crypto.randomBytes(20).toString('hex');\n const msg = `${\n config.getOptionalString('scaffolder.defaultCommitMessage') || commitSubject\n }\\n\\nChange-Id: I${changeId}`;\n return msg;\n};\n\nasync function checkAvailabilityGiteaRepository(\n maxDuration: number,\n integrationConfig: GiteaIntegrationConfig,\n options: {\n owner?: string;\n repo: string;\n defaultBranch: string;\n ctx: ActionContext<any>;\n },\n) {\n const startTimestamp = Date.now();\n\n const { owner, repo, defaultBranch, ctx } = options;\n const sleep = (ms: number | undefined) => new Promise(r => setTimeout(r, ms));\n let response: Response;\n\n while (Date.now() - startTimestamp < maxDuration) {\n if (ctx.signal?.aborted) return;\n\n response = await checkGiteaContentUrl(integrationConfig, {\n owner,\n repo,\n defaultBranch,\n });\n\n if (response.status !== 200) {\n // Repository is not yet available/accessible ...\n await sleep(1000);\n } else {\n // Gitea repository exists !\n break;\n }\n }\n}\n\n/**\n * Creates a new action that initializes a git repository using the content of the workspace.\n * and publishes it to a Gitea instance.\n * @public\n */\nexport function createPublishGiteaAction(options: {\n integrations: ScmIntegrationRegistry;\n config: Config;\n}) {\n const { integrations, config } = options;\n\n return createTemplateAction<{\n repoUrl: string;\n description: string;\n defaultBranch?: string;\n gitCommitMessage?: string;\n gitAuthorName?: string;\n gitAuthorEmail?: string;\n sourcePath?: string;\n }>({\n id: 'publish:gitea',\n description:\n 'Initializes a git repository using the content of the workspace, and publishes it to Gitea.',\n examples,\n schema: {\n input: {\n type: 'object',\n required: ['repoUrl'],\n properties: {\n repoUrl: {\n title: 'Repository Location',\n type: 'string',\n },\n description: {\n title: 'Repository Description',\n type: 'string',\n },\n defaultBranch: {\n title: 'Default Branch',\n type: 'string',\n description: `Sets the default branch on the repository. The default value is 'main'`,\n },\n gitCommitMessage: {\n title: 'Git Commit Message',\n type: 'string',\n description: `Sets the commit message on the repository. The default value is 'initial commit'`,\n },\n gitAuthorName: {\n title: 'Default Author Name',\n type: 'string',\n description: `Sets the default author name for the commit. The default value is 'Scaffolder'`,\n },\n gitAuthorEmail: {\n title: 'Default Author Email',\n type: 'string',\n description: `Sets the default author email for the commit.`,\n },\n sourcePath: {\n title: 'Source Path',\n type: 'string',\n description: `Path within the workspace that will be used as the repository root. If omitted, the entire workspace will be published as the repository.`,\n },\n },\n },\n output: {\n type: 'object',\n properties: {\n remoteUrl: {\n title: 'A URL to the repository with the provider',\n type: 'string',\n },\n repoContentsUrl: {\n title: 'A URL to the root of the repository',\n type: 'string',\n },\n commitHash: {\n title: 'The git commit hash of the initial commit',\n type: 'string',\n },\n },\n },\n },\n async handler(ctx) {\n const {\n repoUrl,\n description,\n defaultBranch = 'main',\n gitAuthorName,\n gitAuthorEmail,\n gitCommitMessage = 'initial commit',\n sourcePath,\n } = ctx.input;\n\n const { repo, host, owner } = parseRepoUrl(repoUrl, integrations);\n\n const integrationConfig = integrations.gitea.byHost(host);\n if (!integrationConfig) {\n throw new InputError(\n `No matching integration configuration for host ${host}, please check your integrations config`,\n );\n }\n const { username, password } = integrationConfig.config;\n\n if (!username || !password) {\n throw new Error('Credentials for the gitea ${host} required.');\n }\n\n // check if the org exists within the gitea server\n if (owner) {\n await checkGiteaOrg(integrationConfig.config, { owner });\n }\n\n await createGiteaProject(integrationConfig.config, {\n description,\n owner: owner,\n projectName: repo,\n });\n\n const auth = {\n username: username,\n password: password,\n };\n const gitAuthorInfo = {\n name: gitAuthorName\n ? gitAuthorName\n : config.getOptionalString('scaffolder.defaultAuthor.name'),\n email: gitAuthorEmail\n ? gitAuthorEmail\n : config.getOptionalString('scaffolder.defaultAuthor.email'),\n };\n // The owner to be used should be either the org name or user authenticated with the gitea server\n const remoteUrl = `${integrationConfig.config.baseUrl}/${owner}/${repo}.git`;\n const commitResult = await initRepoAndPush({\n dir: getRepoSourceDirectory(ctx.workspacePath, sourcePath),\n remoteUrl,\n auth,\n defaultBranch,\n logger: ctx.logger,\n commitMessage: generateCommitMessage(config, gitCommitMessage),\n gitAuthorInfo,\n });\n\n // Check if the gitea repo URL is available before to exit\n const maxDuration = 20000; // 20 seconds\n await checkAvailabilityGiteaRepository(\n maxDuration,\n integrationConfig.config,\n {\n owner,\n repo,\n defaultBranch,\n ctx,\n },\n );\n\n const repoContentsUrl = `${integrationConfig.config.baseUrl}/${owner}/${repo}/src/branch/${defaultBranch}/`;\n ctx.output('remoteUrl', remoteUrl);\n ctx.output('commitHash', commitResult?.commitHash);\n ctx.output('repoContentsUrl', repoContentsUrl);\n },\n });\n}\n","/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n createBackendModule,\n coreServices,\n} from '@backstage/backend-plugin-api';\nimport { scaffolderActionsExtensionPoint } from '@backstage/plugin-scaffolder-node/alpha';\nimport { createPublishGiteaAction } from './actions';\nimport { ScmIntegrations } from '@backstage/integration';\n\n/**\n * @public\n * The Gitea Module for the Scaffolder Backend\n */\nexport const giteaModule = createBackendModule({\n pluginId: 'scaffolder',\n moduleId: 'gitea',\n register({ registerInit }) {\n registerInit({\n deps: {\n scaffolder: scaffolderActionsExtensionPoint,\n config: coreServices.rootConfig,\n },\n async init({ scaffolder, config }) {\n const integrations = ScmIntegrations.fromConfig(config);\n scaffolder.addActions(\n createPublishGiteaAction({\n integrations,\n config,\n }),\n );\n },\n });\n },\n});\n"],"names":["yaml","getGiteaRequestOptions","crypto","createTemplateAction","parseRepoUrl","InputError","initRepoAndPush","getRepoSourceDirectory","createBackendModule","scaffolderActionsExtensionPoint","coreServices","ScmIntegrations"],"mappings":";;;;;;;;;;;;;;;;;AAmBO,MAAM,QAA8B,GAAA;AAAA,EACzC;AAAA,IACE,WACE,EAAA,uHAAA;AAAA,IACF,OAAA,EAASA,yBAAK,SAAU,CAAA;AAAA,MACtB,KAAO,EAAA;AAAA,QACL;AAAA,UACE,EAAI,EAAA,SAAA;AAAA,UACJ,MAAQ,EAAA,eAAA;AAAA,UACR,IAAM,EAAA,kBAAA;AAAA,UACN,KAAO,EAAA;AAAA,YACL,OAAS,EAAA,iCAAA;AAAA,WACX;AAAA,SACF;AAAA,OACF;AAAA,KACD,CAAA;AAAA,GACH;AAAA,EACA;AAAA,IACE,WAAa,EAAA,oDAAA;AAAA,IACb,OAAA,EAASA,yBAAK,SAAU,CAAA;AAAA,MACtB,KAAO,EAAA;AAAA,QACL;AAAA,UACE,EAAI,EAAA,SAAA;AAAA,UACJ,MAAQ,EAAA,eAAA;AAAA,UACR,IAAM,EAAA,kBAAA;AAAA,UACN,KAAO,EAAA;AAAA,YACL,OAAS,EAAA,iCAAA;AAAA,YACT,WAAa,EAAA,+BAAA;AAAA,WACf;AAAA,SACF;AAAA,OACF;AAAA,KACD,CAAA;AAAA,GACH;AAAA,EACA;AAAA,IACE,WACE,EAAA,mFAAA;AAAA,IACF,OAAA,EAASA,yBAAK,SAAU,CAAA;AAAA,MACtB,KAAO,EAAA;AAAA,QACL;AAAA,UACE,EAAI,EAAA,SAAA;AAAA,UACJ,MAAQ,EAAA,eAAA;AAAA,UACR,IAAM,EAAA,kBAAA;AAAA,U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,GACD,CAAA,CAAA;AACH;;ACnUO,MAAM,cAAcC,oCAAoB,CAAA;AAAA,EAC7C,QAAU,EAAA,YAAA;AAAA,EACV,QAAU,EAAA,OAAA;AAAA,EACV,QAAA,CAAS,EAAE,YAAA,EAAgB,EAAA;AACzB,IAAa,YAAA,CAAA;AAAA,MACX,IAAM,EAAA;AAAA,QACJ,UAAY,EAAAC,qCAAA;AAAA,QACZ,QAAQC,6BAAa,CAAA,UAAA;AAAA,OACvB;AAAA,MACA,MAAM,IAAA,CAAK,EAAE,UAAA,EAAY,QAAU,EAAA;AACjC,QAAM,MAAA,YAAA,GAAeC,2BAAgB,CAAA,UAAA,CAAW,MAAM,CAAA,CAAA;AACtD,QAAW,UAAA,CAAA,UAAA;AAAA,UACT,wBAAyB,CAAA;AAAA,YACvB,YAAA;AAAA,YACA,MAAA;AAAA,WACD,CAAA;AAAA,SACH,CAAA;AAAA,OACF;AAAA,KACD,CAAA,CAAA;AAAA,GACH;AACF,CAAC;;;;;"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@backstage/plugin-scaffolder-backend-module-gitea",
3
3
  "description": "The gitea module for @backstage/plugin-scaffolder-backend",
4
- "version": "0.0.0-nightly-20240219021126",
4
+ "version": "0.1.0",
5
5
  "main": "./dist/index.cjs.js",
6
6
  "types": "./dist/index.d.ts",
7
7
  "license": "Apache-2.0",
@@ -34,18 +34,18 @@
34
34
  "postpack": "backstage-cli package postpack"
35
35
  },
36
36
  "dependencies": {
37
- "@backstage/backend-plugin-api": "^0.0.0-nightly-20240219021126",
37
+ "@backstage/backend-plugin-api": "^0.6.10",
38
38
  "@backstage/config": "^1.1.1",
39
39
  "@backstage/errors": "^1.2.3",
40
- "@backstage/integration": "^0.0.0-nightly-20240219021126",
41
- "@backstage/plugin-scaffolder-node": "^0.0.0-nightly-20240219021126",
40
+ "@backstage/integration": "^1.9.0",
41
+ "@backstage/plugin-scaffolder-node": "^0.3.0",
42
42
  "node-fetch": "^2.6.7",
43
43
  "yaml": "^2.0.0"
44
44
  },
45
45
  "devDependencies": {
46
- "@backstage/backend-common": "^0.0.0-nightly-20240219021126",
47
- "@backstage/backend-test-utils": "^0.0.0-nightly-20240219021126",
48
- "@backstage/cli": "^0.0.0-nightly-20240219021126",
46
+ "@backstage/backend-common": "^0.21.0",
47
+ "@backstage/backend-test-utils": "^0.3.0",
48
+ "@backstage/cli": "^0.25.2",
49
49
  "msw": "^1.0.0"
50
50
  },
51
51
  "files": [