Git Product home page Git Product logo

zentral-santa-rulesets-pipeline's Introduction

Zentral Santa Rulset Pipeline

This is an example of a CI/CD pipeline to manage Zentral Santa Rulesets with code reviews and multiple branches.

Workflow

There are two branches, staging and main, and two Zentral Santa configurations, Testing and Default (All four names can be changed in the Jenkinsfile).

The rulesets are in the rulesets folder.

Pull requests with the staging or main branch as target will trigger a dry-run apply to their respective configuration (Testing or Default).

Merges to the staging or main branch will be applied to their respective configuration.

Changes should be introduced in feature branches. Once ready, a pull request should be made with the staging branch as the base. A dry-run apply to the Testing configuration will be triggered. If everything looks good, the changes should be merged into the staging branch, after which, the changes will be applied to the Testing configuration.

After a while, once the effects on the endpoints have been evaluated, a pull request can be made with the main branch as the base. A dry-run apply to the Default configuration will be triggered. If everything looks good, the changes should be merged into the main branch, after which the changes will be applied to the Default configuration.

The main and staging branches must be protected. The dry-run status check must be required before a merge. Changes to the main branch without a pull request must be rejected. You may allow them on the staging branch, to speed-up the testing of new rules.

Jenkins setup

Multibranch job, with automatic branch discovery (via a Github application with webhooks for example), and a Jenkinsfile.

The Zentral API token is saved as a credential in Jenkins, with the zentral-api-token ID.

The Jenkinsfile has 2 steps:

  • Check rulesets, when pull request with the main or staging branch as targets
  • Apply rulesets, when branch is main or staging

python3 has to be available in the agent.

Push script

The scripts/post_rulesets.py python script is used to push all the rulesets present in the rulesets folder. It has only one optional dependency to process YAML files.

This script will automatically set the configuration in the ruleset. This allows the same rulesets to be applied to the Testing or Default configurations, in a dry-run or not, depending on the branch or pull request context.

Configurations set in the rulesets will be overwritten.

zentral-santa-rulesets-pipeline's People

Contributors

np5 avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  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.