Single jenkins job for all repositories in a Github organization

后端 未结 5 927
轻奢々
轻奢々 2021-01-15 01:23

We own a Github organization with hundreds repositories that are authored by contributors. We would like to setup a Jenkins server that performs certain standard tasks for e

5条回答
  •  执念已碎
    2021-01-15 02:01

    I am not sure how much of this answer will help you, but I will be happy even if it provides some insight into Jenkins pipelines.

    I am elaborating the procedure to follow using Jenkins pipelines, if not now at some point of time you need to move your build and deploy to pipelines for Infrastructure as code.

    Starting with Jenkins plugins, the following are mandatory plugins for the procedure that I will be explaining here:

    • Github organization - for scanning the organization with multiple repos
    • Multi-branch pipeline - for creating pipelines automatically for all the branches/PRs in a repo. This helps to validate feature branches and PR changes.

    Jenkins Configuration

    1. Create Github organization from the options below:

    1. Configure the newly created organization, from the above step. Owner should be your Organization where hundred of repos are available.

    also, configure what file and what branches to look into a repo to trigger a build. script path is the file that does the steps (probably build and deploy) for the repos. So all the repos will be detected or shown in Jenkins only if a file with this name is available in the repos.

    Jenkins scans the configured organization as per the interval mentioned here. It detects any additions/deletions of repos and also commits. Good to configure numbers of builds to store, as needed.

    Git repo/organization configuration

    Configure webhooks in github

    Configure the events that require notifications to Jenkins.

    Branch protection and status checks for PRs

    Protecting the branch by enabling proper checks will help to restrict commits from a few sets of people after status checks are passed. This helps to maintain good code quality.

    Here is the snapshot that shows the status checks status when a PR is raised. Based on this reviewers will be able to decide for approving the PR.

    This link explains in detail about the procedure that I have described here.

    https://github.com/gitbucket/gitbucket/wiki/Setup-Jenkins-Multibranch-Pipeline-and-Organization

提交回复
热议问题