Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@backstage/plugin-scaffolder-backend-module-gitlab

Package Overview
Dependencies
Maintainers
3
Versions
675
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@backstage/plugin-scaffolder-backend-module-gitlab

  • 0.6.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
53K
increased by10.37%
Maintainers
3
Weekly downloads
 
Created
Source

scaffolder-backend-module-gitlab

Welcome to the Gitlab Module for Scaffolder.

Here you can find all Gitlab related features to improve your scaffolder:

Getting started

From your Backstage root directory

# From your Backstage root directory
yarn --cwd packages/backend add @backstage/plugin-scaffolder-backend-module-gitlab

Then ensure that both the scaffolder and this module are added to your backend:

// In packages/backend/src/index.ts
const backend = createBackend();
// ...
backend.add(import('@backstage/plugin-scaffolder-backend'));
backend.add(import('@backstage/plugin-scaffolder-backend-module-gitlab'));

After that you can use the actions in your template:

apiVersion: scaffolder.backstage.io/v1beta3
kind: Template
metadata:
  name: gitlab-demo
  title: Gitlab DEMO
  description: Scaffolder Gitlab Demo
spec:
  owner: backstage/techdocs-core
  type: service

  parameters:
    - title: Fill in some steps
      required:
        - name
      properties:
        name:
          title: Name
          type: string
          description: Unique name of the component
          ui:autofocus: true
          ui:options:
            rows: 5
    - title: Choose a location
      required:
        - repoUrl
      properties:
        repoUrl:
          title: Repository Location
          type: string
          ui:field: RepoUrlPicker
          ui:options:
            allowedHosts:
              - gitlab.com

  steps:
    - id: fetch
      name: Fetch
      action: fetch:template
      input:
        url: https://github.com/TEMPLATE
        values:
          name: ${{ parameters.name }}
    - id: createGitlabGroup
      name: Ensure Gitlab group exists
      action: gitlab:group:ensureExists
      input:
        repoUrl: ${{ parameters.repoUrl }}
        path:
          - path
          - to
          - group

    - id: publish
      name: Publish
      action: publish:gitlab
      input:
        description: This is ${{ parameters.name }}
        repoUrl: ${{ parameters.repoUrl }}?owner=${{ steps.createGitlabGroup.output.groupId }}
        sourcePath: pimcore
        defaultBranch: main

    - id: gitlab-deploy-token
      name: Create Deploy Token
      action: gitlab:projectDeployToken:create
      input:
        repoUrl: ${{ parameters.repoUrl }}
        projectId: "${{ steps['publish'].output.projectId }}"
        name: ${{ parameters.name }}-secret
        username: ${{ parameters.name }}-secret
        scopes: ['read_registry']

    - id: gitlab-access-token
      name: Gitlab Project Access Token
      action: gitlab:projectAccessToken:create
      input:
        repoUrl: ${{ parameters.repoUrl }}
        projectId: "${{ steps['publish-manifest'].output.projectId }}"
        name: ${{ parameters.name }}-access-token
        accessLevel: 40
        scopes: ['read_repository', 'write_repository']

    - id: gitlab-project-variable
      name: Gitlab Project Variable
      action: gitlab:projectVariable:create
      input:
        repoUrl: ${{ parameters.repoUrl }}
        projectId: "${{ steps['publish'].output.projectId }}"
        key: 'VARIABLE_NAME'
        value: "${{ steps['gitlab-access-token'].output.access_token }}"
        variableType: 'env_var'
        masked: true
        variableProtected: false
        raw: false
        environmentScope: '*'

    - id: register
      name: Register
      action: catalog:register
      input:
        repoContentsUrl: ${{ steps['publish'].output.repoContentsUrl }}
        catalogInfoPath: '/catalog-info.yaml'

    - id: gitlabIssue
      name: Issues
      action: gitlab:issues:create
      input:
        repoUrl: ${{ parameters.repoUrl }}
        token: ${{ secrets.USER_OAUTH_TOKEN }}
        projectId: 1111111
        title: Test Issue
        assignees:
          - 2222222
        description: This is the description of the issue
        confidential: true
        createdAt: 2022-09-27 18:00:00.000
        dueDate: 2024-09-28 12:00:00.000
        epicId: 3333333
        labels: phase1:label1,phase2:label2
  output:
    links:
      - title: Repository
        url: ${{ steps['publish'].output.remoteUrl }}
      - title: Link to new issue
        url: ${{ steps['gitlabIssue'].output.issueUrl }}

Keywords

FAQs

Package last updated on 29 Nov 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc