Skip to content

distributedci/dci-mkjob

Repository files navigation

dci-mkjob

Parse Jenkins pipeline builds and create DCI (Distributed CI) jobs from them.

This tool fetches build data from Jenkins, downloads artifacts, identifies OpenShift components, and prepares job metadata for DCI integration.

Prerequisites

  • Python 3.x
  • Access to Jenkins API
  • DCI credentials (remoteci)

Installation

python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt

Configuration

Export your DCI credentials (typically by sourcing your dcirc.sh file):

source ~/dcirc.sh

Required environment variables:

Variable Description
DCI_CS_URL DCI Control Server URL (defaults to https://api.distributed-ci.io)
DCI_CLIENT_ID Your DCI client ID
DCI_API_SECRET Your DCI API secret

Usage

python3 ./parse-job.py <job_name> <jenkins_url>

Arguments

Argument Description
job_name Name for the job (used for cache directory)
jenkins_url Jenkins job URL (e.g., https://jenkins.example.com/job/my-pipeline/)

Options

Option Description
-v, --verbose Enable debug logging for troubleshooting
--no-cache Ignore cached data and fetch fresh from Jenkins (remove the .cache folder)

Example

python3 ./parse-job.py ocp-ztp-deployment https://jenkins.example.com/job/ocp-ztp-deployment/

How It Works

  1. Fetches job metadata and build history from Jenkins API
  2. For each build:
    • Downloads build data and Blue Ocean pipeline nodes
    • Downloads configured artifacts (see settings.py)
    • Identifies the OpenShift component from build logs
    • Builds a DCI job structure with status, duration, and tasks

Project Structure

├── parse-job.py      # Main entry point
├── cli.py            # Command-line argument parsing
├── clean.py          # Cache management
├── http_client.py    # HTTP utilities
├── settings.py       # Configuration (artifact filters, DCI settings)
├── dci/
│   ├── client.py     # DCI API client
│   ├── component.py  # OpenShift component detection
│   ├── files.py      # DCI file operations
│   ├── job.py        # DCI job building
│   └── tasks.py      # DCI task handling
├── jenkins/
│   ├── artifacts.py  # Artifact downloading
│   └── nodes.py      # Blue Ocean nodes API
└── tests/
    └── test_component.py  # Component detection tests

Cache

Build data is cached in .cache/<job_name>/ to avoid repeated API calls. Use --no-cache to force a fresh fetch.

About

Jenkins to DCI parser

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published