Add features by Andrii Pravorskyi - #726
Conversation
| maintainer: Andrii Pravorskyi | ||
| contact: https://gitlab.com/pravorskyi/devcontainer-features/-/issues | ||
| repository: https://gitlab.com/pravorskyi/devcontainer-features | ||
| ociReference: registry.gitlab.com/pravorskyi/devcontainer-features |
There was a problem hiding this comment.
Hi pravorskyi
The ociReference appears to be invalid and returning 404. Would you kindly check.
There was a problem hiding this comment.
Thanks for checking! It seems to me that reference is valid.
The 404 is a GitLab registry strict policy, it returns 404 for manifest requests that don't include the OCI Accept header (ghcr.io tolerates this, GitLab doesn't).
Spec-compliant clients pull it fine anonymously, e.g.:
oras pull registry.gitlab.com/pravorskyi/devcontainer-features:latest
# Downloaded c620bb2546ea devcontainer-collection.jsonCould you check again, please?
There was a problem hiding this comment.
The devcontainer CLI sends the header GitLab requires. In the CLI's OCI client getManifest defaults to Accept: application/vnd.oci.image.manifest.v1+json.
https://github.com/devcontainers/cli/blob/main/src/spec-configuration/containerCollectionsOCI.ts#L315
https://github.com/devcontainers/cli/blob/main/src/spec-configuration/containerCollectionsOCI.ts#L522
There was a problem hiding this comment.
Hi pravorskyi
I tried out the ociReference with a devcontainer config as below:
{
"image": "mcr.microsoft.com/devcontainers/base:trixie",
"features": {
//"ghcr.io/devcontainers/features/common-utils": {}
"registry.gitlab.com/pravorskyi/devcontainer-features": {}
}
}
It fails with TAR_BAD_ARCHIVE: Unrecognized archive format error which indicates that the artifact isn't a zipped package (.tgz or .tar.gz). Although it should be noted that devcontainer cli is able read and interpret the digest of the artifact. Perhaps a possible redirect like this might be causing this? I might be missing out something in the configuration, kindly point it out in that case.
@Kaniska244 ➜ /workspaces/images (anaconda-issue-check) $ devcontainer up --id-label "test-container=sample-gitlab-config" --workspace-folder "./src/sample-gitlab-config/" --log-level trace
[2 ms] @devcontainers/cli 0.88.0. Node.js v22.17.0. linux 6.8.0-1052-azure x64.
[2 ms] Start: Run: docker buildx version
[60 ms] Stop (58 ms): Run: docker buildx version
[60 ms] github.com/docker/buildx v0.36.1 1d8dde89b8aba914e05e45366770736fea1fd690
[60 ms]
[60 ms] Start: Run: docker -v
[77 ms] Stop (17 ms): Run: docker -v
[78 ms] Start: Run: docker version --format {{.Server.Version}}
[100 ms] Stop (22 ms): Run: docker version --format {{.Server.Version}}
[100 ms] 29.7.1-1
[100 ms]
[101 ms] Start: Resolving Remote
[104 ms] Start: Run: git rev-parse --show-cdup
[107 ms] Stop (3 ms): Run: git rev-parse --show-cdup
[224 ms] Start: Run: docker ps -q -a --filter label=test-container=sample-gitlab-config
[243 ms] Stop (19 ms): Run: docker ps -q -a --filter label=test-container=sample-gitlab-config
[244 ms] Start: Run: docker inspect --type image mcr.microsoft.com/devcontainers/base:trixie
[262 ms] Stop (18 ms): Run: docker inspect --type image mcr.microsoft.com/devcontainers/base:trixie
[262 ms] > input: mcr.microsoft.com/devcontainers/base:trixie
[262 ms] >
[262 ms] > resource: mcr.microsoft.com/devcontainers/base
[262 ms] > id: base
[262 ms] > owner: devcontainers
[262 ms] > namespace: devcontainers
[262 ms] > registry: mcr.microsoft.com
[262 ms] > path: devcontainers/base
[262 ms] >
[262 ms] > version: trixie
[262 ms] > tag?: trixie
[262 ms] > digest?: undefined
[262 ms] manifest url: https://mcr.microsoft.com/v2/devcontainers/base/manifests/trixie
[359 ms] [httpOci] 404 (NoAuth): https://mcr.microsoft.com/v2/devcontainers/base/manifests/trixie
[359 ms] Did not fetch target with expected mimetype 'application/vnd.docker.distribution.manifest.v2+json': {"errors":[{"code":"MANIFEST_UNKNOWN","message":"OCI image index found, but accept header does not support OCI image index"}]}
[443 ms] [httpOci] 200 (NoAuth): https://mcr.microsoft.com/v2/devcontainers/base/manifests/trixie
[444 ms] Fetched: {
"schemaVersion": 2,
"mediaType": "application/vnd.oci.image.index.v1+json",
"manifests": [
{
"mediaType": "application/vnd.oci.image.manifest.v1+json",
"digest": "sha256:6acb3a9bb6b069f77af2aea19564798e5a82122497df50b0da2d476e792aed78",
"size": 2004,
"platform": {
"architecture": "amd64",
"os": "linux"
}
},
{
"mediaType": "application/vnd.oci.image.manifest.v1+json",
"digest": "sha256:26a1f5119c5db801e9bcadfdaa5c0235e0319f110d03e2143723d847020ebc49",
"size": 2004,
"platform": {
"architecture": "arm64",
"os": "linux"
}
},
{
"mediaType": "application/vnd.oci.image.manifest.v1+json",
"digest": "sha256:66992438d8aa597a4329fb992992f7fa165ec5828943f8384f0711ae8ac0f28f",
"size": 565,
"annotations": {
"vnd.docker.reference.digest": "sha256:6acb3a9bb6b069f77af2aea19564798e5a82122497df50b0da2d476e792aed78",
"vnd.docker.reference.type": "attestation-manifest"
},
"platform": {
"architecture": "unknown",
"os": "unknown"
}
},
{
"mediaType": "application/vnd.oci.image.manifest.v1+json",
"digest": "sha256:51a5c2db68a03db0aaaa436c99bb5afc9e2975d9906729e605ee007ebd0037ad",
"size": 565,
"annotations": {
"vnd.docker.reference.digest": "sha256:26a1f5119c5db801e9bcadfdaa5c0235e0319f110d03e2143723d847020ebc49",
"vnd.docker.reference.type": "attestation-manifest"
},
"platform": {
"architecture": "unknown",
"os": "unknown"
}
}
]
}
[551 ms] [httpOci] 200 (NoAuth): https://mcr.microsoft.com/v2/devcontainers/base/manifests/sha256:6acb3a9bb6b069f77af2aea19564798e5a82122497df50b0da2d476e792aed78
[551 ms] blob url: https://mcr.microsoft.com/v2/devcontainers/base/blobs/sha256:ee3ea22ba5dc1dc244099905480291bb73a70d08dc13f714ca281ede6be0d866
[658 ms] [httpOci] 200 (NoAuth): https://mcr.microsoft.com/v2/devcontainers/base/blobs/sha256:ee3ea22ba5dc1dc244099905480291bb73a70d08dc13f714ca281ede6be0d866
[659 ms] workspace root: /workspaces/images/src/sample-gitlab-config
[659 ms] configPath: /workspaces/images/src/sample-gitlab-config/.devcontainer/devcontainer.json
[660 ms] --- Processing User Features ----
[660 ms] [* user-provided] registry.gitlab.com/pravorskyi/devcontainer-features
[661 ms] Resolving Feature dependencies for 'registry.gitlab.com/pravorskyi/devcontainer-features'...
[661 ms] * Processing feature: registry.gitlab.com/pravorskyi/devcontainer-features
[661 ms] > input: registry.gitlab.com/pravorskyi/devcontainer-features
[661 ms] >
[661 ms] > resource: registry.gitlab.com/pravorskyi/devcontainer-features
[661 ms] > id: devcontainer-features
[661 ms] > owner: pravorskyi
[661 ms] > namespace: pravorskyi
[661 ms] > registry: registry.gitlab.com
[661 ms] > path: pravorskyi/devcontainer-features
[661 ms] >
[661 ms] > version: latest
[661 ms] > tag?: latest
[661 ms] > digest?: undefined
[661 ms] manifest url: https://registry.gitlab.com/v2/pravorskyi/devcontainer-features/manifests/latest
[1319 ms] [httpOci] Attempting to authenticate via 'Bearer' auth.
[1320 ms] [httpOci] No authentication credentials found for registry 'registry.gitlab.com' via docker config or credential helper.
[1321 ms] [httpOci] No authentication credentials found for registry 'registry.gitlab.com'. Accessing anonymously.
[1321 ms] [httpOci] Attempting to fetch bearer token from: https://gitlab.com/jwt/auth?service=container_registry&scope=repository:pravorskyi/devcontainer-features:pull
[2465 ms] [httpOci] 200 on reattempt after auth: https://registry.gitlab.com/v2/pravorskyi/devcontainer-features/manifests/latest
[2465 ms] > input: registry.gitlab.com/pravorskyi/devcontainer-features
[2465 ms] >
[2465 ms] > resource: registry.gitlab.com/pravorskyi/devcontainer-features
[2465 ms] > id: devcontainer-features
[2465 ms] > owner: pravorskyi
[2465 ms] > namespace: pravorskyi
[2465 ms] > registry: registry.gitlab.com
[2465 ms] > path: pravorskyi/devcontainer-features
[2465 ms] >
[2465 ms] > version: latest
[2465 ms] > tag?: latest
[2465 ms] > digest?: undefined
[2466 ms] blob url: https://registry.gitlab.com/v2/pravorskyi/devcontainer-features/blobs/sha256:c620bb2546ea7cb9d30cfef7d3766f2f43b0025fc3706b97f8b898ee228097bc
[2466 ms] [httpOci] Applying cachedAuthHeader for registry registry.gitlab.com...
[3161 ms] [httpOci] 200 (Cached): https://registry.gitlab.com/v2/pravorskyi/devcontainer-features/blobs/sha256:c620bb2546ea7cb9d30cfef7d3766f2f43b0025fc3706b97f8b898ee228097bc
[3162 ms] omitDuringExtraction: '
[3162 ms] Files to omit: ''
[3165 ms] Error getting blob: Error: TAR_BAD_ARCHIVE: Unrecognized archive format
Error: Failed to download package for registry.gitlab.com/pravorskyi/devcontainer-features
at fI (/usr/local/share/npm-global/lib/node_modules/@devcontainers/cli/dist/spec-node/devContainersSpecCLI.js:285:3959)
at async Hb (/usr/local/share/npm-global/lib/node_modules/@devcontainers/cli/dist/spec-node/devContainersSpecCLI.js:287:6567)
at async IV (/usr/local/share/npm-global/lib/node_modules/@devcontainers/cli/dist/spec-node/devContainersSpecCLI.js:287:5064)
at async mI (/usr/local/share/npm-global/lib/node_modules/@devcontainers/cli/dist/spec-node/devContainersSpecCLI.js:287:7321)
at async NQ (/usr/local/share/npm-global/lib/node_modules/@devcontainers/cli/dist/spec-node/devContainersSpecCLI.js:287:7547)
at async JQ (/usr/local/share/npm-global/lib/node_modules/@devcontainers/cli/dist/spec-node/devContainersSpecCLI.js:392:1834)
at async NI (/usr/local/share/npm-global/lib/node_modules/@devcontainers/cli/dist/spec-node/devContainersSpecCLI.js:395:2321)
at async _Q (/usr/local/share/npm-global/lib/node_modules/@devcontainers/cli/dist/spec-node/devContainersSpecCLI.js:395:273)
at async bp (/usr/local/share/npm-global/lib/node_modules/@devcontainers/cli/dist/spec-node/devContainersSpecCLI.js:467:1947)
at async kv (/usr/local/share/npm-global/lib/node_modules/@devcontainers/cli/dist/spec-node/devContainersSpecCLI.js:467:608)
{"outcome":"error","message":"Failed to download package for registry.gitlab.com/pravorskyi/devcontainer-features","description":"An error occurred setting up the container."}
@Kaniska244 ➜ /workspaces/images (anaconda-issue-check) $
Also just to point out, all the features currently listed in the public features index, are from GitHub repositories with ociReference from GHCR. Although as a matter of fact, GitLab does support OCI artifacts and also supported by devcontainer cli.
There was a problem hiding this comment.
Hi, Kaniska (@Kaniska244)!
I'm a bit confused why your config uses
"registry.gitlab.com/pravorskyi/devcontainer-features": {}
instead of
"registry.gitlab.com/pravorskyi/devcontainer-features/claude-code:1": {}
The first reference (registry.gitlab.com/pravorskyi/devcontainer-features) is the collection root. The artifact there is devcontainer-collection.json, it isn't a feature tarball.
Features are installed as <collection>/<feature-id>, same as ghcr.io/devcontainers/features/common-utils in your commented-out line (and not the bare ghcr.io/devcontainers/features).
What type of PR is this?
Related Issues
Description
Adds my dev container feature collection to the community index.
Collection checklist
If your PR contributes a new collection, please utilize this checklist:
ghcr.io/<owner>/<repo>— one entry per repository, not one per Feature; do not includehttp://orhttps://)