coder / coder/envbuilder

feature: Allow appending an arbitrary validation command to the built image

Abierto
#383 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Go
Estrellas
300
Forks
64
Merge medio
20 min
PR fusionados (30 d)
1

Descripción

# Motivation

Some image building workflows involve a final `RUN` command that serves to in some way validate the built image before pushing it to a remote registry ([example](https://docs.docker.com/build/ci/github-actions/test-before-push/)).

For example, we may want to run a security scan of the image for CVEs using e.g. [trivy](https://github.com/aquasecurity/trivy), or perform a final confidence check on the image using e.g. [goss](https://github.com/goss-org/goss).

With Envbuilder, the built image is only available inside the running `envbuilder` container, so it can't be scanned easily by external processes.

# Solution

Allow appending an arbitrary RUN command to the Dockerfile produced by Envbuilder. An example of such a command could be:

```shell
RUN curl -fsSL -o /tmp/validate.sh https://host.internal/validate.sh && \
chmod +x /tmp/validate.sh && \
/tmp/validate.sh && \
rm -f /tmp/validate.sh
```

# Alternatives

The above behaviour can be approximated with no code changes with the below:

- Append a RUN command to the Dockerfile containing the specific check(s) they wish to run, or
- Add the required validation steps to `devcontainer.json` as e.g. `postCreateCommand`, or
- Create a specific devcontainer feature that runs the desired validation commands.

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Línea de trabajo

Como en el issue no se nombran archivos ni pruebas, comienza localizando el punto de entrada de Envbuilder para la generación de Dockerfile y sus opciones de configuración o CLI existentes. Sigue cómo se construye la imagen generada y, después, verifica que un comando de validación proporcionado se convierta en un paso RUN final antes de hacer push de la imagen, con cobertura de regresión para el Dockerfile generado.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
docker, go
Área
build-system, devops
Tipo de issue
Nueva funcionalidad
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
45/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.