diff --git a/plugins/scaffolder-backend-module-gitea/README.md b/plugins/scaffolder-backend-module-gitea/README.md index 7eff6130db..7133f33393 100644 --- a/plugins/scaffolder-backend-module-gitea/README.md +++ b/plugins/scaffolder-backend-module-gitea/README.md @@ -10,6 +10,13 @@ To use this action, you will have to add the package using the following command yarn --cwd packages/backend add @backstage/plugin-scaffolder-backend-module-gitea ``` +Alternatively, if you use the new backend system, then register it like this: + +```typescript +// packages/backend/src/index.ts +backend.add(import('@backstage/plugin-scaffolder-backend-module-gitea')); +``` + Configure the action (if not yet done): (you can check the [docs](https://backstage.io/docs/features/software-templates/writing-custom-actions#registering-custom-actions) to see all options): @@ -27,29 +34,29 @@ integrations: password: '' ``` -**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 -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 ! +**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 +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 or to ignore using the following Node.js parameter: `NODE_TLS_REJECT_UNAUTHORIZED=0` ! When done, you can create a template which: -- Declare the `RepoUrlPicker` within the `spec/parameters` section to select the gitea hosts -- Include a step able to publish by example the newly generated project using the action `action: publish:gitea` +- Declare the `RepoUrlPicker` within the `spec/parameters` section to select the gitea host and to provide the name of the repository +- Add an enum list allowing the user to define the visibility about the repository to be created: `public` or `private`. If this field is omitted, `public` is then used by the action. +- Include in a step the action: `publish:gitea` + +**Warning**: The list of the `allowedOwners` of the `repoUrlPicker` must match the list of the `organizations` which are available on the gitea host ! ```yaml -apiVersion: scaffolder.backstage.io/v1beta3 kind: Template metadata: - name: quarkus-web-template - title: Quarkus Hello world - description: Create a simple microservice using Quarkus - tags: - - java - - quarkus + name: simple-gitea-project + title: Create a gitea repository + description: Create a gitea repository spec: - owner: quarkus + owner: guests type: service + parameters: - - title: Git repository Information + - title: Choose a location required: - repoUrl properties: @@ -58,42 +65,33 @@ spec: type: string ui:field: RepoUrlPicker ui:options: + allowedOwners: + - qteam + - qshift allowedHosts: - - gitea.: - - localhost: + - gitea.localtest.me:3333 + + repoVisibility: + title: Visibility of the repository + type: string + default: 'public' + enum: + - 'public' + - 'private' + enumNames: + - 'public' + - 'private' steps: - - id: template - name: Generating component - action: fetch:template - input: - url: ./skeleton - values: - name: ${{ parameters.name }} - + ... - id: publish name: Publishing to a gitea git repository action: publish:gitea input: - description: This is ${{ parameters.component_id }} + description: This is ${{ parameters.repoUrl | parseRepoUrl | pick('repo') }} + repoVisibility: ${{ parameters.repoVisibility }} repoUrl: ${{ parameters.repoUrl }} defaultBranch: main - - - id: register - if: ${{ parameters.dryRun !== true }} - name: Register - action: catalog:register - input: - repoContentsUrl: ${{ steps['publish'].output.repoContentsUrl }} - catalogInfoPath: 'main/catalog-info.yaml' - - output: - links: - - title: Source Code Repository - url: ${{ steps.publish.output.remoteUrl }} - - title: Open Component in catalog - icon: catalog - entityRef: ${{ steps.register.output.entityRef }} ``` Access the newly gitea repository created using the `repoContentsUrl` ;-)