Backstage - creating a template and replace values in your template

 


1. First, you need to create an input form. 

apiVersionscaffolder.backstage.io/v1beta3

kindTemplate
# some metadata about the template itself
metadata:
  namev1beta3-demo
  titleTest
  descriptionTestandTest
spec:
  ownertestowner
  typeservice

  # these are the steps which are rendered in the frontend with the form input
  parameters:
    - titleFill in some steps
      required:
        - name
      properties:
        name:
          titleshort application name
          typestring
          descriptionPlease provide a name for your application
          ui:autofocustrue
          maxLength10
          ui:options:
            rows2
        appname:
          titleApplication Name
          typestring
          descriptionPlease provide a name for your application
          ui:autofocustrue
          maxLength40
          ui:options:
            rows2
        k8snamespace:
          titlekubernetes namespace name that the application targeted to run on 
          typestring
          descriptionPlease provide a name for your namespace
          maxLength12
          ui:autofocustrue
          ui:options:
            rows2
        azureresourcegroupname:
          titleAzure resource group name
          typestring
          description:  Resource group that will be hosting your infrastructure resources in Azure
          ui:autofocustrue
          maxLength10
          ui:options:
            rows2
        steward:
          titleSquad or steward name
          typestring
          descriptionPlease provide a name for your team (the steward for this application)
          ui:autofocustrue
          maxLength20
          ui:options:
            rows5
    - titleChoose a location
      required:
        - repoUrl
      properties:
        repoUrl:
          titleRepository Location
          typestring
          ui:fieldRepoUrlPicker
          ui:options:
            allowedHosts:
              - dev.azure.com

  # here's the steps that are executed in series in the scaffolder backend
  steps:
    - idfetch-base
      nameFetch Base
      actionfetch:template
      input:
        url./
        values
          name${{ parameters.name }}
          appname${{ parameters.appname }}
          k8snamespace${{ parameters.k8snamespace }}
          azureresourcegroupname${{ parameters.azureresourcegroupname }}
          steward${{ parameters.steward }}

 
    - idpublish
      namePublish
      actionpublish:azure
      input:
        repoUrl${{ parameters.repoUrl }}
        descriptionThis is ${{ parameters.name }}
        gitCommitMessage'automation-work'
        defaultinitialcode
       
  
    - idregister
      nameRegister
      actioncatalog:register
      input:
        repoContentsUrl${{ steps['publish'].output.repoContentsUrl }}
        catalogInfoPath/backstage/catalog-info.yaml


2. Next, you have to update your template. Let's use a very simple example, say you need these value to be populated into application.config and it has the following content 

-------------------------------- application.config -------------------------------- 

name: ${{ values.name }}
appname: ${{ values.appname }}
k8snamespace: ${{ values.k8snamespace }}
azureresourcegroupname: ${{ values.azureresourcegroupname }}

Comments

Popular posts from this blog

The specified initialization vector (IV) does not match the block size for this algorithm