Skip to content

Unable to pass an object as a pipeline parameter #32

@DanielPerezJensen

Description

@DanielPerezJensen

We want to use this scaffolder to create a form that will trigger a pipeline with some configuration options.

We have done this in the pipeline using a parameter, this parameter is an object. We want to pass the content of the filled in form as an object to this pipeline parameter.

In the readme we see:

    - title: Choose Pipeline Parameters
      description: Please select some pipeline parameters
      properties:
        pipelineParameters:
          title: Pipeline Parameters
          type: object
          properties:
            name:
              type: string
            id:
              type: number
            foo:
              type: string
***note these properties for parameters are just examples, you can use whatever key values that your pi

We thought perhaps we would be able to pass an object like above, so pipelineParameters to this parameter in the pipeline.

This led us to this solution:

# template.yaml
apiVersion: scaffolder.backstage.io/v1beta3
kind: Template
metadata:
  name: create-azure-pipeline-1
  title: Run Azure Pipeline
  description: Create Azure pipeline 3
spec:
  owner: parfuemerie-douglas
  type: service

  parameters:
    - title: Backstage Information
      required:
        - name
        - owner
      properties:
        name:
          title: Project name
          type: string
          description: Choose a unique project name.
          ui:field: EntityNamePicker
          ui:autofocus: true
        owner:
          title: Owner
          type: string
          description: Select an owner for the Backstage component.
          ui:field: OwnerPicker
          ui:options:
            allowedKinds:
              - Group
    - title: Dashboard Configuration
      required:
        - dbConfig
      properties:
        dbConfig:
          title: Dashboard Configuration
          type: object
          properties:
            version:
              title: Version
              type: string
              description: Version of the dashboard to be deployed
              default: test1
            project_name:
              title: Project Name
              type: string
              description: Squad name
              default: test2
            admin_group:
              title: Admin Group
              type: string
              description: Assignment group
              default: test3
            application_ci:
              title: Application CI
              type: string
              description: App CI
              default: test4
  steps:
    - id: runAzurePipeline
      name: Run Azure Pipeline
      action: azure:pipeline:run
      input:
        organization: <ORGANIZATION>
        pipelineId: <PIPELINEID>
        project: <PROJECT>
        pipelineParameters:
          json_object: {{ parameters.dbConfig }}
  output:
    links:
      - title: Open in catalog
        icon: catalog
        entityRef: ${{ steps.register.output.entityRef }}

However, when we try to run this template through backstage, the pipeline is not triggered. We get a screen like below:
image

The pipeline seems to insta-run and succeed, however, I know for a fact the pipeline never ran through azure devops UI.

We have tried to hard-code an object, but this also does not succeed. Some options we have tried:

  steps:
    - id: runAzurePipeline
      name: Run Azure Pipeline
      action: azure:pipeline:run
      input:
        organization: <ORGANIZATION>
        pipelineId: <PIPELINEID>
        project: <PROJECT>
        pipelineParameters:
          json_object:
           test: test1
  steps:
    - id: runAzurePipeline
      name: Run Azure Pipeline
      action: azure:pipeline:run
      input:
        organization: <ORGANIZATION>
        pipelineId: <PIPELINEID>
        project: <PROJECT>
        pipelineParameters:
          json_object:
           - test: test1
           - test: test2

We have verified that we can work with the PAT, as when we drop the json_object from pipeline_parameters the pipeline can be run through Backstage.

Any help is appreciated, since we are not getting any error message we are kind of shooting in the dark. How are we supposed to form this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions