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

Implement nicer property DSL for Job DSL and Pipeline #472

Merged
merged 1 commit into from
Sep 6, 2023

Conversation

timja
Copy link
Member

@timja timja commented Sep 6, 2023

relates to jenkinsci/matrix-auth-plugin#144
Fixes #467


Job DSL:

folder('generated') {
  properties {
    azureAdAuthorizationMatrix {
      inheritanceStrategy {
          nonInheriting()
      }
      entries {
        group {
          name('A group (7fe913e8-6c9f-40f8-913e-7178b7768cc5)')
          permissions([
            'Job/Build',
            'Job/Configure',
            'Job/Read'
          ])}
        user {
          name('c411116f-cfa6-472c-8ccf-d0cb6053c9aa')
          permissions(['Job/Delete'])
        }
      }
    }
  }
}

The corresponding Pipeline snippet looks like this, according to Snippet generator (formatted for readability):

properties([
  azureAdAuthorizationMatrix([
    user(name: 'c411116f-cfa6-472c-8ccf-d0cb6053c9aa', permissions: ['Job/Delete']),
    group(name: 'A group (7fe913e8-6c9f-40f8-913e-7178b7768cc5)', permissions: [
      'Job/Build',
      'Job/Configure',
      'Job/Read'
    ])
  ])
])

Testing done

Manually checked all the above looks correct in the UI, haven't actually tried with any of the users.
I fixed the pipeline syntax page which wasn't working before.

Submitter checklist

@timja timja enabled auto-merge (squash) September 6, 2023 12:28
@timja timja merged commit dec4683 into jenkinsci:master Sep 6, 2023
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add documentation and tests for using this plugin with job-dsl
1 participant