跳到內容
AggregaAggregaAggregaAggrega
選擇語言: 繁體中文
本頁為機器翻譯。閱讀英文原文。

aggrega registry

管理登錄庫及其簽章信任原則

概要

aggrega registry

說明

Manage the OCI registries Aggrega publishes to and resolves from, together with
the signature trust policy for each.
A registry entry records where to reach the registry and what to require of the
signatures on artifacts it serves — which identities are trusted, and whether a
signature is required at all. That policy is what "aggrega pull" enforces when
it verifies an artifact and what "aggrega push" honours when it decides whether
to sign.
"aggrega registry add" can fetch a registry's own advertised trust policy rather
than having you write it out. "aggrega registry update" builds the local
searchable index that "aggrega search" and "aggrega plugin add" read.
A registry entry is written to the global config shared across every workspace
on this machine, because a registry and the identities you trust on it are
usually the same wherever you work. That makes adding or removing one a
machine-wide change: every project on this machine resolves through the entry
you just wrote or dropped. Pass --workspace to write it to this project's config
file instead. Building the searchable index is the exception — that lands in
this workspace's own artifact cache and reaches no other project.

子命令

命令說明
aggrega registry add註冊登錄庫及其簽章信任原則
aggrega registry list列出已設定的登錄庫及其信任態勢
aggrega registry remove從設定檔中移除登錄庫及其信任原則
aggrega registry update建立已設定登錄庫的本機可搜尋索引

aggrega registry add 說明

Register a registry host and its signature trust policy.
The entry is keyed under the host exactly as written, and every lookup of it is
made in one spelling: a lowercase host name containing a dot, localhost, a single
name followed by a port (registry:5000), an IPv4 address, or an IPv6 address in
brackets, each with an optional :port. A reference may be given instead — its
scheme, path and credentials are dropped and the entry is keyed under the host it
names — but a host written in capitals, with the default HTTPS port, or as a
single name with no port is refused, naming the spelling to write where there is
one.
The entry is written to the global config shared across every workspace, since a
registry and the identities you trust on it are usually the same wherever you
work. Pass --workspace to write it to this project's config file instead; the two
flags are mutually exclusive.
By default the registry's advertised trust policy is fetched once from the
registry's own origin (https://<host>/.well-known/aggrega-trust) and pinned
locally — trust-on-first-use. Verification at pull time always runs against the
pinned local policy, never a live re-fetch. Pass --fetch-trust=false to skip the
fetch and pin only what the flags supply.
A trust policy can also be set by hand: keyless (one or more --identity entries,
each an "identity=issuer" pair) or keyed (--key pointing at a pinned public-key
PEM). Manual --identity / --key flags OVERRIDE the fetched set — when either is
supplied, the fetch is skipped and the policy is built from the flags alone.
Pass --trusted-root to pin a Sigstore trust-root bundle for air-gapped keyless
verification. Adding the official hub host with no policy flags pins the built-in
official baseline.
When the registry advertises no trust policy (a 404 or an unreachable endpoint),
the add does not fail: it writes the policy from the flags (or an empty policy)
and prints a notice suggesting manual --identity / --key pinning. The official
hub writes its built-in baseline instead, and the notice says the baseline was
pinned.
When the workspace is offline the advertised policy cannot be fetched, so the
registry is never asked. Adding a registry other than the official hub is then
refused unless --identity or --key supplies the policy, rather than writing an
entry that trusts nothing: register it once while online, or pin it by hand.
Adding the official hub offline pins its built-in baseline, with a notice saying
so, and a manual policy registers offline exactly as it does online.
Existing settings in the target config file are preserved.

aggrega registry add 旗標

旗標預設說明
--advisoryfalse將此登錄庫的驗證失敗降級為警告,而不是中止
--fetch-trusttrue首次使用時取得並固定登錄庫所公告的信任原則。使用 —fetch-trust=false 可略過;手動指定 —identity/—key 也會略過取得。
--globalfalse將項目寫入所有工作區共用的全域設定。登錄庫預設在此。
--identity[]受信任的無金鑰身分,格式為 identity=issuer,例如 dev@example.com=https://accounts.google.com (可重複;OR 集合)。會覆寫所擷取的信任原則。
--key—用於有金鑰驗證、已固定且與 cosign 相容的公開金鑰 PEM 路徑。會覆寫所取得的信任原則。
--name—此登錄庫的選用易記別名。主機仍是身分;在任何指名登錄庫之處(例如 —registry),別名都會解析為它。在各登錄庫之間必須是唯一的。
--require-signaturesfalse要求從此登錄庫 pull(以及 push 到此登錄庫)的每個成品都帶有簽章
--trusted-root—用於氣隙隔離無金鑰驗證、已固定的 Sigstore 信任根組合包路徑
--workspacefalse改為將該項目寫入這個專案的工作區設定,而不是全域設定。

aggrega registry list 說明

List every registry configured in the effective merged config, one per line,
with its friendly alias (if any), a short trust-posture summary, and a marker on
the default registry.
This reads the resolved configuration and never contacts a registry. Registries
are listed in ascending host order.
With -o json the same set is emitted as one structured document per registry:
its host, its alias, whether it is the default, its trust posture as discrete
fields rather than the table's rendered sentence, and whether a credential for
that host is present in the shared credential store. The credential state reports
presence only — a credential is never read out, measured, or shown in any form,
and whether the registry would accept it is not asked, since that would take a
network round trip. Reading it consults the local credential store, which honors
a configured credential helper. The order is the same ascending host order the
table uses.

aggrega registry list 旗標

旗標預設說明
--output, -otable輸出格式:table|json。

aggrega registry remove 說明

Remove a registry's trust-policy entry from a config file, addressed by its host
or its friendly alias.
By default the entry is removed from the global config shared across every
workspace; pass --workspace to remove it from this project's workspace config
instead. Setting both --global and --workspace is a usage error.
The default_registry pointer is left untouched — removing a registry's trust
policy reverts that host to default trust; it does not change which registry is
the default. Where default_registry names the removed entry by its alias, that
alias names nothing afterwards, and the configuration is refused until
default_registry is written as a host or as another entry's name.

aggrega registry remove 旗標

旗標預設說明
--globalfalse從所有工作區共用的全域設定中移除項目。
--workspacefalse改為從此專案的工作區設定而非全域設定中移除項目。

aggrega registry update 說明

