콘텐츠로 이동
AggregaAggrega
언어 선택: 한국어
이 페이지는 기계 번역되었습니다. 영어 원문 읽기.

자체 거버넌스 플러그인 작성하기

이 페이지는 플러그인 개발 키트의 어댑터 스켈레톤에서 시작하여 빌드를 거부하는 거버넌스 플러그인까지 단계별로 안내합니다. 스켈레톤을 복사하고, 규칙 하나를 작성하고, .wasm을 빌드하고, 스켈레톤에 포함된 페이로드 파일로 각 내보내기를 직접 호출하고, 작업 공간 자체 카탈로그에 Plugin 엔터티로 선언하고, 역할에 연결한 다음, 규칙을 어기는 빌드를 중단시키는 것을 확인합니다.

이 페이지는 네 가지 역할, 각 역할이 전달하는 페이로드, 호스트가 따르는 판정을 설명하는 거버넌스 소켓, 그리고 Plugin 엔터티와 그 수명 주기를 설명하는 플러그인 개발자 가이드의 실습 동반 문서입니다. 프로바이더 작성하기는 프로바이더 게스트에 대한 같은 종류의 안내입니다.

이 페이지의 블록에 대하여. 출력을 보여 주는 모든 블록은 아래 단계를 나온 순서대로 실제로 실행한 결과에서 복사했으며, 출력 관례를 따릅니다. 블록은 완전하거나, 생략한 줄의 위치를 표시한 발췌입니다. 두 플레이스홀더는 머신마다 다른 절대 경로를 나타냅니다. <guest>는 스켈레톤 복사본의 디렉터리이고, <workspace>는 플러그인이 연결되는 작업 공간의 디렉터리입니다.

준비물

  • 추가 도구 없이 WebAssembly로 컴파일하는 Go 툴체인.
  • 스켈레톤이 들어 있는 플러그인 개발 키트와 키트가 기반으로 하는 ABI 패키지의 체크아웃. 복사본의 go.mod가 둘 다 가리킵니다.
  • aggrega 바이너리.

키트는 같은 스켈레톤을 Rust용으로 rust/examples/governance-adapter-skeleton에, TypeScript용으로 typescript/examples/governance-adapter-skeleton에 제공합니다. 각각 같은 네 페이로드 파일을 가지며, 수정하지 않은 각 복사본은 그것에 같은 방식으로 응답합니다. 이 페이지의 모든 aggrega 명령은 각자의 아티팩트 이름으로 어느 쪽에나 적용되며, 빌드 방법은 각 README에 있습니다.

완성된 결과물의 형태

거버넌스 플러그인은 다른 플러그인과 마찬가지로 두 아티팩트로 이루어집니다. .wasm 게스트와, 그것을 카탈로그로 가져오는 Plugin 엔터티입니다. 연결은 작업 공간 구성의 항목 하나입니다. 컴파일러는 아무것도 바뀌지 않습니다.

이 안내가 끝날 때 생기는 두 디렉터리(빌드가 작업 공간에 쓰는 것 제외):

category-guard/ your copy of the skeleton: the Go module that compiles to the .wasm
.gitignore
README.md the skeleton's own guide
go.mod
go.sum
main.go the describe() self-report and the shared plumbing
evaluator.go the seam, where the rule goes
annotations.go the annotation-transform role
labels.go the label-transform role
verdicts.go the ir-verdict and render-verdict roles
build.sh
annotation-payload.json
label-payload.json
ir-verdict-payload.json
render-verdict-payload.json
my-payload.json a copy you edit in section 4
wrong-payload.json a copy you break in section 5
overlay.yaml the identity you supply to the entity generator
dist/governance-adapter-skeleton-go.wasm the compiled guest
shop/ the workspace the plugin is attached in
catalog/component/example/compute/api/1.0.0/component.yaml
catalog/component/example/devtool/db-console/1.0.0/component.yaml
catalog/recipe/compose/api/1.0.0/recipe.yaml
catalog/recipe/compose/db-console/1.0.0/recipe.yaml
catalog/plugin/governance/category-guard/0.1.0/plugin.yaml
catalog/plugin/governance/category-guard/0.1.0/governance--category-guard.wasm
aggregate.yaml
manifest.yaml
release.yaml
.aggrega-config.yaml

플러그인이 시행하는 규칙은 흔한 것입니다. 작업 공간은 배포하지 않는 컴포넌트 카테고리(여기서는 관리 콘솔의 카테고리인 devtool)를 지정하고, 그중 하나에 속하는 컴포넌트를 가진 빌드는 그 컴포넌트를 지목하며 중단됩니다.

1. 스켈레톤 복사하기

Terminal window
cp -r /path/to/aggrega-pdk/go/examples/governance-adapter-skeleton category-guard
cd category-guard

스켈레톤의 go.mod는 키트 안에서의 위치를 기준으로 한 상대 경로로 키트와 ABI 패키지를 참조하므로, 키트 밖의 복사본은 이를 직접 지정해야 합니다. 모듈에 자신만의 경로를 부여하고 두 replace 줄이 체크아웃을 가리키게 하십시오.

module example.com/category-guard
go 1.26.0
require (
github.com/aggrega-ai/aggrega-abi/go v0.0.0
github.com/aggrega-ai/aggrega-pdk/go v0.0.0
github.com/extism/go-pdk v1.1.3
)
replace github.com/aggrega-ai/aggrega-pdk/go => /path/to/aggrega-pdk/go
replace github.com/aggrega-ai/aggrega-abi/go => /path/to/aggrega-abi/go

스켈레톤의 go.sum은 그대로 둡니다.

2. 빌드하고 각 역할을 직접 호출하기

아무것도 바꾸기 전에 복사본을 빌드하여, 처음 실행하는 것이 직접 작성하지 않은 연결 코드가 되도록 합니다.

Terminal window
./build.sh
Wrote <guest>/dist/governance-adapter-skeleton-go.wasm

aggrega plugin run-local은 경로에서 게스트를 로드하고, 지정한 내보내기가 게스트의 describe() 자체 보고에 선언되어 있는지, 그리고 --type governance를 지정하면 게스트가 자신을 거버넌스 플러그인으로 보고하는지 확인한 다음, 제공한 페이로드로 호출하고 응답을 출력합니다. 스켈레톤은 역할마다 페이로드 파일 하나를 제공하며, 각각은 해당 내보내기에 대한 작고 유효한 입력입니다. 페이로드는 JSON으로 작성합니다. 모든 거버넌스 역할의 와이어는 바이너리 인코딩을 사용하므로, 명령은 내보내기를 호출하기 전에 페이로드를 그 인코딩으로 변환하고 내보내기의 응답을 JSON으로 출력합니다.

Terminal window
aggrega plugin run-local --plugin dist/governance-adapter-skeleton-go.wasm \
--type governance --export transform_annotations --with @annotation-payload.json
{
"injections": []
}

run-local은 지정한 경로에서 게스트와 페이로드를 읽고 작업 공간이 필요 없으므로, 어느 디렉터리에서든 실행할 수 있습니다.

Terminal window
aggrega plugin run-local --plugin dist/governance-adapter-skeleton-go.wasm \
--type governance --export mutate --with @label-payload.json
{
"patches": []
}
Terminal window
aggrega plugin run-local --plugin dist/governance-adapter-skeleton-go.wasm \
--type governance --export verdict_ir --with @ir-verdict-payload.json
{
"results": [
{
"severity": "info",
"message": "this adapter has no policy engine yet: the seam received rules.policy (43 bytes) and some settings"
}
]
}
Terminal window
aggrega plugin run-local --plugin dist/governance-adapter-skeleton-go.wasm \
--type governance --export verdict_render --with @render-verdict-payload.json
{
"results": [
{
"severity": "info",
"message": "this adapter has no policy engine yet: the seam received rules.policy (43 bytes) and some settings"
}
]
}

각 응답은 해당 역할이 반환할 수 있는 형태입니다. 추가할 주석, 레이블 변경, 판정입니다. 두 변환 역할은 아무것도 반환하지 않으며, 각 판정 역할은 info 판정 하나를 반환합니다. 이는 관찰을 기록하고 빌드 결과는 바꾸지 않는 메모입니다. 이 메모가 스켈레톤 연결의 증거입니다. 각 페이로드 파일은 빌드가 넘겨주는 형태 그대로 연결의 두 입력을 담고 있습니다. sources 아래의 정책 파일 하나 rules.policy와 settings 객체입니다. 메모는 둘 다 이음매, 즉 스켈레톤의 나머지 부분이 역할이 받은 내용으로 호출하는 하나의 함수에 도달했다고 말합니다.

아래 규칙이 읽을 페이로드 ir-verdict-payload.json의 전체 내용은 다음과 같습니다.

{
"graph": {
"apiVersion": "aggrega.ai/v1beta1",
"kind": "IR",
"metadata": {
"aggregate_name": "shop"
},
"spec": {
"nodes": {
"api": {
"component": "example/compute/api",
"resolved_version": "1.0.0",
"labels": {
"component.aggrega.ai/type": "server",
"component.aggrega.ai/category": "compute"
}
}
},
"edges": [],
"values_mapping": {},
"infra_mapping": {},
"feature_values_mapping": {},
"provenance": {
"schema_version": "aggrega.ai/v1beta1",
"compiler_version": "0.0.0",
"aggregate_version": "1.0.0",
"manifest_version": "1.0.0",
"release_version": "1.0.0"
}
}
},
"precalculated_paths": [],
"sources": [
{
"path": "rules.policy",
"content": "policy text, handed to the engine verbatim\n"
}
],
"settings": {
"max_nodes": 50
}
}

이것은 ir-verdict 역할의 입력입니다. 컴포넌트 하나가 들어 있는 빌드 그래프, 그래프에서 열거한 라우팅 경로, 연결의 sources와 settings로 이루어집니다. 모든 필드는 역할의 참조 페이지인 정책 소켓 스키마에, 그래프 자체는 빌드 그래프 스키마에 설명되어 있습니다. 나머지 세 파일은 annotation-transform 스키마, mutator 스키마, 그리고 verdict_render의 경우 정책 소켓 스키마의 RenderPolicyInput을 따릅니다.

3. 규칙 하나 작성하기

규칙은 스켈레톤의 이음매인 evaluator.go에 있습니다. 모든 역할은 페이로드를 디코딩하여 JSON 문서로 쓰고, 연결의 정책 파일, 설정, 그 문서, 돌려받을 결정의 이름을 넘겨 Evaluate를 호출합니다. 판정 역할은 세 결정 deny, warn, audit를 차례로 요청하고 각 응답을 심각도 halt, warn, info로 보고합니다. 두 변환 역할은 annotations와 labels를 요청합니다. 따라서 빌드를 중단시키는 규칙은 deny에 응답합니다.

evaluator.go를 다음으로 바꿉니다.

package main
import (
"encoding/json"
"fmt"
"slices"
"sort"
)
// Program is one policy program the attachment carried.
type Program struct {
Path string
Text string
}
// categoryLabel is the label a catalog Component states its category in.
const categoryLabel = "component.aggrega.ai/category"
// Evaluate refuses every component whose category the attachment's settings
// list under forbidden_categories.
func Evaluate(programs []Program, settings json.RawMessage, payload json.RawMessage, decision string) ([]json.RawMessage, error) {
if decision != denyDecision {
return nil, nil
}
var config struct {
ForbiddenCategories []string `json:"forbidden_categories"`
}
if len(settings) > 0 {
if err := json.Unmarshal(settings, &config); err != nil {
return nil, fmt.Errorf("reading the settings: %w", err)
}
}
var input struct {
Graph struct {
Spec struct {
Nodes map[string]struct {
Labels map[string]string `json:"labels"`
} `json:"nodes"`
} `json:"spec"`
} `json:"graph"`
}
if err := json.Unmarshal(payload, &input); err != nil {
return nil, fmt.Errorf("reading the build graph: %w", err)
}
// A Go map has no order, so the node ids are sorted: identical input must
// yield an identical sequence of decisions.
ids := make([]string, 0, len(input.Graph.Spec.Nodes))
for id := range input.Graph.Spec.Nodes {
ids = append(ids, id)
}
sort.Strings(ids)
var decisions []json.RawMessage
for _, id := range ids {
category := input.Graph.Spec.Nodes[id].Labels[categoryLabel]
if !slices.Contains(config.ForbiddenCategories, category) {
continue
}
message, err := json.Marshal(fmt.Sprintf(
"component %q is a %s component, and this workspace ships none", id, category))
if err != nil {
return nil, err
}
decisions = append(decisions, message)
}
return decisions, nil
}

Program은 남겨 둡니다. 역할 파일이 그것으로 프로그램 목록을 만들기 때문입니다. 나머지가 규칙이며, 그중 네 가지는 자세히 읽어 볼 만합니다.

  • 와이어가 붙인 이름으로 페이로드를 읽습니다. 노드는 graph.spec.nodes에 노드 ID를 키로 하여 있고, 각각 labels를 가집니다. 이는 각 역할의 페이로드가 노출하는 내용이 Rego 정책에 input.graph.spec.nodes로 제공하는 것과 같은 경로입니다. 이 역할용으로 작성한 규칙은 다른 역할에서는 아무것도 읽지 않습니다. render-verdict 페이로드에는 그래프가 없으므로 거기서는 루프가 노드를 찾지 못합니다.
  • 무엇을 금지할지는 플러그인이 아니라 운영자가 정합니다. 카테고리는 연결의 settings에서 오므로, 같은 .wasm이 devtool을 금지하는 작업 공간과 아무것도 금지하지 않는 작업 공간 모두에 쓰입니다.
  • 응답하기 전에 정렬합니다. 빌드의 출력은 동일한 입력의 실행 간에 바이트 단위로 동일하며, Go 맵의 순서로 응답하는 게스트는 내부에서 이를 깨뜨립니다.
  • 실패를 분명히 드러냅니다. 읽을 수 없는 설정이나 페이로드는 빈 목록 대신 오류를 반환하며, 역할은 그 오류를 실패한 호출로 바꿉니다. 빈 목록은 정책이 할 말을 찾지 못했다는 뜻이고, 실패한 호출은 정책이 실행되지 않았다는 뜻입니다. 게스트가 둘을 구분해야만 빌드도 둘을 구분할 수 있습니다.

규칙은 programs를 읽지 않습니다. 이 플러그인의 규칙은 게스트에 컴파일되어 있으므로, 연결은 설정만 제공하고 정책 파일은 제공하지 않습니다. 미리 컴파일된 엔진을 중심으로 만든 게스트와 같은 형태이며, sources에서 규칙을 로드하는 게스트와는 반대입니다.

마지막으로, 플러그인이 무엇인지 기술합니다. main.go에서 descriptor()의 설명을 바꿉니다.

Description: "Refuse a build that carries a component of a category the attachment forbids.",

6절의 엔터티 생성기가 이것을 Plugin 엔터티에 복사합니다.

4. 다시 빌드하고 규칙의 응답 읽기

Terminal window
./build.sh
Wrote <guest>/dist/governance-adapter-skeleton-go.wasm

같은 파일로 네 내보내기를 다시 호출합니다.

Terminal window
aggrega plugin run-local --plugin dist/governance-adapter-skeleton-go.wasm \
--type governance --export transform_annotations --with @annotation-payload.json
aggrega plugin run-local --plugin dist/governance-adapter-skeleton-go.wasm \
--type governance --export mutate --with @label-payload.json
aggrega plugin run-local --plugin dist/governance-adapter-skeleton-go.wasm \
--type governance --export verdict_ir --with @ir-verdict-payload.json
aggrega plugin run-local --plugin dist/governance-adapter-skeleton-go.wasm \
--type governance --export verdict_render --with @render-verdict-payload.json
{
"injections": []
}
{
"patches": []
}
{
"results": []
}
{
"results": []
}

두 판정 역할 모두에서 플레이스홀더 메모가 사라졌고, 어느 쪽도 판정을 반환하지 않습니다. 함께 제공된 페이로드의 settings는 어떤 카테고리도 금지하지 않으므로 규칙이 허용합니다. 빈 results 목록은 판정 역할이 빌드를 진행해도 된다고 말하는 방식입니다.

규칙이 작동하는 것을 보려면 페이로드에 있는 것을 금지하는 설정을 주십시오. ir-verdict-payload.json을 my-payload.json으로 복사하고 그 settings를 다음으로 바꿉니다.

