{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://paulkov.github.io/dpone/schemas/gitops/airflow-pack.schema.json",
  "title": "dpone GitOps Airflow runtime pack report",
  "type": "object",
  "required": [
    "kind",
    "schema_version",
    "pack_identity",
    "pack_fingerprint",
    "producer",
    "artifact_dir",
    "output_path",
    "bundle_path",
    "mode",
    "runner_policy",
    "include_live_gates",
    "artifacts",
    "steps",
    "next_actions",
    "warnings",
    "blockers"
  ],
  "properties": {
    "kind": {
      "const": "gitops.airflow_pack"
    },
    "schema_version": {
      "type": "string"
    },
    "pack_identity": {
      "type": "object",
      "required": [
        "schema"
      ],
      "additionalProperties": false,
      "properties": {
        "schema": {
          "const": "dpone.airflow-pack-identity.v1"
        }
      }
    },
    "producer": {
      "type": "string"
    },
    "artifact_dir": {
      "type": "string"
    },
    "output_path": {
      "type": "string"
    },
    "bundle_path": {
      "type": "string"
    },
    "image": {
      "type": [
        "string",
        "null"
      ]
    },
    "image_digest": {
      "type": [
        "string",
        "null"
      ]
    },
    "mode": {
      "type": "string"
    },
    "runner_policy": {
      "type": "string"
    },
    "include_live_gates": {
      "type": "boolean"
    },
    "artifacts": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": true,
        "required": [
          "name",
          "path",
          "format",
          "expected_kind",
          "required",
          "exists",
          "passed",
          "reason"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "path": {
            "type": "string"
          },
          "format": {
            "type": "string"
          },
          "expected_kind": {
            "type": "string"
          },
          "actual_kind": {
            "type": [
              "string",
              "null"
            ]
          },
          "required": {
            "type": "boolean"
          },
          "exists": {
            "type": "boolean"
          },
          "passed": {
            "type": "boolean"
          },
          "reason": {
            "type": "string"
          },
          "sha256": {
            "type": [
              "string",
              "null"
            ]
          },
          "bytes": {
            "type": [
              "integer",
              "null"
            ]
          }
        }
      }
    },
    "steps": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": true,
        "required": [
          "name",
          "phase",
          "command",
          "required",
          "credential_required",
          "produces",
          "reason"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "phase": {
            "type": "string"
          },
          "command": {
            "type": "string"
          },
          "required": {
            "type": "boolean"
          },
          "credential_required": {
            "type": "boolean"
          },
          "produces": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "reason": {
            "type": "string"
          },
          "depends_on": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      }
    },
    "runtime_selection": {
      "type": "object",
      "additionalProperties": true,
      "properties": {
        "mode": {
          "type": "string"
        },
        "required_for_selected_nodes": {
          "type": "boolean"
        }
      }
    },
    "process_plans": {
      "type": "object",
      "additionalProperties": {
        "type": "object",
        "additionalProperties": true,
        "required": [
          "selector",
          "dag_node",
          "runtime_commands",
          "steps"
        ],
        "properties": {
          "selector": {
            "type": [
              "string",
              "null"
            ]
          },
          "dag_node": {
            "type": "object",
            "additionalProperties": true,
            "required": [
              "process_name",
              "visibility",
              "task_group",
              "estimated_visible_tasks",
              "depends_on_process_selectors"
            ],
            "properties": {
              "process_name": {
                "type": "string"
              },
              "visibility": {
                "enum": [
                  "inline",
                  "task",
                  "group"
                ]
              },
              "task_group": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "estimated_visible_tasks": {
                "type": "integer",
                "minimum": 1
              },
              "depends_on_process_selectors": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          },
          "runtime_commands": {
            "type": "object",
            "additionalProperties": true,
            "required": [
              "inline",
              "expanded"
            ],
            "properties": {
              "inline": {
                "type": "string"
              },
              "expanded": {
                "type": "string"
              }
            }
          },
          "mapping_plan": {
            "type": "object",
            "required": [
              "schema",
              "mode",
              "plan_fingerprint",
              "backfill_plan_hash",
              "chunks_total",
              "items_total",
              "limits",
              "items"
            ],
            "additionalProperties": false,
            "properties": {
              "schema": {
                "const": "dpone.airflow-mapping-plan.v1"
              },
              "mode": {
                "enum": [
                  "internal",
                  "visible",
                  "summary"
                ]
              },
              "plan_fingerprint": {
                "type": "string",
                "pattern": "^sha256:[0-9a-f]{64}$"
              },
              "backfill_plan_hash": {
                "anyOf": [
                  {
                    "type": "string",
                    "pattern": "^sha256:[0-9a-f]{64}$"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "chunks_total": {
                "type": "integer",
                "minimum": 0
              },
              "items_total": {
                "type": "integer",
                "minimum": 0,
                "maximum": 200
              },
              "limits": {
                "type": "object",
                "required": [
                  "max_items",
                  "max_active",
                  "pool"
                ],
                "additionalProperties": false,
                "properties": {
                  "max_items": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 200
                  },
                  "max_active": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 64
                  },
                  "pool": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9_.-]*$"
                  }
                }
              },
              "items": {
                "type": "array",
                "maxItems": 200,
                "items": {
                  "type": "object",
                  "required": [
                    "item_index",
                    "first_chunk_index",
                    "last_chunk_index",
                    "chunks_count"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "item_index": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "first_chunk_index": {
                      "type": "integer",
                      "minimum": 1
                    },
                    "last_chunk_index": {
                      "type": "integer",
                      "minimum": 1
                    },
                    "chunks_count": {
                      "type": "integer",
                      "minimum": 1
                    }
                  }
                }
              }
            }
          },
          "steps": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true,
              "required": [
                "name",
                "phase",
                "command",
                "required",
                "credential_required",
                "produces",
                "reason"
              ],
              "properties": {
                "name": {
                  "type": "string"
                },
                "phase": {
                  "type": "string"
                },
                "command": {
                  "type": "string"
                },
                "required": {
                  "type": "boolean"
                },
                "credential_required": {
                  "type": "boolean"
                },
                "produces": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "reason": {
                  "type": "string"
                },
                "depends_on": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              }
            }
          }
        }
      }
    },
    "mapping_plan": {
      "type": "object",
      "required": [
        "schema",
        "mode",
        "plan_fingerprint",
        "backfill_plan_hash",
        "chunks_total",
        "items_total",
        "limits",
        "items"
      ],
      "additionalProperties": false,
      "properties": {
        "schema": {
          "const": "dpone.airflow-mapping-plan.v1"
        },
        "mode": {
          "enum": [
            "internal",
            "visible",
            "summary"
          ]
        },
        "plan_fingerprint": {
          "type": "string",
          "pattern": "^sha256:[0-9a-f]{64}$"
        },
        "backfill_plan_hash": {
          "anyOf": [
            {
              "type": "string",
              "pattern": "^sha256:[0-9a-f]{64}$"
            },
            {
              "type": "null"
            }
          ]
        },
        "chunks_total": {
          "type": "integer",
          "minimum": 0
        },
        "items_total": {
          "type": "integer",
          "minimum": 0,
          "maximum": 200
        },
        "limits": {
          "type": "object",
          "required": [
            "max_items",
            "max_active",
            "pool"
          ],
          "additionalProperties": false,
          "properties": {
            "max_items": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            },
            "max_active": {
              "type": "integer",
              "minimum": 1,
              "maximum": 64
            },
            "pool": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_.-]*$"
            }
          }
        },
        "items": {
          "type": "array",
          "maxItems": 200,
          "items": {
            "type": "object",
            "required": [
              "item_index",
              "first_chunk_index",
              "last_chunk_index",
              "chunks_count"
            ],
            "additionalProperties": false,
            "properties": {
              "item_index": {
                "type": "integer",
                "minimum": 0
              },
              "first_chunk_index": {
                "type": "integer",
                "minimum": 1
              },
              "last_chunk_index": {
                "type": "integer",
                "minimum": 1
              },
              "chunks_count": {
                "type": "integer",
                "minimum": 1
              }
            }
          }
        }
      }
    },
    "workload_dependencies": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": true,
        "required": [
          "kind",
          "path",
          "sha256"
        ],
        "properties": {
          "kind": {
            "type": "string"
          },
          "path": {
            "type": "string"
          },
          "sha256": {
            "type": "string"
          }
        }
      }
    },
    "next_actions": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "warnings": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/issue"
      }
    },
    "blockers": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/issue"
      }
    },
    "workload": {
      "type": "object",
      "additionalProperties": true
    },
    "effective_config": {
      "type": "object",
      "additionalProperties": true
    },
    "runtime_command": {
      "type": "string"
    },
    "runtime_manifest": {
      "type": "object",
      "additionalProperties": true,
      "required": [
        "path",
        "sha256",
        "kind"
      ],
      "properties": {
        "path": {
          "type": "string"
        },
        "sha256": {
          "type": [
            "string",
            "null"
          ]
        },
        "kind": {
          "type": "string"
        }
      }
    },
    "runtime_bootstrap": {
      "type": "object",
      "required": [
        "schema",
        "commands"
      ],
      "additionalProperties": false,
      "properties": {
        "schema": {
          "const": "dpone.airflow-runtime-bootstrap.v1"
        },
        "commands": {
          "type": "object",
          "minProperties": 1,
          "additionalProperties": {
            "type": "object",
            "required": [
              "argv",
              "env"
            ],
            "additionalProperties": false,
            "properties": {
              "argv": {
                "type": "array",
                "minItems": 3,
                "items": {
                  "type": "string"
                }
              },
              "env": {
                "type": "object",
                "required": [
                  "DPONE_SKIP_AIRFLOW_SEPARATE_HOOKS"
                ],
                "additionalProperties": false,
                "properties": {
                  "DPONE_SKIP_AIRFLOW_SEPARATE_HOOKS": {
                    "const": "1"
                  }
                }
              }
            }
          }
        }
      }
    },
    "runtime_payload": {
      "type": "object",
      "required": [
        "schema",
        "archive"
      ],
      "additionalProperties": false,
      "properties": {
        "schema": {
          "const": "dpone.airflow-runtime-payload.v1"
        },
        "archive": {
          "type": "object",
          "required": [
            "encoding",
            "format",
            "sha256",
            "bytes",
            "data"
          ],
          "additionalProperties": false,
          "properties": {
            "encoding": {
              "const": "base64"
            },
            "format": {
              "const": "tar+gzip"
            },
            "sha256": {
              "type": "string",
              "pattern": "^sha256:[0-9a-f]{64}$"
            },
            "bytes": {
              "type": "integer",
              "minimum": 1
            },
            "data": {
              "type": "string",
              "minLength": 4,
              "pattern": "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$"
            }
          }
        }
      }
    },
    "pod_spec": {
      "type": "object",
      "additionalProperties": true
    },
    "connection_projection": {
      "type": "object",
      "additionalProperties": true
    },
    "xcom": {
      "type": "object",
      "additionalProperties": true
    },
    "outcome_gate": {
      "type": "object",
      "additionalProperties": true
    },
    "provider_execution": {
      "type": "object",
      "required": [
        "schema",
        "kpo_kwargs",
        "pod_spec"
      ],
      "additionalProperties": false,
      "properties": {
        "schema": {
          "const": "dpone.airflow-provider-execution.v1"
        },
        "kpo_kwargs": {
          "type": "object",
          "required": [
            "task_id",
            "name",
            "labels",
            "env_vars"
          ],
          "additionalProperties": false,
          "properties": {
            "task_id": {
              "type": "string",
              "minLength": 1
            },
            "name": {
              "type": "string",
              "minLength": 1
            },
            "labels": {
              "type": "object",
              "additionalProperties": {
                "type": "string"
              },
              "required": [
                "dpone.dev/workload-id"
              ]
            },
            "env_vars": {
              "type": "object",
              "additionalProperties": {
                "type": "string"
              }
            }
          }
        },
        "pod_spec": {
          "type": "object",
          "required": [
            "spec"
          ],
          "additionalProperties": false,
          "properties": {
            "spec": {
              "type": "object",
              "required": [
                "containers"
              ],
              "additionalProperties": false,
              "properties": {
                "nodeSelector": {
                  "type": "object",
                  "maxProperties": 64,
                  "propertyNames": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 317,
                    "pattern": "^[^\\u0000-\\u0020](?:[^\\u0000-\\u001f]*[^\\u0000-\\u0020])?$"
                  },
                  "additionalProperties": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 63,
                    "pattern": "^[^\\u0000-\\u0020](?:[^\\u0000-\\u001f]*[^\\u0000-\\u0020])?$"
                  }
                },
                "tolerations": {
                  "type": "array",
                  "maxItems": 32,
                  "items": {
                    "type": "object",
                    "required": [
                      "effect",
                      "key",
                      "operator",
                      "value"
                    ],
                    "additionalProperties": false,
                    "properties": {
                      "key": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 317,
                        "pattern": "^[^\\u0000-\\u0020](?:[^\\u0000-\\u001f]*[^\\u0000-\\u0020])?$"
                      },
                      "operator": {
                        "const": "Equal"
                      },
                      "value": {
                        "type": "string",
                        "minLength": 0,
                        "maxLength": 63,
                        "pattern": "^(?:|[^\\u0000-\\u0020](?:[^\\u0000-\\u001f]*[^\\u0000-\\u0020])?)$"
                      },
                      "effect": {
                        "enum": [
                          "NoExecute",
                          "NoSchedule",
                          "PreferNoSchedule"
                        ]
                      }
                    }
                  }
                },
                "imagePullSecrets": {
                  "type": "array",
                  "maxItems": 8,
                  "items": {
                    "type": "object",
                    "required": [
                      "name"
                    ],
                    "additionalProperties": false,
                    "properties": {
                      "name": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 253,
                        "pattern": "^[^\\u0000-\\u0020](?:[^\\u0000-\\u001f]*[^\\u0000-\\u0020])?$"
                      }
                    }
                  }
                },
                "containers": {
                  "type": "array",
                  "minItems": 1,
                  "maxItems": 1,
                  "items": {
                    "type": "object",
                    "required": [
                      "name"
                    ],
                    "additionalProperties": false,
                    "properties": {
                      "name": {
                        "const": "base"
                      },
                      "resources": {
                        "type": "object",
                        "minProperties": 1,
                        "additionalProperties": false,
                        "properties": {
                          "limits": {
                            "type": "object",
                            "minProperties": 1,
                            "maxProperties": 64,
                            "propertyNames": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 253,
                              "pattern": "^[^\\u0000-\\u0020](?:[^\\u0000-\\u001f]*[^\\u0000-\\u0020])?$"
                            },
                            "additionalProperties": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 64,
                              "pattern": "^[^\\u0000-\\u0020](?:[^\\u0000-\\u001f]*[^\\u0000-\\u0020])?$"
                            }
                          },
                          "requests": {
                            "type": "object",
                            "minProperties": 1,
                            "maxProperties": 64,
                            "propertyNames": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 253,
                              "pattern": "^[^\\u0000-\\u0020](?:[^\\u0000-\\u001f]*[^\\u0000-\\u0020])?$"
                            },
                            "additionalProperties": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 64,
                              "pattern": "^[^\\u0000-\\u0020](?:[^\\u0000-\\u001f]*[^\\u0000-\\u0020])?$"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "kpo_kwargs": {
      "type": "object",
      "additionalProperties": true
    },
    "mapped_kpo_kwargs": {
      "type": "object",
      "additionalProperties": true
    },
    "artifact_index": {
      "type": "object",
      "additionalProperties": true
    },
    "pack_fingerprint": {
      "type": "string",
      "pattern": "^sha256:[0-9a-f]{64}$"
    }
  },
  "$defs": {
    "issue": {
      "type": "object",
      "additionalProperties": true,
      "required": [
        "code",
        "message",
        "path",
        "source"
      ],
      "properties": {
        "code": {
          "type": "string"
        },
        "message": {
          "type": "string"
        },
        "path": {
          "type": "string"
        },
        "source": {
          "type": "string"
        }
      }
    }
  },
  "additionalProperties": true
}
