Skip to content

Conversation

karthikjayaraman80
Copy link

Requirement: Show / Hide Deployment links based on User/Group roles.
Solution: Added two new parameters users and groups that take in a comma separated list of users and groups respectively who have access to deploy.
Example:
No permission check:

buildAddUrl(title: 'Deploy to DEV', url: "/link/to/deployment")

Check user list:

buildAddUrl(title: 'Deploy to QA', url: "/link/to/deployment", users: "user1,user2,user3")

Check group list:

buildAddUrl(title: 'Deploy to QA', url: "/link/to/deployment", groups: "group1,group2")

Check both:

buildAddUrl(title: 'Deploy to QA', url: "/link/to/deployment", users: "user1", groups: "group1,group2")

karthikjayaraman80 and others added 3 commits September 10, 2020 21:38
Consider a job that deploys to multiple environments. The View only shows the details of the first environment. The change enables all the environment deployments for a single build.

Sample Jenkins pipeline that deploys to multiple environments:
pipeline {
    agent any
    stages {
        stage('Deploy to DEV') {
            steps {
                input message: 'Deploy to DEV'
            addDeployToDashboard(env: 'DEV', buildNumber: "$BUILD_NUMBER")
            }

        }

        stage('Deploy to QA') {
            steps {
                input message: 'Deploy to QA'
            addDeployToDashboard(env: 'QA', buildNumber: "$BUILD_NUMBER")
            }

        }

        stage('Deploy to PROD') {
            steps {
                input message: 'Deploy to PROD'
            addDeployToDashboard(env: 'PROD', buildNumber: "$BUILD_NUMBER")
            }

        }
    }
}

Signed-off-by: Karthik Jayaraman <kjayaraman@gmail.com>
Signed-off-by: Karthik Jayaraman <kjayaraman@gmail.com>
Signed-off-by: Karthik Jayaraman <kjayaraman@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant