devcontainers / devcontainers/cli

@devcontainer/cli publish templates to GitLab container registry

Abierto
#934 0 comentarios 1 reacción 0 asignados Ver en GitHub
question
Lenguaje dominante
TypeScript
Estrellas
3k
Forks
457
Merge medio
13 h 17 min
PR fusionados (30 d)
6

Descripción

Related to this [issue](https://github.com/devcontainers/cli/issues/675).

I don't see any update, and that issue was closed, so I created a new one.

## TL;DR
It seems that we can publish devcontainer template to GitLab container registry now.

## What happened

I tried to publish devcontainer template to self hosted GitLab container registry (v17.3.7-ee), by following the [example](https://containers.dev/guide/gitlab-ci).

It failed with 401(Could not fetch published tags) as expected, but it worked locally on my machine with the same user and access token.

So I was thinking maybe GitLab container registry start to support OADS now, tried another `.gitlab-ci.yml` and it worked.

But I didn't see any updates from GitLab saying they start to support OADS in this [issue](https://gitlab.com/gitlab-org/gitlab/-/issues/385277).

Anyone know why the original `.gitlab-ci.yml` failed, but the new one worked?

I was thinking building a @devcontainer/cli image with more detailed logs, and use it in the original `.gitlab-ci.yml` to help with the root cause analysis.

## My `.gitlab-ci.yml`

Here's my `.gitlab-ci.yml`:
```=yml
image: alpine:3.20

before_script:
- apk add --update nodejs npm curl
- npm install -g @devcontainers/cli
- VERSION="1.2.0"
- curl -LO "https://github.com/oras-project/oras/releases/download/v${VERSION}/oras_${VERSION}_linux_amd64.tar.gz"
- mkdir -p oras-install/
- tar -zxf oras_${VERSION}_*.tar.gz -C oras-install/
- mv oras-install/oras /usr/local/bin/
- rm -rf oras_${VERSION}_*.tar.gz oras-install/

build:
stage: build
script:
- echo "$PERSONAL_ACCESS_TOKEN" | oras login registry.gitlab.com -u "$PERSONAL_USER" --password-stdin
- devcontainer templates publish --log-level trace -r registry.gitlab.com -n group/project ./src
```

Here's my original and failed `.gitlab-ci.yml`:
```=yml
image: docker:latest

variables:
DOCKER_TLS_CERTDIR: "/certs"

services:
- docker:dind

before_script:
- apk add --update nodejs npm python3 make g++ ca-certificates
- npm install -g @devcontainers/cli

build:
stage: build
script:
- echo "$PERSONAL_ACCESS_TOKEN" | docker login -u "$PERSONAL_USER" registry.gitlab.com --password-stdin
- devcontainer templates publish --log-level trace -r registry.gitlab.com -n group/project ./src
```

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.