Skip to content

Make required field determine whether the parameter is required

What type of PR is this?

/kind optimization /area devops

What this PR does / why we need it:

Make required field decide whether the form item is required.

We have decided to add a required field to determine whether the parameter is required to input instead of using default field. See

for more.

Which issue(s) this PR fixes:

Fixes #

Special notes for reviewers:

Steps to test:

  1. Apply a ClusterTemplate for test:
    cat <<'EOF' | kubectl apply -f -
    apiVersion: devops.kubesphere.io/v1alpha3
    kind: ClusterTemplate
    metadata:
      name: echo
    spec:
      parameters:
      - default: John
        name: 姓
        required: false
      - default: Niang
        name: 名
        required: true
      template: |
        pipeline {
          agent none
          stages {
            stage('echo') {
              steps {
                echo 'Hello, $(.params.姓)-$(.params.名)!'
              }
            }
          }
        }
    EOF
  2. Create a Pipeline for test
  3. Edit Pipeline and select the ClusterTemplate created just now
  4. See the result image

Does this PR introduced a user-facing change?

None

Additional documentation, usage docs, etc.:

合并请求报告

加载中