Walk each configured registry's repositories, read the latest published version
of each, and write a deterministic local searchable index to the artifact cache.
With no argument, every configured registry is indexed. With a single registry
argument (a host or a friendly alias), only that registry is indexed.
This is the one registry command that reaches the network. The index it writes
lands in this workspace's own artifact cache, so refreshing it changes nothing
another project on this machine resolves through. Credentials are read from a
supplied or ambient source and never asked for: a registry that needs one you do
not have fails with a message naming what it wanted.
For each repository the highest strict-SemVer version is selected (pre-release
versions are skipped) and its catalog facets — kind, description, category,
labels, and, for plugins, socket type and capabilities — are recorded from the
published manifest. A repository with no conforming version is skipped; a
repository that cannot be read is skipped with a note, so one unreadable
repository does not abandon the whole index.
A registry that asks the walk to slow down — a 429 answer, or a 503 that says
how long to wait (Retry-After) — is left alone for as long as it asks, or ten
seconds where it does not say, and the walk reads fewer of its repositories at
once until it answers again, then returns to its usual pace; on a terminal the
wait is shown beside that registry's row. A registry that answers nothing but
"slow down" for five minutes is not indexed: it keeps the index it had before
the run, and the command names it, its last answer and how long it waited.
A read the registry fails or drops in passing — a 5xx answer, a connection
reset or timed out, an answer cut short — is asked again a few times, with a
growing wait between attempts. A repository with a read still
failing after that is not recorded from this run: it keeps the record the index
already holds for it, where that record was judged under the trust policy now in
force, and is otherwise left out of the index; either way it is named as a
repository that could not be read, as the walk goes and again in the closing
summary under its registry's row, with the kind of the read's last failure — the
status the registry answered, a timeout, a reset, an answer cut short — and the
read that failed. So a version is never recorded unsigned,
undated or without its deprecation marker because a read failed, with or without
--upgrade. Each registry's row in the closing summary also says how many reads
were asked again, whether or not they then succeeded — a read sent again after
the registry asked the walk to slow down among them — and says zero when none
was.
Every signature a registry's walk verifies against the public Sigstore trust root
is verified against the same copy of that root, fetched once for the walk rather
than once per signature; a registry whose trust policy pins a trust root of its
own is verified against that file.
A registry whose repository listing repeats itself — naming a repository it has
already named, or answering two pages in a row with no repository while still
pointing to a next page — is not followed round again. That registry is reported
as not indexed, with a message naming it and saying its repository listing
repeated itself; the other registries are still indexed, and the command exits
non-zero.
A registry that is not indexed keeps the index it had before the run, unchanged:
nothing is written for a registry whose walk failed, whose listing repeated
itself, or that was being walked when the command was interrupted. Registries
indexed earlier in the same run keep what this run wrote for them. A registry's
new index is written aside and put in place whole, so a command stopped while
writing one leaves that registry with a complete index — the one it had before
the run, or the new one — or with none, never with a partial one.
Every strict-SemVer version a recorded repository publishes is listed too, each
with the manifest digest its tag resolves to — the address of the exact bytes
published under that version. Where the registry's trust policy pins a public key
or trusted identities, and verification is not switched off, each version's own
signatures are verified against that policy and the signer is recorded when one
verifies; a version with no signature, or none that verifies, is recorded with no
signer. Where several verify, the signer recorded is the one the transparency log
recorded earliest, whatever order the registry lists them in, so signing a version
again never changes its recorded signer.
Each version's publication date is recorded too, with its source. Where one of the
version's keyless signatures verified, the date is the time the transparency log
recorded that earliest signature, as the verified log entry attests it (source
'transparency-log') — so signing a version again never moves its date. Otherwise
it is the date the publication itself stated beside what it published (source
'publisher'), the earliest where several are stated: the publishing machine's own
clock, which nothing attests, read from any registry whatever its trust policy.
A version with neither — published without stating a date, and not signed
keyless in a way this policy verifies — is recorded with no date.
Only manifests, signature attachments and publication-date attachments are read:
no entity's content is fetched. 'aggrega search -o json' reports these under each
record's 'published' field.
The per-repository records are byte-identical across two runs against the same
registry state; the freshness timestamp is written to a sibling file so it never
disturbs the records.
A refresh reads again only what changed, and finds every change a full re-read
would. For each repository it revalidates the tag listing with a conditional
request, resolves every version's tag to its manifest digest, and revalidates every
version's attachments — its signatures, publication-date statements and deprecation
markers — with one conditional request, plus one for the signatures of a
deprecation marker it judged before. A version whose digest or attachments changed
is read again in full, and its signatures and markers are verified again exactly as
a full re-read verifies them; everything else is kept as recorded. A change to this
registry's trust policy reads every version again under the policy now in force, and
so does a repository whose entry in the index records none of these checks. An
unchanged registry therefore costs one conditional request per repository and two
small requests per version (three where a deprecation marker was judged), with
nothing downloaded. A version is read again on the next refresh where it carries a
deprecation marker that was not honored, or where this run got no way to
revalidate its attachments — which, on a registry that offers none, is every
version.
Several repositories are read at a time. Everything the command records and prints
comes out in repository order, so the index and the output are the same as reading
one repository at a time would produce.
While it walks, a terminal shows the walk's progress on standard error, the way
build and pull show theirs: a row naming each registry, a spinner while that
registry's repository listing is read, then how many of its repositories the walk
has finished out of how many it lists, counted in repository order, and a bar for
the whole walk below the rows. On a terminal that cannot redraw in place, or with
--plain, each registry gets one plain line instead, written when its walk ends,
with the count it ended on and the time it took. When standard error is not a
terminal, no progress is shown. The progress changes nothing the command prints on
standard output.
Use --upgrade to read every repository in full, comparing nothing with the index
already written — to rebuild an index from the registry alone. It finds no change a
refresh without it would miss.
Each published version's deprecation markers are read as the walk goes, and the ones
whose own signature verifies are recorded into the index. Every marker read is
reported, whether or not it was recorded — a version kept as recorded is not read, so
its marker is not reported again — and each registry reports how many markers its
index now records, including when that number is zero. Where signature
verification is disabled for a registry, the walk reports that its markers were not
examined rather than a count, so a registry that published nothing is never confused
with one this run had no basis to judge.

