Skip to content

Refine PipelineRuns management and viewing roles

What this PR dose

  • Add pipelines/runs, pipelines/pipelineruns and pipelineruns/nodedetails resources into PipelineRun's RolBase.
  • Adjust role dependencies for view-pipelines and manage-pipelines roles.
    • view-pipelines -> view-pipelineruns
    • manage-pipelines -> manage-pipelineruns, view-pipelines, view-credentials image

Why we need it

Firstly, we need a finer grained permissions for PipelineRuns. Then, if the missing resources were not added, users has Pipeline Viewing and PipelineRun Viewing roles could not view any PipelineRuns in console.

BTW, this PR is related with #1828.

Steps to test

  1. Apply the role templates into cluster
    kubectl apply -f https://raw.githubusercontent.com/kubesphere/ks-installer/aacef83af34391bda2ce43143c0cc0df2956d6ce/roles/ks-core/prepare/files/ks-init/role-templates.yaml
  2. Create a Workspace, DevOps Project and simple Pipeline.
    pipeline {
        agent none
        stages {
            stage('Example') {
                input {
                    message "Should we continue?"
                    ok "Yes, we should."
                    submitter "alice,bob"
                    parameters {
                        string(name: 'PERSON', defaultValue: 'Mr Jenkins', description: 'Who should I say hello to?')
                    }
                }
                steps {
                    echo "Hello, ${PERSON}, nice to meet you."
                }
            }
        }
    }
  3. Run the Pipeline
  4. Create a role for the DevOps Project created before, which has view-pipelines permissions
  5. Create a user and assign the role created before to the user
  6. Validate the result

/kind bug /area devops /cc @kubesphere/sig-devops /milestone v3.2

合并请求报告