Skip to content

Commit 4e99073

Browse files
committed
feat: add nri-docker and right format to testing infra-agent oci repo
1 parent 6a3ca5e commit 4e99073

File tree

1 file changed

+13
-76
lines changed

1 file changed

+13
-76
lines changed

.github/workflows/push_oci_artifact.yml

Lines changed: 13 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,9 @@
1-
# This action creates a new Testing Infra-agent OCI package version in the agent-control package registry
1+
# This action creates a new Testing Infra-agent OCI package version in the agent-control GitHub's package registry.
22
#
33
# The blob is a zip or tar containing:
44
# - newrelic-infra (.exe)
55
# - integrations/nri-docker (.exe)
66
#
7-
# The format for this package is a multiplatform index and one manifest with the artifact blob for each architecture.
8-
# The created index will be as the following:
9-
#
10-
# {
11-
# "schemaVersion": 2,
12-
# "mediaType": "application/vnd.oci.image.index.v1+json",
13-
# "manifests": [
14-
# {
15-
# "mediaType": "application/vnd.oci.image.manifest.v1+json",
16-
# "digest": "sha256:9b34549b8f5002df0518b002c8ba0ddcb2e004dee988620642fe71ac8d05c780",
17-
# "size": 696,
18-
# "platform": {
19-
# "architecture": "amd64",
20-
# "os": "darwin"
21-
# },
22-
# "artifactType": "application/vnd.newrelic.agent.v1+tar"
23-
# }
24-
# [...]
25-
# }
26-
#
27-
# Then each of the different manifests for each artifact
28-
#
29-
# {
30-
# "schemaVersion": 2,
31-
# "mediaType": "application/vnd.oci.image.manifest.v1+json",
32-
# "artifactType": "application/vnd.newrelic.agent.v1+zip",
33-
# "config": {
34-
# "mediaType": "application/vnd.oci.image.config.v1+json",
35-
# "digest": "sha256:7758599fc4d06bd93a65bf28bc98fbff6c559a9a56be1ec3d75ff6aa8a8cfe6e",
36-
# "size": 39
37-
# },
38-
# "layers": [
39-
# {
40-
# "mediaType": "application/vnd.newrelic.agent.v1+zip",
41-
# "digest": "sha256:a66a406acbaf188f0f9a2b34464fc18c66bb45742894f23ca5f9ed65e6c5ad8c",
42-
# "size": 21676600,
43-
# "annotations": {
44-
# "com.newrelic.artifact.type": "binary",
45-
# "org.opencontainers.image.title": "newrelic-infra-amd64.zip",
46-
# "org.opencontainers.image.version": "1.71.3"
47-
# }
48-
# }
49-
# ],
50-
# "annotations": {
51-
# "org.opencontainers.image.created": "2026-01-12T14:33:18Z"
52-
# }
53-
# }
54-
#
55-
# We require the artifactType to know the type of the artifact (it's also present as mediaType in the layer but it's more
56-
# correct to also place it as artifactType )
57-
#
58-
# The required annotations are:
59-
# - image.title
60-
# - com.newrelic.artifact.type
61-
#
62-
# The other 2 annotations, org.opencontainers.image.version and org.opencontainers.image.created are for info purposes.
63-
#
64-
# When pushing the artifact with oras with --artifact-platform, the config will be populated with platform.ach and platform.os
65-
# that are needed when creating the oras index to have a multiarch registry.
66-
#
67-
# At the end the resulting registry will be:
68-
# TAG (ex v1.7.7) --> Index (Pointing to different manifest digests per os/arch) --> manifest (identified by digest) -> Blob
697

708
name: OCI test repo - compile & push multi-platform testing-infra-agent
719
on:
@@ -93,6 +31,7 @@ jobs:
9331
- { os: linux, arch: amd64, binary: newrelic-infra, format: tar }
9432
- { os: linux, arch: arm64, binary: newrelic-infra, format: tar }
9533
- { os: windows, arch: amd64, binary: newrelic-infra.exe, format: zip }
34+
- { os: windows, arch: arm64, binary: newrelic-infra.exe, format: zip }
9635
- { os: darwin, arch: arm64, binary: newrelic-infra, format: tar }
9736
- { os: darwin, arch: amd64, binary: newrelic-infra, format: tar }
9837

@@ -118,29 +57,27 @@ jobs:
11857
mkdir -p integrations
11958
12059
if [ "${{ matrix.os }}" = "windows" ]; then
121-
URL="https://download.newrelic.com/infrastructure_agent/binaries/windows/${{ matrix.arch }}/nri-docker-${{ matrix.arch }}.${{ env.NRI_DOCKER_VERSION }}.zip"
60+
# we always package amd64 docker because arm64 doesn't exist.
61+
URL="https://download.newrelic.com/infrastructure_agent/binaries/windows/amd64/nri-docker-amd64.${{ env.NRI_DOCKER_VERSION }}.zip"
12262
curl -L -o nri-docker.zip "$URL"
123-
mkdir -p integrations-tmp
124-
unzip -j nri-docker.zip -d integrations-tmp/
125-
mv integrations-tmp/nri-docker.exe integrations/nri-docker.exe
126-
rm -rf integrations-tmp
63+
unzip -j nri-docker.zip '*/nri-docker.exe' -d integrations
12764
rm nri-docker.zip
12865
elif [ "${{ matrix.os }}" = "linux" ]; then
12966
URL="https://download.newrelic.com/infrastructure_agent/binaries/linux/${{ matrix.arch }}/nri-docker_linux_${{ env.NRI_DOCKER_VERSION }}_${{ matrix.arch }}.tar.gz"
13067
echo $URL
13168
curl -L -o nri-docker.tar.gz "$URL"
132-
mkdir -p integrations-tmp
133-
tar -xzf nri-docker.tar.gz -C integrations-tmp/ --strip-components=1
134-
mv integrations-tmp/var/db/newrelic-infra/newrelic-integrations/bin/nri-docker integrations/nri-docker
135-
rm -rf integrations-tmp
69+
tar -xzf nri-docker.tar.gz --strip-components=6 -C integrations
13670
rm nri-docker.tar.gz
13771
fi
13872
13973
- name: Compile Binary
14074
run: |
141-
GOOS=${{ matrix.os }} GOARCH=${{ matrix.arch }} go build \
142-
-o ${{ matrix.binary }} \
143-
./cmd/newrelic-infra
75+
# force amd64 if OS is windows because compiling infra arm64 is unsupported
76+
GOARCH_VALUE=${{ matrix.os == 'windows' && 'amd64' || matrix.arch }}
77+
78+
GOOS=${{ matrix.os }} GOARCH=$GOARCH_VALUE go build \
79+
-o ${{ matrix.binary }} \
80+
./cmd/newrelic-infra
14481
14582
- name: Package Artifact
14683
id: package
@@ -168,7 +105,7 @@ jobs:
168105
"${{ steps.package.outputs.filename }}": {
169106
"org.opencontainers.image.title": "${{ steps.package.outputs.filename }}",
170107
"org.opencontainers.image.version": "${{ env.AGENT_VERSION }}",
171-
"com.newrelic.artifact.type": "binary"
108+
"com.newrelic.artifact.type": "package"
172109
}
173110
}
174111
EOF

0 commit comments

Comments
 (0)