aggrega registry update 旗標

旗標預設說明
--upgradefalse完整讀取每個存放庫,不與已寫入的索引比較任何東西(不帶它的重新整理本來就會重新讀取有變更的內容)

registry update 對棄用標記的回報內容

aggrega registry update 在走訪登錄庫時,會讀取每個已發布版本的棄用標記,並將它能驗證的標記記錄到本機索引中。它會在每條路徑上回報該次掃描的結果,因此沒有發布任何標記的登錄庫,能與沒有尋找標記的執行區分開來。

走訪所讀取的每個標記會產生一行,指名存放庫、版本,以及發布者記錄的嚴重程度——warning、error 或 retracted——並說明該標記是否已被記錄。自上次重新整理以來附加項目未變的版本,會維持原樣記錄而不再讀取,因此它的標記不會再次被回報;下方的計數仍包含它。只有在標記本身的簽章,能對照登錄庫的信任原則所承認的簽署者驗證成功時,標記才會被記錄。存在但無法解碼,或存在但未被承認的標記,會如此回報並被排除在索引之外,而不是依無法驗證的證據被記錄——登錄庫回答它不持有的標記也一樣。讀取失敗的標記是不同的情況:請見 失敗的讀取。

每個登錄庫接著會回報其索引現在記錄了多少標記,即使該數字為零也一樣。在簽章驗證被關閉之處——全域或針對該單一登錄庫——走訪則改為回報並未檢查該登錄庫的標記。這兩者是不同的事實:前者表示登錄庫沒有發布此工作區能據以行動的東西,後者表示這次執行完全沒有可據以判斷標記的信任基礎。標記未被檢查的登錄庫,不會對版本選取貢獻任何撤回,因此附加了標記卻看到那一行的作者,就知道為什麼它沒有效果。

每個版本記錄的發布日期

已發布資訊清單的建立時間是固定的,因此它的摘要只取決於所發布的內容,絕不取決於何時。因此版本的發布日期是從資訊清單旁邊讀取的,而 aggrega registry update 會為每個版本記錄它,連同它來自的來源:

  • transparency-log——當版本的簽章是無金鑰的、且能對照登錄庫的信任原則驗證時,是透明度記錄記錄該簽章的時間,而記錄的簽署承諾證明了這一點。當版本的多個簽章都驗證成功時,取其中最早的時間,而為該版本記錄的簽署者是同一個簽章的——無論登錄庫以什麼順序列出簽章——因此再次簽署的版本會保有它的日期與簽署者。對於發布時就簽署的版本,那就是它的發布;對於之後才以 aggrega sign 首次簽署的版本,則是它被簽署的時間。只要這個來源存在,它就勝出。
  • publisher——否則,是發布在其所發布內容旁邊所載明的時間:由 aggrega push 與 aggrega push-artifact 寫入的小型 published-at 附件,帶有發布機器自己的時鐘,沒有任何東西證明它。無論信任原則為何,它都會從任何登錄庫讀取,因為它是發布者的陳述,而不是信任決定。當附加了多個時,取最早的。

兩者皆無的版本不記錄日期。那是未載明日期的發布,其簽章不是此原則所驗證的無金鑰簽章——例如在不信任任何無金鑰身分的原則下讀取的無金鑰發布,因為無金鑰發布本身不載明日期。aggrega search -o json 會在 published 中的每個版本下回報日期。

重新整理會再次讀取的內容

重新整理會將登錄庫現在所提供的內容與索引所記錄的比較,並再次讀取所有已變更的內容——與完整重新讀取給出的答案相同。對於每個存放庫,它會:

  • 重新驗證標籤列表,因此之後發布或刪除的版本會被納入;
  • 將每個版本的標籤解析為它所指名的資訊清單,因此以既有標籤再次發布的較舊版本會被再次讀取;
  • 重新驗證每個版本的附加項目——其簽章、其發布日期陳述與其棄用標記——因此之後附加到版本的簽章、日期或標記會被讀取並驗證,並對先前判斷過的棄用標記之簽章也這麼做;
  • 將登錄庫的信任原則與索引建立時所依據的原則比較,因此原則的變更會讓每個版本在新原則下被再次讀取。

