Preskoči na sadržaj

ci-state.json — field-by-field

TL;DR

Per-run dinamički state, owner je CI pipeline. Atomic write (tempfile + os.replace) preko pipeline_state.write_state_with_mirrors. Tri nivoa: pipeline (global), services (per-svc), summary (agregat).

Top-level

{
  "schema": "https://schemas.infopuls.app/ci-state/v10.json",
  "pipeline": { ... },
  "services": { ... },
  "summary": { ... }
}
Field Tip Svrha
pipeline dict Pipeline-level metadata
services dict Per-service runtime state
summary dict Aggregate counters

pipeline

{
  "deployment_type": "production",
  "head_commit": "abc123...",
  "base_commit": "def456...",
  "release_commit": "ghi789...",
  "release_mode": true,
  "branch": "main",
  "build_number": "42"
}
Field Tip Svrha
deployment_type enum production/staging/preview/development/test
head_commit SHA Bitbucket commit that triggered pipeline
base_commit SHA Diff base (for change detection)
release_commit SHA Production only — commit bump created
release_mode bool True if release_commit is set
branch string Git branch
build_number string Bitbucket build number / CI run id

release_commit + release_mode = Release Invariant contract. ci-checkout-release koristi ove za re-pin HEAD-a. Više: 03-release/01-two-patterns.md.

services.<name>

{
  "version": "1.2.3",
  "semver": "1.2.3",
  "image_tag": "1.2.3",
  "image": "infopuls/api:1.2.3",
  "release_tag": "v1.2.3",
  "build_number": 42,
  "build": {
    "status": "deployed",
    "duration_seconds": 245,
    "image_digest": "sha256:..."
  },
  "scan": {
    "status": "passed",
    "vulnerabilities": { "critical": 0, "high": 2 }
  },
  "deploy": {
    "status": "deployed",
    "duration_seconds": 60,
    "task_definition_arn": "arn:aws:ecs:..."
  },
  "notify": {
    "status": "sent",
    "channel": "#deploys"
  },
  "jira": {
    "release": {
      "version_id": "12345",
      "version_name": "v1.2.3",
      "transition": {
        "from": "In Progress",
        "to": "Done"
      }
    }
  }
}
Field Tip Ko piše
version / semver string bump
image_tag string bump (production: bez suffix, ostalo: sa suffix)
image string build (full <registry>/<repo>:<tag>)
release_tag string bump (prazan za non-production)
build_number int bump (CI build number za traceability)
build.status enum build (pending/running/deployed/failed)
scan.status enum scan (passed/failed/skipped)
deploy.status enum deploy (deployed/failed/skipped)
deploy.platforms.{ios,android} dict EAS deploy (per-platform sub-state)
notify.status enum notify (sent/failed/skipped)
jira.release dict bump (v28+, opt-in)

summary (agregat)

{
  "total_services": 5,
  "build_succeeded": 5,
  "build_failed": 0,
  "deploy_succeeded": 4,
  "deploy_failed": 1,
  "deploy_skipped": 0
}

Računa pipeline_state.compute_summary() na kraju pipeline-a.

Dual-write (canonical + shards)

Svaki business verb piše u oba:

  • canonical: ci-state.json
  • shards: ci-state.<svc>.<env>[.<platform>].json

Pomoću pipeline_state.write_state_with_mirrors. Razlog: shard-glob fan-in (merge-state) hvata i raw canonical writes.

Detalji: 12-state-write-protocol.md.

Vidi i