นโยบายระดับองค์กร: กฎของทีม กฎขององค์กร และกฎของไปป์ไลน์
นโยบาย
กฎinfo และ warn ให้halt หยุดtranslation
สิ่งที่ตัวอย่างนี้บิลด์
| อินสแตนซ์ | Component ของ | สิ่ง |
|---|---|---|
db | core/datastore/mariadb | ฐาน |
web | core/devtool/adminer | UI ดูแลdb |
ทั้งdist/compose/docker-compose.yaml Aggregate เดียว Manifest เดียว และ Release เดียว คือ release.yaml ไม่มี
ไฟล์ทั้งสามไฟล์
| ใคร | ไฟล์ | วิธี | ที่ |
|---|---|---|---|
| ทีม | .aggrega-config.yaml | ทำ | plugins.governance |
| องค์กร | org/config.yaml | เป็น--config org/config.yaml | plugins.governance_append |
| ไปป์ไลน์ | pipeline/.aggrega-config-append-ci.yaml | เมื่อ | plugins.governance_append |
การgovernance/rego:0.9.0 ที่ir-verdict ซึ่ง0.9.0 คือaggrega plugin list แสดง governance/rego ใน
ไฟล์AGGREGA_CONFIG ระบุ --config <path> ระบุorg/ และ
ไฟล์.aggrega-config-append-ci.yaml ใน.aggrega-config.yaml อยู่pipeline/ ซึ่ง
cp pipeline/.aggrega-config-append-ci.yaml .แต่ละไฟล์เพิ่ม และส่วนซ้อนทับของไปป์ไลน์เพิ่มได้อย่างเดียว
องค์กรplugins.governance_append ซึ่งplugins.governance รายการplugins.governance ของplugins.governance เอง เพราะplugins.governance ใน
ส่วนauto_pull ส่วนauto_pull: true และ<workspace> แทน
warning: <workspace>/.aggrega-config-append-ci.yaml: ignoring non-additive key "auto_pull" (the CI-owned overlay is additive-only and cannot override the base config)กฎ และระดับความรุนแรงที่แต่ละข้อรายงาน
นโยบาย Rego รวบรวมtranslation คีย์deny, warn และ audit ซึ่งhalt, warn และ info:
| ระดับ | สิ่ง |
|---|---|
halt | หยุด ออก1 และdist/ |
warn | สำเร็จ พิมพ์dist/ |
info | สำเร็จ พิมพ์dist/ |
กฎpolicies/team.rego รวบรวมwarn และtranslation จึงwarn:
warn contains msg if { some id, node in input.graph.spec.nodes node.labels["component.aggrega.ai/category"] == "datastore" input.graph.spec.infra_mapping[id].ha.enabled == false msg := sprintf("%v runs with high availability off", [id])}กฎorg/policies/estate.rego ปฏิเสธ
deny contains msg if { some id, node in input.graph.spec.nodes category := node.labels["component.aggrega.ai/category"] category in data.refused_categories msg := sprintf("%v runs %v, in the %v category, which the organization does not ship", [id, node.component, category])}
audit contains msg if { some id, node in input.graph.spec.nodes msg := sprintf("%v runs %v %v, upstream licensing %v", [id, node.component, node.resolved_version, node.labels["component.aggrega.ai/upstream-licensing"]])}refused_categories เป็นการdata
การแปล: หนึ่งกฎ สองระดับความรุนแรง
บล็อก translation ใน
ไฟล์deny ที่ warn และ audit ที่ info:
settings: refused_categories: [devtool] translation: - key: deny severity: warn - key: audit severity: infoไปป์ไลน์deny เพียงaudit ซ้ำ
settings: refused_categories: [devtool] translation: - key: deny severity: haltดังweb เดียวกัน เป็น
ร่างตัวอย่าง
คุณ
เขียน
aggrega draft --example policy-org-overlayจาก
cd policy-org-overlayบิลด์
แค็ตตาล็อกhub.aggrega.ai ซึ่ง.aggrega-config.yaml ระบุ เมื่อ--catalog จะ--auto-pull เติม
ด้วย
aggrega build --release release.yaml --auto-pullบิลด์
aggrega build --release release.yaml --auto-pull --config org/config.yamlพิมพ์info และwarn ข้าง
info: policy plugin "rego": db runs core/datastore/mariadb 1.0.0, upstream licensing osi-approved info: policy plugin "rego": web runs core/devtool/adminer 1.0.0, upstream licensing osi-approved policy plugin "rego" warning: db runs with high availability off policy plugin "rego" warning: web runs core/devtool/adminer, in the devtool category, which the organization does not shipPull complete: release.lock (entities=11, source_artifacts=0, external_inputs=0) notice: LINT: Feature "core/secret-value" at core/secret-value:1.0.0 declares property "origin" in both values: and infra: pillars (path: origin)[… omitted: the build's time and the line naming the dist/ directory it wrote]คำrego ไม่ใช่
เมื่อ
cp pipeline/.aggrega-config-append-ci.yaml .aggrega build --release release.yaml --auto-pull --config org/config.yaml[… omitted: the overlay's warning shown above][… omitted: the lines printed while the lockfile is resolved, which carry the verdicts below once more, the refusal among them] info: policy plugin "rego": db runs core/datastore/mariadb 1.0.0, upstream licensing osi-approved info: policy plugin "rego": web runs core/devtool/adminer 1.0.0, upstream licensing osi-approved policy plugin "rego" warning: db runs with high availability off policy plugin "rego" warning: web runs core/devtool/adminer, in the devtool category, which the organization does not ship notice: LINT: Feature "core/secret-value" at core/secret-value:1.0.0 declares property "origin" in both values: and infra: pillars (path: origin)[POLICY_ERROR E0005] policy plugin "rego" rejected the build: web runs core/devtool/adminer, in the devtool category, which the organization does not ship caused by: policy violationบิลด์1 และdist/ กฎwarn โดยhalt โดยaudit ปรากฏ.aggrega-config-append-ci.yaml ออก
กับผู้ช่วย AI
ผู้
ใช้เครื่องมือของ Aggrega เท่านั้น และไม่สร้างโฟลเดอร์เอง หากโฟลเดอร์พื้นที่ทำงานยังไม่มีโฟลเดอร์ `policy-org-overlay` เรียกเครื่องมือ `draft` หนึ่งครั้งโดยตั้ง `example` เป็น `policy-org-overlay` และไม่ระบุ `dir`: เครื่องมือจะเขียนตัวอย่างลงในโฟลเดอร์ `policy-org-overlay` ใหม่ จากนั้นเรียกเครื่องมือ `build` โดยตั้ง `workspace_root` เป็น `policy-org-overlay` ตั้ง `release` เป็น `release.yaml` ตั้ง `auto_pull` เป็น true และตั้ง `write` เป็น true แล้วแจ้งฉันว่านโยบายรายงานอะไร จากนั้นเรียกเครื่องมือ `cli-build` ซึ่งรัน `aggrega build` และรับแฟล็ก `--config` โดยตั้ง `workspace_root` เป็น `policy-org-overlay` ตั้ง `release` เป็น `release.yaml` ตั้ง `auto_pull` เป็น true และตั้ง `config` เป็น `org/config.yaml` แล้วแจ้งฉันว่านโยบายรายงานอะไรในครั้งนี้ แจ้งฉันว่าแต่ละบิลด์เขียนไฟล์ใดบ้าง ไฟล์เหล่านั้นอยู่ใต้ `policy-org-overlay/dist/`การตรวจสอบทุกบิลด์
การaggrega draft --example เขียน
./check.shcheck.sh บิลด์ release.yaml ห้า--config ด้วยplugins.governance แทนdist/ หรือauto_pull พิมพ์
LAYERS EXIT DIST VERDICT----------------------------------------------------------------------------------------------------team 0 yes OKteam + organization 0 yes OKteam + pipeline 1 no OKall three 1 no OKteam + organization, plugins.governance 0 yes OK
team: warn db runs with high availability off
team + organization: info db runs core/datastore/mariadb 1.0.0, upstream licensing osi-approved info web runs core/devtool/adminer 1.0.0, upstream licensing osi-approved warn db runs with high availability off warn web runs core/devtool/adminer, in the devtool category, which the organization does not ship
team + pipeline: ignored auto_pull warn db runs with high availability off halt web runs core/devtool/adminer, in the devtool category, which the organization does not ship
all three: ignored auto_pull info db runs core/datastore/mariadb 1.0.0, upstream licensing osi-approved info web runs core/devtool/adminer 1.0.0, upstream licensing osi-approved warn db runs with high availability off warn web runs core/devtool/adminer, in the devtool category, which the organization does not ship halt web runs core/devtool/adminer, in the devtool category, which the organization does not ship
team + organization, plugins.governance: warn db runs with high availability off
check: every build ended as expected.สำเนา.aggrega-config.yaml ของ./build-release.sh หาAGGREGA_BIN กำหนด-- ส่ง
ตำแหน่งที่คอมไพเลอร์ไม่ตีความ
คอมไพเลอร์
ไฟล์
aggregate.yaml— ฐานข้อมูล และ UI สำหรับ การ ดูแล ที่ เชื่อม โยง กับ ฐาน ข้อมูล manifest.yaml— ผูกชนิด ของ ส่วน ประกอบ แต่ละ ชนิด และ Feature ข้อมูล ลับ เข้า กับ Recipe ของ Docker Compose release.yaml— Release เพียงรายการ เดียว .aggrega-config.yaml— ไฟล์ของ ทีม: รีจิสทรี เริ่ม ต้น และ การ แนบ ของ ทีม policies/team.rego— กฎของ ทีม org/config.yaml— ไฟล์การ กำหนด ค่า ส่วน กลาง ของ องค์กร และ การ แนบ ของ ไฟล์ org/policies/estate.rego— กฎของ องค์กร pipeline/.aggrega-config-append-ci.yaml— ส่วนซ้อน ทับ ของ ไปป์ไลน์ ที่ อ่าน เมื่อ คัด ลอก เข้า ไดเรกทอรี นี้ build-release.sh— บิลด์ Release หนึ่งรายการ โดย พิมพ์ คำ สั่ง aggrega buildที่เทียบ เท่า check.sh— ทำการบิลด์ ห้า รอบ และ ตรวจ สอบ ผล ของ แต่ละ รอบ