棄用標記、簽章與發布日期,各自都是以指回已發布版本的獨立物件附加到該版本——這讓發布者能棄用或簽署版本而不必再次發布——因此它們都不會新增標籤或改變版本自己的資訊清單。它們改變的是版本的附加項目,而那正是第三項檢查所重新驗證的。版本排除與 aggrega inspect 都讀取這個索引,因此自上次重新整理以來被撤回的版本,在下次重新整理執行之後,會被排除在選取之外並被顯示出來。

每項檢查都是小請求——資訊清單摘要解析,或登錄庫不傳送任何東西就回答為未變更的條件式請求——因此對未變更登錄庫的重新整理不會下載任何東西。帶有未被承認之棄用標記的版本,或這次執行沒有辦法重新驗證其附加項目的版本,會在下次重新整理時再次讀取。無法說明某版本附加項目是否有變更的登錄庫,每次重新整理時每個版本都會再次讀取:答案相同,完整重新讀取的成本也相同。

--upgrade 會完整讀取每個存放庫,不與已寫入的索引比較任何東西。用它來單從登錄庫重建索引;它不會取得重新整理所遺漏的任何東西。

會要求放慢速度的登錄庫

官方 hub hub.aggrega.ai 會限制單一位址在短時間內可以送出多少請求,因此共用位址的機器共用該額度,而任何登錄庫都可以用同樣的方式限制其用戶端。超過限制的登錄庫會回應 429 Too Many Requests,或回應 503 Service Unavailable 並帶有 Retry-After 標頭,說明要等多久。命令列對登錄庫發出的每個請求,無論是什麼命令,遇到該回應時都以相同方式處理:它會等待登錄庫所要求的時間,或在回應沒有說明時等待十秒,再加上最多一秒的隨機時間,然後再次詢問,沒有固定的嘗試次數。對該登錄庫的每個請求都會隨之等待,而不只是被拒絕的那一個,且同時送往它的請求更少——每次它要求時減半,最少到一個——並在每一段它不失敗地服務的請求之後增加一個,直到回到命令通常的數量。等待會以與命令其餘進度相同的方式顯示,是像 hub.aggrega.ai asked to slow down; waiting 11 s 這樣的一行:aggrega build、aggrega pull 與 aggrega registry update 會將它顯示在進行中步驟的旁邊,其他會顯示它們在等待什麼的命令,則將它顯示為自己的一個步驟——但同時簽署多個參照的 aggrega sign --jobs 例外,它將這些顯示為一個步驟——而在標準錯誤不是終端機之處,除非命令的 --progress 要求,否則不會顯示任何東西。連續五分鐘只回答「放慢速度」的登錄庫,會在 E0378 之下被拒絕,並點名該登錄庫、它最後的回應,以及它除此之外沒有回答任何東西多久了;這五分鐘是固定的,沒有任何設定能改變它。接著 aggrega registry update 會在其結尾概要中的 Not indexed: 之下點名該登錄庫,而該登錄庫保有它在這次執行之前所擁有的索引。

失敗的讀取

走訪會從登錄庫讀取許多小物件,而有些讀取會在途中失敗:登錄庫回應它失敗或無法使用(5xx 狀態,但說明要等多久的 503 除外)或請求逾時(408),連線被重設或逾時,或回應在完整之前就停止。每個這類讀取都會以逐漸增加的等待時間再嘗試幾次。要求走訪放慢速度的登錄庫並不是讀取失敗:該讀取會等待並再次被詢問,如 會要求放慢速度的登錄庫所述,而持續要求五分鐘的登錄庫會結束該登錄庫的走訪,而不是某一個存放庫的走訪。

仍然失敗的讀取絕不會被當成答案。無法讀取的簽章不等於沒有簽章的版本,而無法讀取的棄用標記也不等於從未被撤回的版本,因此走訪不會從這次執行記錄關於該存放庫的任何東西。存放庫會保有索引已為它持有的記錄,只要該記錄是在登錄庫現行信任原則下判斷的,否則就被排除在索引之外。無論哪種情況,走訪都會在其執行中的評論裡指名該存放庫,說明發生了這兩者中的哪一個以及哪個讀取失敗,並在其結尾概要中再次指名它,在其登錄庫列之下獨立一行,位於無法讀取的存放庫之中:

