Skip to content

Commit 16f1cad

Browse files
docs: multiarch support
1 parent d280d7a commit 16f1cad

File tree

1 file changed

+30
-9
lines changed

1 file changed

+30
-9
lines changed

docs/package_manager.md

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,23 @@ The package manager handles download, signature verification, extraction, instal
66
## Package structure (in the OCI repository)
77

88
The packaged agent must comply with the [OCI image spec](https://github.com/opencontainers/image-spec). The entrypoint can either
9-
be a manifest JSON file or an index JSON file.
9+
be a [manifest](https://github.com/opencontainers/image-spec/blob/main/manifest.md#oci-image-manifest-specification) JSON file or an [index](https://github.com/opencontainers/image-spec/blob/main/image-index.md#oci-image-index-specification) JSON file, but for AC we expect the entrypoint to be an `index`. That's the way OCI supports multi-arch.
1010

11-
The [index](https://github.com/opencontainers/image-spec/blob/main/image-index.md#oci-image-index-specification) file includes a list of manifest files, and it's handy to support multiple environments. Agents that want to integrate with AC should use this approach.
11+
> [!NOTE]
12+
> The OCI spec has some [rough edges, at least around the multi-arch topic](https://github.com/oras-project/oras/issues/1538).
13+
14+
The `index` file includes a list of manifest files. AC expects:
15+
16+
* each manifest entry in the array to have a `platform` section with the `architecture` and `os` fields
17+
18+
Check fields and possible values in the [Image Index Property Descriptions section of the spec](https://github.com/opencontainers/image-spec/blob/main/image-index.md#image-index-property-descriptions). However, to know if AC supports a specific architecture and os, we must look at the [oci_client crate support](https://docs.rs/oci-client/latest/oci_client/manifest/struct.Platform.html) and the [AC compatibility section](https://docs.newrelic.com/docs/new-relic-control/agent-control/overview/#requirements-and-compatibility). If it appears on both, then it's supported.
19+
20+
The section is automatically handled by the [oci_client](https://github.com/oras-project/rust-oci-client/blob/4541487ec759eef2a511e385d95e72e78aa37f69/src/client.rs#L974), which automatically detects the platform and retrieves the correct manifest from the index.
1221

1322
> [!NOTE]
14-
> AC uses an [OCI client that supports every architecture and os in the spec](https://docs.rs/oci-client/latest/oci_client/manifest/struct.Platform.html).
15-
> To make sure the platform is supported by AC and not only the OCI client, check out [AC compatibility section](https://docs.newrelic.com/docs/new-relic-control/agent-control/overview/#requirements-and-compatibility).
23+
> The `artifactType` field in a given manifest entry of the `index` is not verified by AC, nor by the [client](https://docs.rs/oci-client/latest/oci_client/manifest/struct.ImageIndexEntry.html).
24+
25+
Other than that, it must follow the OCI spec.
1626

1727
Example:
1828

@@ -55,21 +65,32 @@ Example:
5565
}
5666
```
5767

58-
Then we have the [manifest](https://github.com/opencontainers/image-spec/blob/main/manifest.md#oci-image-manifest-specification) file, which includes the package data and metadata.
68+
Then we have the `manifest` file, which includes the package data and metadata.
5969

6070
> [!NOTE]
6171
> AC can handle artifacts regardless of the entrypoint (manifest or index).
62-
> However, AC suggests using the index approach. If the author of an agent decides to use a manifest, acknowledge that AC might behave in strange ways.
72+
> However, AC suggests using the index approach. If the author of an agent decides to use a manifest as the entrypoint, they must understand that AC might behave in strange ways.
6373
6474
There, AC expects to find some specific keys and values.
6575

76+
* `config` must exist, have value `application/vnd.oci.image.config.v1+json` and contain the `architecture` and `os` [properties](https://github.com/opencontainers/image-spec/blob/main/config.md#properties)
77+
78+
```json
79+
{
80+
"architecture": "amd64",
81+
"os": "linux"
82+
}
83+
```
84+
85+
This is not required by AC itself. However, it adds support for external tooling. For example, [oras](https://github.com/oras-project/oras).
86+
6687
* `artifactType` must exist and have value `application/vnd.newrelic.agent.v1`
6788

6889
* `layers/mediaType` must take one of the following values:
6990

70-
- `application/vnd.newrelic.agent.content.v1.zip`
71-
- `application/vnd.newrelic.agent.content.v1.tar+gzip`
72-
- `application/vnd.newrelic.agent-type.content.v1.tar+gzip`
91+
- `application/vnd.newrelic.agent.content.v1.zip`
92+
- `application/vnd.newrelic.agent.content.v1.tar+gzip`
93+
- `application/vnd.newrelic.agent-type.content.v1.tar+gzip`
7394

7495
Example:
7596

0 commit comments

Comments
 (0)