"settings": {
"forbidden_categories": [
"compute"
]
}
Terminal window
aggrega plugin run-local --plugin dist/governance-adapter-skeleton-go.wasm \
--type governance --export verdict_ir --with @my-payload.json
{
"results": [
{
"severity": "halt",
"message": "component \"api\" is a compute component, and this workspace ships none"
}
]
}

deny 결정은 규칙 자체의 메시지를 담은 halt 판정으로 도착합니다. 빌드에서 halt는 그 메시지를 이유로 빌드를 중단시킵니다.

5. 페이로드가 맞지 않을 때

명령은 페이로드에 있는 각 필드를 그 형태가 선언하는 타입으로 변환하며, 변환할 수 없는 필드는 게스트가 실행되기 전에 거부합니다. wrong-payload.json이라는 복사본에서 노드의 labels를 객체가 아닌 목록으로 써 봅니다.

"labels": [
"server",
"compute"
]
Terminal window
aggrega plugin run-local --plugin dist/governance-adapter-skeleton-go.wasm \
--type governance --export verdict_ir --with @wrong-payload.json
under key "api": expected JSON object, found [

명령은 0이 아닌 코드로 종료되며, 게스트는 호출되지 않습니다.

변환은 페이로드에 있는 모든 필드의 타입을 확인하지만, 형태가 요구하는 모든 필드를 페이로드가 갖고 있는지는 확인하지 않습니다. 필드가 빠진 페이로드도 그대로 변환되어 게스트에 전달되며, 그 필드를 읽는 규칙을 가진 게스트는 거기서 아무것도 찾지 못합니다. 따라서 직접 작성한 페이로드는 스키마 참조 페이지와 대조하여 확인하십시오. 명령이 아무 말도 하지 않는다고 해서 페이로드가 완전하다는 뜻은 아닙니다.

6. 작업 공간 카탈로그에 Plugin 엔터티로 선언하기

엔터티의 계약 필드는 직접 작성하지 않고 게스트에서 읽어 오므로, 엔터티가 바이너리에 없는 내보내기를 주장할 수 없습니다. 식별 정보는 작은 오버레이 overlay.yaml에 제공합니다.

apiVersion: aggrega.ai/v1beta1
kind: Plugin
metadata:
name: category-guard
Terminal window
aggrega plugin gen-catalog --plugin dist/governance-adapter-skeleton-go.wasm \
--overlay overlay.yaml --output-dir ../shop/catalog/plugin
generated ../shop/catalog/plugin/governance/category-guard/0.1.0/plugin.yaml

생성된 엔터티:

# Generated from the plugin by `aggrega plugin gen-catalog`. You may narrow its capability lists; edit nothing else here.
apiVersion: aggrega.ai/v1beta1
kind: Plugin
metadata:
name: category-guard
version: 0.1.0
pluginType: governance
description: Refuse a build that carries a component of a category the attachment forbids.
spec:
abiVersion: v1beta1
exports:
- name: transform_annotations
- name: mutate
- name: verdict_ir
- name: verdict_render

version은 스켈레톤의 build.sh가 게스트에 기록하는 버전으로, AGGREGA_PLUGIN_VERSION이 다른 버전을 지정하지 않는 한 0.1.0입니다. pluginType과 네 내보내기는 describe()가 보고하는 내용입니다. 거버넌스 플러그인은 기능을 선언하지 않습니다. 무엇을 반환할 수 있는지는 엔터티가 아니라 연결된 역할에 따라 정해집니다.

플러그인을 개발하는 동안에는 가져올 게시물이 없으므로, 빌드는 카탈로그 디렉터리에서 플러그인을 읽으며 .wasm은 엔터티 옆에 둡니다. 엔터티 옆의 파일은 엔터티 문서가 있는 디렉터리 안에서 엔터티의 플러그인 타입과 이름으로 이름이 정해집니다. governance/category-guard의 경우 governance--category-guard.wasm입니다.

Terminal window
cp dist/governance-adapter-skeleton-go.wasm \
../shop/catalog/plugin/governance/category-guard/0.1.0/governance--category-guard.wasm

파일은 링크하지 말고 복사하십시오. 그 위치의 링크는 작업 공간 안의 어딘가로만(작업 공간 밖에 나열된 카탈로그 디렉터리라면 그 디렉터리 안의 어딘가로만) 따라갑니다. 그보다 바깥으로 이어지는 링크는 작업 공간 경계에서 설명하듯 링크를 지목하며 빌드와 pull을 중단시킵니다. 그 이름으로 .wasm을 찾지 못한 pull은 A plugin’s .wasm is not on this machine (플러그인의 파일이 이 머신에 없음)에서 설명하듯 기대한 파일을 지목하며 중단됩니다.

7. 플러그인이 지키는 작업 공간

작업 공간은 작은 상점입니다. API 하나와 그것을 Docker Compose로 빌드하는 문서들로 이루어집니다. 카탈로그에는 규칙이 거부할 관리 콘솔, 즉 카테고리가 devtool인 Component도 들어 있습니다.

catalog/component/example/compute/api/1.0.0/component.yaml:

apiVersion: aggrega.ai/v1beta1
kind: Component
metadata:
name: example/compute/api
version: 1.0.0
description: The shop's HTTP API.
labels:
component.aggrega.ai/type: server
component.aggrega.ai/category: compute
spec:
schema:
infra:
port:
type: integer
default: 8080
description: The port the API listens on.

catalog/component/example/devtool/db-console/1.0.0/component.yaml:

apiVersion: aggrega.ai/v1beta1
kind: Component
metadata:
name: example/devtool/db-console
version: 1.0.0
description: A database administration console in the browser.
labels:
component.aggrega.ai/type: server
component.aggrega.ai/category: devtool
spec:
schema:
infra:
port:
type: integer
default: 8081
description: The port the console listens on.

catalog/recipe/compose/api/1.0.0/recipe.yaml:

apiVersion: aggrega.ai/v1beta1
kind: Recipe
metadata:
name: api
version: 1.0.0
description: Runs the API as a Docker Compose service.
spec:
capability: compose
implements: example/compute/api:1.0.0
workload: |
apiVersion: aggrega.ai/v1beta1
kind: Workload
containers:
main:
image: "registry.example.com/shop/api:1.0.0"
ports:
http: {{ .infra.port }}

catalog/recipe/compose/db-console/1.0.0/recipe.yaml:

apiVersion: aggrega.ai/v1beta1
kind: Recipe
metadata:
name: db-console
version: 1.0.0
description: Runs the database console as a Docker Compose service.
spec:
capability: compose
implements: example/devtool/db-console:1.0.0
workload: |
apiVersion: aggrega.ai/v1beta1
kind: Workload
containers:
main:
image: "adminer:4"
ports:
http: {{ .infra.port }}

aggregate.yaml:

apiVersion: aggrega.ai/v1beta1
kind: Aggregate
metadata:
name: shop
version: "1.0.0"
description: The shop's API.
spec:
components:
api:
type: example/compute/api

manifest.yaml:

apiVersion: aggrega.ai/v1beta1
kind: Manifest
metadata:
name: shop-manifest
version: "1.0.0"
description: Binds each component type to its Docker Compose recipe.
spec:
mappings:
components:
type:
example/compute/api:1.0.0: api:1.0.0
example/devtool/db-console:1.0.0: db-console:1.0.0

release.yaml:

apiVersion: aggrega.ai/v1beta1
kind: Release
metadata:
name: shop-staging
environment: staging
version: "1.0.0"
spec:
aggregate: shop
manifest: shop-manifest
components:
api: {}

8. 연결하고 빌드하기

운영자는 작업 공간 구성에서 역할과 연결의 설정을 지정하여 거버넌스 플러그인을 연결합니다. .aggrega-config.yaml:

workspace:
catalog_dirs:
- catalog
auto_pull: true
plugins:
governance:
- uri: governance/category-guard:0.1.0
role: ir-verdict
with:
settings:
forbidden_categories:
- devtool

uri는 플러그인 타입, 이름, 버전으로 엔터티를 지정합니다. 역할이 ir-verdict이므로 호스트는 그래프가 구축된 후, 아무것도 렌더링되기 전에 빌드 그래프로 verdict_ir를 호출합니다. auto_pull은 빌드가 Release를 직접 확정하게 하므로 첫 빌드에 별도의 단계가 필요하지 않습니다.

Terminal window
cd ../shop
aggrega build --release release.yaml
warning: plugin "governance/category-guard" resolved from local with no recorded digest to check it against, so it runs unverified; it is read from beside its Plugin entity in a catalog directory on every build, and a pull records its digest only for a plugin attached at a transform role; otherwise publish the plugin and reference the published entity to have its digest recorded
Pull complete: release.lock (entities=7, source_artifacts=0, external_inputs=0)
[… omitted: a line reporting total build time, which differs on every run]
Build completed: 1 file written to <workspace>/dist

상점에는 devtool 컴포넌트가 없으므로 규칙은 빌드를 허용하고, Compose 출력은 dist/compose/docker-compose.yaml에 생성됩니다.

이 경고는 예상된 것이며, 플러그인이 로컬에 있는 동안 계속 나타납니다. 이는 대조할 기록된 콘텐츠 다이제스트 없이 게스트가 실행되었다는 뜻으로, 1분 전에 빌드되어 빌드할 때마다 엔터티 옆에서 읽히는 게스트에게는 사실 그대로입니다. 판정 역할에 연결된 플러그인은 출력을 형성하지 않으므로, pull은 카탈로그 디렉터리에서 그 다이제스트를 기록하지 않습니다. 다이제스트를 기록하려면 플러그인을 게시하고 게시된 엔터티를 참조해야 합니다.

9. 위반 심기

관리 콘솔을 Aggregate에 추가하고 Release에 배치합니다.

spec:
components:
api:
type: example/compute/api
console:
type: example/devtool/db-console
components:
api: {}
console: {}
Terminal window
aggrega build --release release.yaml
[… omitted: the unverified-plugin warning, and the pull's lines saying the Release could not be rendered to discover its external inputs, which carry the refusal below]
[POLICY_ERROR E0005]
policy plugin "category-guard" rejected the build: component "console" is a devtool component, and this workspace ships none
caused by: policy violation

빌드는 아무것도 렌더링하기 전에 중단되며 dist/를 쓰지 않습니다. 메시지는 규칙 자체의 문장이고 앞에 플러그인 이름이 붙으므로, 이를 읽는 작성자는 어떤 컴포넌트를 제거해야 하고 어떤 정책이 그것을 요구했는지 압니다. 플러그인은 콘솔을 제거하거나 이름을 바꾸거나 콘솔 없이 빌드를 렌더링하지 않았습니다. 판정 역할은 수락하거나 거부할 뿐이며, 호스트는 그 응답을 변경으로 적용하지 않습니다.

다음에 바꿀 것

  • 더 많은 규칙 또는 정책 언어. Go로 작성한 규칙은 게스트에 컴파일됩니다. 대신 파일에서 규칙을 로드하려면 Evaluate에서 programs(연결의 sources로, 각각 기본 이름과 텍스트를 가짐)를 읽어 엔진에 넘기십시오. ABI는 Aggrega 고유의 것입니다에서 외부 정책 엔진을 감싸는 게스트를 설명합니다.
  • 다른 역할. 같은 Evaluate가 모든 역할을 처리합니다. annotations 또는 labels에 응답하면 플러그인이 변환 역할에서 빌드를 형성합니다. 결정의 형태는 스켈레톤의 README에, 각 역할이 무엇을 바꿀 수 있는지는 네 가지 역할에 있습니다.
  • 더 적은 내보내기. ir-verdict만 처리하는 플러그인은 다른 역할 파일과 descriptor()의 해당 항목을 삭제합니다. 그러면 게스트가 선언하지 않은 내보내기로 역할을 지정하는 연결은 게스트가 실행되기 전에 이름으로 거부됩니다.
  • 타입이 지정된 설정. 게스트는 describe()에서 설정에 대한 JSON Schema를 선언할 수 있으며, 그러면 호스트는 게스트가 실행되기 전에 연결의 설정을 그에 대해 검증합니다. 타입이 지정된 설정을 참조하십시오.
  • 게시는 카탈로그 디렉터리 구성을 Release가 확정하고 검증하는 다이제스트 고정 아티팩트로 바꿉니다. 그 수명 주기는 플러그인 개발자 가이드에서 다룹니다.