Indexed 1 registry.
registry.example.com: 41 entities, 1 repository could not be read, 4 reads retried
component/core/web: the registry answered 503 Service Unavailable: …

登錄庫的列也會說明有多少讀取被再次詢問,每個讀取無論嘗試了幾次、之後是否成功都只計一次,而在沒有任何讀取被重試時會顯示 0 reads retried。所有讀取最終都成功的走訪,在其列上不會顯示任何存放庫,因此這個計數說明了它差多少就會漏掉一個。

每一個這樣的行都以該讀取最後一次失敗的種類開頭——登錄庫回應的狀態、逾時的讀取、被重設的連線,或被截斷的回應——後面接著失敗本身,說明那是哪個讀取。不屬於這些種類的失敗,例如無法取得用來驗證簽章的信任根,則只給出失敗本身。aggrega serve 的 aggrega/registryUpdate 方法會在每個主機的 skipped 之下以相同的存放庫回應,每個都帶有相同的 reason,並以 readsRetried 回報再次詢問的讀取數。重新整理與 --upgrade 同樣如此,而下次走訪會從索引屆時所持有的內容開始,與任何存放庫相同。

有金鑰原則所固定的公開金鑰

有金鑰的信任原則會將登錄庫的公開金鑰內嵌固定為項目的 public_key:aggrega registry add --key <file> 會將檔案內容複製到那裡,固定登錄庫所公告、其中帶有金鑰的原則時也一樣。該值是 PEM 公開金鑰區塊——從 -----BEGIN PUBLIC KEY----- 那一行,或 -----BEGIN RSA PUBLIC KEY-----,到其對應的 -----END 那一行的文字——而區塊上方的任何文字都會被忽略。

不帶 -----BEGIN … PUBLIC KEY----- 那一行的值,會在設定檔載入時被拒絕,並點名檔案與項目。registry add 在寫入之前會做相同的檢查,因此持有其他任何東西的 --key 檔案——私密金鑰、憑證,或以另一種編碼表示的金鑰——會被拒絕,而設定檔維持原樣。只檢查那一行:該區塊是否能解碼成可用的金鑰,要在對照它驗證來自登錄庫的簽章時才會發現。

離線

aggrega registry update 是這個群組中,整個工作都是走訪登錄庫的那一個命令,而在離線態勢下——設定檔中最上層的 offline 鍵、AGGREGA_OFFLINE,或 --offline——它會在走訪任何東西之前就拒絕。拒絕訊息會指出這三者中是哪一個設定了該態勢。

沒有可退而求其次的部分形式,因為索引記錄的是每個登錄庫目前所提供的內容,而不詢問它就無從得知。離線工作區可以做的是讀取它已有的索引:aggrega search 與 aggrega inspect 上的棄用通知都讀取本機快照,完全不需要網路,因此重新整理是這個態勢唯一帶走的東西。若要在離線工作區中為單次執行進行重新整理,請傳入 --offline=false。

aggrega registry add 會連到網路一次,以取得登錄庫所公告的信任原則,除非 --fetch-trust=false、--identity 或 --key 指示不要取得。在離線態勢下,該取得會在撥接任何東西之前被拒絕,因此登錄庫從不被詢問。這時,新增官方 hub 以外的登錄庫會被拒絕——新增登錄庫是固定其信任的唯一時刻,而沒有原則就寫入的項目不會信任任何東西,但之後的每次 pull 都會要求登錄庫符合它。拒絕訊息帶有簡短代碼 E0310,並指出兩條出路:在線上時註冊一次(--offline=false 允許單次執行這樣做),或以 --identity 或 --key 手動固定原則,這會註冊你所提供的內容,且完全不進行取得。官方 hub 會以其內建基準新增,並附帶一則通知,說明由於工作區離線,因此未向 hub 詢問其信任原則,改用基準,而 --fetch-trust=false 會依其旗標註冊該項目,與線上時完全相同。透過 aggrega serve 或 aggrega mcp 進行的相同註冊,行為也相同:以相同措辭給出相同的拒絕,其餘則是相同的項目。A registry is added offline with no trust policy to pin(登錄庫在離線時新增而沒有可固定的信任原則)引述了該拒絕訊息。

list 與 remove 會變更或讀取本機設定,不受影響。