8000 GitHub - Digital-Commons/the-devsecops-plugin
[go: up one dir, main page]

Skip to content

Digital-Commons/the-devsecops-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

∞ The DevSecOps Plugin

Project license Made with Go-Task Powered by Docker Made with Copier

Table of Contents

About

The DevSecOps Plugin is a comprehensive toolset designed to streamline and enforce DevSecOps practices in your development workflow. It integrates various tools and best practices for continuous integration, security scanning, code quality analysis, and deployment automation.

Key Features

  • Modular Architecture: Each tool and component has its dedicated configuration in .config/
  • Task Abstraction: All operations are abstracted through Taskfile.yml for consistency
  • Comprehensive Security: Integrated security scanning and vulnerability assessment
  • Code Quality Assurance: Automated linting, formatting, and complexity analysis
  • Standardised Workflow: Enforced commit messages and code review processes
  • Containerised Development: DevContainer support for consistent environments

Built With

  • Task - Task runner & build tool
  • Docker - Containerization
  • MegaLinter - Code quality & security scanning
  • Commitizen - Commit message standardization
  • Lizard - Code complexity analysis
  • Grype - Vulnerability scanning
  • Trivy - Security scanner
  • Copier - Project templating and scaffolding

Project Structure

.
β”œβ”€β”€ .config/           # Tool-specific configurations
β”‚   β”œβ”€β”€ bun/          # Bun package manager configuration
β”‚   β”œβ”€β”€ commitizen/   # Commit message standardisation
β”‚   β”œβ”€β”€ devsecops/   # DevSecOps pipeline stages
β”‚   β”œβ”€β”€ docker-ce/   # Docker configuration
β”‚   └── ...          # Other tool configurations
β”œβ”€β”€ .devcontainer/    # Development container configuration
β”œβ”€β”€ src/             # Source code
└── Taskfile.yml     # Task runner configuration

Pipeline Stages

The plugin implements a complete DevSecOps lifecycle through distinct stages:

  1. 🎯 Plan: Initial planning and setup
  2. πŸ’» Code: Development with integrated security checks
  • Commitlint validation
  • MegaLinter checks
  • Commitizen formatting
  • Lizard code analysis
  1. πŸ—οΈ Build: Automated building with security
  • Docker image builds
  • Security scans
  1. πŸ§ͺ Test: Comprehensive testing
  • Docker tests
  • Security testing
  1. πŸ“¦ Release: Secure release management
  • Version bumping
  • Changelog generation
  1. πŸš€ Deploy: Automated deployment
  2. πŸ”„ Operate: Operational management
  3. πŸ“Š Monitor: Continuous monitoring
  4. πŸ’­ Feedback: Continuous improvement

Getting Started

Prerequisites

Before using the DevSecOps Plugin, ensure you have the following installed:

  • Python 3.11 or higher
  • Docker Desktop 4.x or newer (for container support)
  • Visual Studio Code (recommended)
  • Git

Installation

  1. Create and activate a Python virtual environment:
mkdir -p ~/workspace
python3 -m venv ~/workspace/venv
  1. Install Copier in the virtual environment:
source ~/workspace/venv/bin/activate
pip install copier
  1. Generate a new project using the template:
cd ~/workspace/path/to/your/new/project

source ~/workspace/venv/bin/activate
copier copy -a .config/devsecops/.copier-answers.yml https://gitlab.com/digital-commons/devsecops/tools/the-devsecops-plugin.git .

Replace /path/to/your/new/project with your desired project location. Use . to create in the current directory

Usage

Task Control

The plugin uses Task for operation control. Key environment variables:

# Core Controls
export TASK_FLAGS=""
export TASK_SEPARATOR="----------------------------------------"

# Component Controls
export TASK_BUN_ENABLED=true
export TASK_COMMITIZEN_ENABLED=true
export TASK_DOCKER_CE_ENABLED=true
export TASK_MEGALINTER_ENABLED=true
export TASK_LIZARD_ENABLED=true

# Pipeline Stage Controls
export TASK_DEVSECOPS_PLAN_ENABLED=true
export TASK_DEVSECOPS_CODE_ENABLED=true
export TASK_DEVSECOPS_BUILD_ENABLED=true

Common Operations

  1. Setup Development Environment:
task dev:setup-environment
  1. Run Security Scans:
task devsecops:code:security
  1. Validate Code Quality:
task devsecops:code:quality
  1. Create Release:
task devsecops:release

Project Customization

The plugin is designed to be easily customizable for specific project needs. Each project can define its own tasks in src/Taskfile.yml following the same lifecycle stages:

# src/Taskfile.yml
tasks:
  plan:
    desc: Run project-specific plan tasks
    cmds:
      - custom-planning-command

  code:
    desc: Run project-specific code tasks
    cmds:
      - npm test
      - custom-linting

  build:
    desc: Run project-specific build tasks
    cmds:
      - docker build -t myproject .

  # ... other stages (test, release, deploy, operate, monitor, feedback)

These project-specific tasks will be automatically integrated into the main pipeline while keeping the core DevSecOps features intact. This allows you to:

  • Add your own build processes
  • Integrate custom testing frameworks
  • Include project-specific deployment steps
  • Add custom monitoring solutions
  • Implement project-specific security checks

