Skip to content

docker-compose-linter/gitlab-ci-component

Repository files navigation

DCLint Component for GitLab

GitLab Release

This GitLab CI/CD component automates Docker Compose linting using DCLint.

It runs dclint and publishes a Code Quality Report compatible with GitLab Merge Request UI.

The source code is hosted on GitLab. Although there is an automatic mirror of this repository on GitHub, all bug reports, feature requests, and merge requests should be submitted through GitLab.

DCLint Features

  • Error Detection: Identifies syntax errors and common issues in Docker Compose files.
  • Style Enforcement: Enforces best practices and style guidelines for maintainable configurations.
  • Flexible Integration: Can be used locally, in Docker, or integrated into CI/CD pipelines.
  • Configurable Rules: Customize the linter's behavior and rules according to your project's needs.
  • Auto-fixable Rules: Some rules include an auto-fix mode, allowing you to automatically format and correct certain issues in your files.
  • Comments Support: After automated sorting and fixing, comments remain in the correct place, ensuring no important information is lost during the formatting process.
  • Anchor Support: Supports YAML anchors for shared configuration sections, with some limitations.

Usage Example

include:
  - component: $CI_SERVER_FQDN/dclint/ci-component/[email protected]

💡 Requires GitLab 16.8 or later

Merge Request Widget Example

DCLint highlights issues directly in the GitLab MR widget using Codequality reports.

DCLint MR Example{height=300px}

Inputs

Name Type Default Description
target string . DCLint Target path to lint
options string "" DCLint Extra CLI flags (e.g. --recursive)
formatter string codeclimate DCLint Formatter for output
version string 3.0.0 DCLint Version (used as ${version}-alpine)
job_prefix string codequality-dclint GitLab CI Job prefix
job_stage string .pre GitLab CI Pipeline stage
rules array - if: '$CI_PIPELINE_SOURCE == "push"' GitLab CI Rules
tags array [] Gitlab CI Runner tags
allow_failure boolean false Allow job to fail without failing the pipeline

Documentation

See DCLint Documentation.

Contributing

Merge requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

If you'd like to contribute to this project, please read through the CONTRIBUTING.md file.

Please note that this project is released with a Contributor Code of Conduct. By participating in this project, you agree to abide by its terms.

Versioning and Changelog

This repository itself is versioned using semantic-release. All changes are categorized and released based on Conventional Commits.

The changelog is automatically generated based on semantic-release and conventional commits.

See the CHANGELOG.md file for detailed lists of changes for each version.

Dependency Updates

  • The versions of dclint are checked weekly via a scheduled pipeline and used as default value.
  • If a new version is available, a merge request is automatically created to update all relevant files.

License

This project is licensed under the MIT License. See the LICENSE file for more information.

Contacts and Support

If you find this repository helpful, kindly consider showing your appreciation by giving it a star ⭐.

If you have any questions or suggestions, feel free to reach out:

Also, you can support this project with a one-time donation or becoming a sponsor:

PayPal Patreon GitHub Sponsors Open Collective