Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploy permissions #6

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

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")

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 <[email protected]>
Signed-off-by: Karthik Jayaraman <[email protected]>
Signed-off-by: Karthik Jayaraman <[email protected]>
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