Available Commands

# Run the complete DevSecOps pipeline
task

# Run individual stages
task plan       # Initial planning
task code       # Development and checks
task build      # Build and security
task test       # Run tests
task release    # Handle releases
task deploy     # Deployment
task operate    # Operations
task monitor    # Monitoring
task feedback   # Feedback loop

# Run specific tools
task megalinter     # Code quality & security
task commitizen     # Manage commits
task docker-ce:test    # Docker tests

Environment Variables

Task Control Variables

You can customize the behavior of the plugin by setting these environment variables:

# Core Features
TASK_BUN_ENABLED=true           # Enable/disable Bun runtime
TASK_COMMITIZEN_ENABLED=true    # Enable/disable Commitizen
TASK_COMMITLINT_ENABLED=true    # Enable/disable Commitlint
TASK_MEGALINTER_ENABLED=true    # Enable/disable MegaLinter
TASK_DOCKER_CE_ENABLED=true     # Enable/disable Docker CE features
TASK_LIZARD_ENABLED=true        # Enable/disable Lizard code analysis

# DevSecOps Pipeline Stages
TASK_DEVSECOPS_PLAN_ENABLED=true      # Enable/disable Plan stage
TASK_DEVSECOPS_CODE_ENABLED=true      # Enable/disable Code stage
TASK_DEVSECOPS_BUILD_ENABLED=true     # Enable/disable Build stage
TASK_DEVSECOPS_TEST_ENABLED=true      # Enable/disable Test stage
TASK_DEVSECOPS_RELEASE_ENABLED=true   # Enable/disable Release stage
TASK_DEVSECOPS_DEPLOY_ENABLED=true    # Enable/disable Deploy stage
TASK_DEVSECOPS_OPERATE_ENABLED=true   # Enable/disable Operate stage
TASK_DEVSECOPS_MONITOR_ENABLED=true   # Enable/disable Monitor stage
TASK_DEVSECOPS_FEEDBACK_ENABLED=true  # Enable/disable Feedback stage

GitLab CI/CD Variables

The following variables need to be configured in your GitLab CI/CD settings:

  • CZ_DEPLOY_KEY: Base64 encoded SSH private key for git operations (required for releases)
  • GITLAB_USER_LOGIN: Your GitLab username (automatically provided)
  • GITLAB_USER_EMAIL: Your GitLab email (automatically provided)

Development Setup

  1. Clone the repository:
git clone https://gitlab.gitlab.com/digital-commons/devsecops/tools/the-devsecops-plugin.git
cd the-devsecops-plugin
  1. Install Task:
sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d
  1. Setup development environment:
task dev:setup-environment
  1. Run the complete pipeline locally:
task devsecops

Architecture

The plugin follows a modular architecture:

.
β”œβ”€β”€ .config/                  # Tool configurations
β”‚   β”œβ”€β”€ bun/                 # Bun runtime config
β”‚   β”œβ”€β”€ commitizen/          # Commit message config
β”‚   β”œβ”€β”€ devsecops/          # Pipeline stage definitions
β”‚   β”‚   β”œβ”€β”€ Taskfile.plan.yml
β”‚   β”‚   β”œβ”€β”€ Taskfile.code.yml
β”‚   β”‚   β”œβ”€β”€ Taskfile.build.yml
β”‚   β”‚   └── ...
β”‚   β”œβ”€β”€ docker/             # Docker configuration
β”‚   └── megalinter/         # Linting configuration
β”œβ”€β”€ .devcontainer/          # Dev container setup
β”œβ”€β”€ src/                    # Project-specific tasks
β”‚   └── Taskfile.yml       # Custom task definitions
└── Taskfile.yml           # Main task orchestration

Each project can extend the base functionality by adding custom tasks in src/Taskfile.yml,
which are automatically integrated into the main pipeline while preserving the core DevSecOps features.

Features

  • ♾️ Automation: Automated workflows for common DevSecOps tasks
  • πŸ”„ Modular Pipeline: Clearly separated stages with individual configurations
  • πŸŽ›οΈ Flexible Control: Enable/disable features via environment variables
  • πŸ”’ Security-First: Integrated security scanning at every stage
  • πŸ“Š Quality Assurance: Comprehensive code quality checks
  • 🐳 Container-Ready: Full Docker integration
  • πŸ“ Standardization: Enforced commit message formatting
  • πŸ” Monitoring: Built-in monitoring capabilities
  • πŸš€ Project Customization: Extensible framework allowing projects to define custom tasks for each lifecycle stage πŸ”Œ Plugin Architecture: Clear separation between core DevSecOps features and project-specific implementations

Security

The plugin implements multiple security measures:

  • Automated vulnerability scanning with Grype and Trivy
  • Code quality checks with MegaLinter
  • Dependency scanning
  • Container security analysis
  • Secure configuration validation

Security Best Practices

  • Keep all dependencies updated
  • Follow the principle of least privilege
  • Use environment variables for sensitive data
  • Regular security scans
  • Code review enforcement

Contributing

Please see our Contributing Guide for details on how to set up the development environment and contribute to the project.

Contributors

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published
0