Skip to main content

A framework for static analysis testing of CI configurations.

Project description

CI Test

Evan Kohilas

A framework for static analysis testing of CI configurations.

Installation

Install using pipx install ci-test-toolkit to add ci-test to your PATH.

The tool can be run either via ci-test once installed or python -m ci_test from within the src folder.

Example

ci-test gitlab rule-snapshot <path_to_json> will create a snapshot of your ci configuration, by listing all rulesets and the jobs that will run for each of them.

This snapshot can then be used to generate diffs of the linking between jobs and their rules.

Input Generation

Currently the tool is setup to take input of the following form:

[
    {
        "name": "job-name",
        "rules": [
            {
                "if": "$CI_PIPELINE_SOURCE == 'push'"
            },
            {
                "if": "$CI_PIPELINE_SOURCE == 'merge_request_event'",
                "changes": [
                    "**/*.py"
                ]
            },
        ]
    }
]

This is easiest made using gitlab-ci-local

With node installed, run npx gitlab-ci-local --list-json > gitlab-ci-local.json in a project directory with a .gitlab-ci.yml file.

Then, run ci-test gitlab rule-snapshot gitlab-ci-local.json to create a collated snapshot.

TODO

  • Remove the dependency on gitlab-ci-local
  • Support GitHub configurations
  • Add more testing commands
  • Add better CLI
  • Add linting/formatting
  • Clean up for best practices

Contibuting

Please see CONTRIBUTING.md for a head start.

Pull requests welcome!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ci_test-0.0.5.tar.gz (10.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ci_test-0.0.5-py3-none-any.whl (12.1 kB view details)

Uploaded Python 3

File details

Details for the file ci_test-0.0.5.tar.gz.

File metadata

  • Download URL: ci_test-0.0.5.tar.gz
  • Upload date:
  • Size: 10.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for ci_test-0.0.5.tar.gz
Algorithm Hash digest
SHA256 ae7842b75ff3b074bc3f30795ee34226a989ce5e514f138e2aa21ef89f3d698f
MD5 44a9b658f6ae4b3e545823c6491bfa2b
BLAKE2b-256 c0d4eee17608c901af6e345d80be1771fcf61c60548a4f8a7fdcd5db172814a7

See more details on using hashes here.

Provenance

The following attestation bundles were made for ci_test-0.0.5.tar.gz:

Publisher: python-package.yml on ekohilas/ci-test

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ci_test-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: ci_test-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 12.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for ci_test-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 58d65f16128164c4bfd08302d35301395075b2cc040c72ad97bfa8232ae1e961
MD5 570ca02e3cc2297fe5aec47e27de8696
BLAKE2b-256 439e5a6360faa7cdd26dba9ad7e604664b7526067e091b575c42e78097c422ca

See more details on using hashes here.

Provenance

The following attestation bundles were made for ci_test-0.0.5-py3-none-any.whl:

Publisher: python-package.yml on ekohilas/ci-test

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page