`trigger deploy`: wrong git metadata and build context from a git worktree

Abierto
#5,103 2 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

  • #5105 de @princejain756 — cerrado sin fusionar

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
72/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
git, typescript
Área
cli, devtools

Línea de trabajo

Start in the trigger.dev CLI code that sets config.workspaceDir, calls createGitMeta and getOriginUrl, and creates the native build context with createContextArchive. Trace how those paths are derived for local deploys, then check the relevant CLI tests for workspace and remote metadata. Done means a deploy from a nested or external git worktree uses that worktree’s root, commit, branch, dirty status, remote URL, and build context.

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

Descripción

Version: trigger.dev CLI 4.7.7, local deploys (not GitHub Actions or the GitHub App).

config.workspaceDir comes from pkg-types findWorkspaceDir, which looks for the nearest .git/config file. A linked worktree has a .git file, not a directory, so the lookup misses it. Two things then go wrong.

1. A worktree nested inside another checkout (for example repo/.worktrees/release): workspaceDir resolves to the outer checkout.

  • createGitMeta runs git log and git status there, so the deployment records the outer checkout's commit, branch, and dirty flag. We saw a deploy built from a clean worktree at ae22adff recorded as 23422c6f, main, dirty.
  • On the native build path, createContextArchive(config.workspaceDir, …) tars the outer checkout, not the worktree being deployed.

2. A worktree outside any checkout: workspaceDir is the worktree itself, which is correct. But getOriginUrl(join(directory, ".git/config")) reads that path as a file, and in a worktree it doesn't exist. So remoteUrl is always missing. GIT_DIR and GIT_WORK_TREE don't help, because this value never goes through git.

Suggested fix: take both values from git in the project directory: git rev-parse --show-toplevel for the workspace, and git config --get remote.origin.url for the remote. That handles worktrees and respects GIT_DIR. Today we work around the first problem by exporting GIT_DIR and GIT_WORK_TREE and refusing nested-worktree deploys. The second has no workaround short of faking a .git/config.

Lenguaje dominante
TypeScript
Estrellas
16.5k
Forks
1.5k
Merge medio
1 d 15 h
PR fusionados (30 d)
17

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de triggerdotdev/trigger.dev

Todos los issues de triggerdotdev/trigger.dev

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.