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_toolkit-0.0.1.tar.gz (10.2 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_toolkit-0.0.1-py3-none-any.whl (11.3 kB view details)

Uploaded Python 3

File details

Details for the file ci_test_toolkit-0.0.1.tar.gz.

File metadata

  • Download URL: ci_test_toolkit-0.0.1.tar.gz
  • Upload date:
  • Size: 10.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.1

File hashes

Hashes for ci_test_toolkit-0.0.1.tar.gz
Algorithm Hash digest
SHA256 f989ee891f0bedad0a098fdb9fcaf19f9d0caf3913e0d89c8f1696028426ed56
MD5 4096404afc33013718cd1575922e53a9
BLAKE2b-256 1713df21c97c3c1d1abb5a3c0c5f49f4081f87a66c2b9e4d865ddbaeca5c336f

See more details on using hashes here.

File details

Details for the file ci_test_toolkit-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for ci_test_toolkit-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6af76cd08da757c743974e78c071940b1b1679dd0f3c66789caafaafc256909b
MD5 0345662ae502318fb4fa67cb6f2bf881
BLAKE2b-256 5d9427f235f976976a50d2216c7737794a0a377e3dd414cf4a609a78e3f9e946

See more details on using hashes here.

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