devcontainers / action

GitHub Action to build & publish your own dev container assets
https://containers.dev
MIT License
58 stars 17 forks source link

Changed namespace, but version tags still appear in original namespace #147

Open DentonGentry opened 1 year ago

DentonGentry commented 1 year ago

I published the first several versions of our devcontainer feature without setting features-namespace or templates-namespace, so they appeared at a default location based on the name of the repository: https://github.com/tailscale/codespace/pkgs/container/codespace%2Ftailscale

I've since updated our workflow to set the namespaces, but new version tags still only appear at the original location.

For example I ran the devcontainers/action workflow for 1.0.3 after updating features-namespace and templates-namespace, but the 1.0.3 tag only appears in the old package location: https://github.com/tailscale/codespace/pkgs/container/codespace%2Ftailscale

The new location, the one that I actually want to publish to, only gets the latest tag. https://github.com/tailscale/codespace/pkgs/container/codespace

Therefore the prior versions drop out of its view when a new one it published, and it isn't possible for people to reference the devcontainer feature by a specific version.

What I'd like to accomplish is:

Is there a way to accomplish this?

References: https://github.com/devcontainers/devcontainers.github.io/pull/127

samruddhikhandale commented 1 year ago

Hi 👋

Looks like there is some kind of confusion in how the namespace works and how it's perceived in this case. I wonder if that's because the name of the owner & Feature is same (ie tailscale). Even I was confused for a bit while reviewing https://github.com/devcontainers/devcontainers.github.io/pull/119

According to https://containers.dev/implementors/features-distribution/#oci-registry, by default, the namespace is <owner>/<repo> (in your case it is tailscale/codespace).

I published the first several versions of our devcontainer feature without setting features-namespace or templates-namespace, so they appeared at a default location based on the name of the repository:

As nothing was set, by default the features-namespace and templates-namespace was tailscale/codespace (ie <owner>/<repo>)

I've since updated our workflow to set the namespaces, but new version tags still only appear at the original location.

image

Apparently, the updated namespace is still the same as the default one. Hence, nothing is expected to change.

stop adding new versions in https://github.com/tailscale/codespace/pkgs/container/codespace%2Ftailscale, but leave it in place so as not to break people who are already referencing it

ghcr.io/tailscale/codespace/tailscale

The Feature tailscale is always pushed as ${REGISTRY}/${NAMESPACE}/${FEATURE}. Hence, https://github.com/tailscale/codespace/pkgs/container/codespace%2Ftailscale is correct with the current workflow.

REGISTRY - ghcr.io NAMESPACE - tailscale/codespace FEATURE - tailscale

new versions appear only in https://github.com/tailscale/codespace/pkgs/container/codespace, with their tags

As mentioned in https://containers.dev/implementors/features-distribution/#oci-registry 👇

The auto-generated devcontainer-collection.json is pushed to the registry with the same namespace as above and no accompanying feature name. The collection file is always tagged as latest.

https://github.com/tailscale/codespace/pkgs/container/codespace is an OCI artifact which contains metadata of Features/Templates. This is how Features/Templates metadata are distributed and is part of the spec.

Let us know if you have any other questions. Feel free to take a look at the Features spec for more details.