GithubHelp home page GithubHelp logo

yunlzheng / repository-permissions-updater Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jenkins-infra/repository-permissions-updater

0.0 2.0 0.0 974 KB

Artifactory permissions synchronization tool and data set

Groovy 100.00%

repository-permissions-updater's Introduction

Repository Permissions Updater

About

The Jenkins project hosts Maven artifacts such as core and plugin releases on Artifactory.

Its permissions system is independent of GitHub's, and we limit which users (identified by the Jenkins LDAP account, same as wiki and JIRA) are allowed to upload which artifacts.

This repository contains both the definitions for Artifactory upload permissions in YAML format, as well as the tool that synchronizes them to Artifactory.

Note: These permissions are specifically for uploading artifacts to the Jenkins project's Maven repository. It is independent of GitHub repository permissions. You may have one without the other. Typically, you'll either have both, or just the GitHub repository access.

Requesting Permissions

Prerequisite: You need to have logged in once to Artifactory with your Jenkins community account before you can be added to a permissions target.

To request upload permissions to an artifact (typically a plugin), file a PR editing the appropriate YAML file, and provide a reference that shows you have commit permissions, or have an existing committer to the plugin comment on your PR, approving it.

Managing Permissions

The directory permissions/ contains a set of files, one per plugin or artifact, that define the permissions for the respective artifacts. Files typically have a component, plugin, or pom prefix for organization purposes:

  • plugin is used for Jenkins plugins.
  • pom is used for parent POMs and everything else consisting of just a POM file.
  • component is used for everything else, usually libraries.

These prefixes, like the rest of the file name, have no semantic meaning and just help in organizing these files.

Each file contains the following in YAML format:

  • A name (typically mirrored in the file name), this is also the artifactId of the Maven artifact.
  • A set of paths, usually just one. These correspond to the full Maven coordinates (groupId and artifactId) used for the artifact. Since Jenkins plugins can change group IDs and are still considered the same artifact, multiple entries are possible.
  • A set of user names (Jenkins community user accounts in LDAP, the same as used for wiki and JIRA) allowed to upload this artifact to Artifactory. This set can be empty, which means nobody is currently allowed to upload the plugin in question (except Artifactory admins). This can happen for plugins that haven't seen releases in several years, or permission cleanups.

Example file:

  • Red (lines 2 and 4): artifactId
  • Green (line 4): groupId (with slashes replacing periods)
  • Blue (line 6): Jenkins community account user name

Adding a new plugin

Create a new YAML file similar to existing files.

Adding a new uploader to an existing plugin

Edit the developers list in the YAML file for the plugin.

Deprecating a plugin

Remove the YAML file. The next synchronization will remove permissions for the plugin.

Renaming a plugin

Rename and edit the existing permissions file, changing both name and the last path component.

Changing a plugin's groupId

Change the paths to match the new Maven coordinates, or, if further uploads for the old coordinates are expected, add a new list entry.

Usage

To see how to run this tool to synchronize Artifactory permission targets with the definitions in this repository, see Jenkinsfile.

It expects the following System properties to be set:

  • definitionsDir - Path to directory containing permission definitions YAML files
  • artifactoryApiTempDir - Path to directory (that will be created) where this tool stores Artifactory permissions API JSON payloads.

It expected the following environment variables to be set:

  • ARTIFACTORY_USERNAME - Admin user name for Artifactory
  • ARTIFACTORY_PASSWORD - Corresponding admin password (or API key) for Artifactory admin user

How It Works

The tool runs three steps in sequence:

  1. Generate JSON payloads from YAML permission definition files.
  2. Submit generated JSON payloads to Artifactory.
  3. Remove all generated permission targets in Artifactory that have no corresponding generated JSON payload file.

repository-permissions-updater's People

Contributors

daniel-beck avatar orrc avatar oleg-nenashev avatar stephenc avatar abayer avatar batmat avatar michaelneale avatar olamy avatar olivergondza avatar pbuckley4192 avatar subinataws avatar ndeloof avatar madsnielsen avatar clguiman avatar andresrc avatar gabemontero avatar jglick avatar svanoort avatar yu-shao-gm avatar ljader avatar jimilian avatar hypery2k avatar mc1arke avatar nrayapati avatar scoheb avatar mehrat avatar fengxx avatar tomasbjerre avatar cashlalala avatar mohan-zephyr avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.