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

オープン
#5,103 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

  • #5105 @princejain756 による — マージされずにクローズ

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
72/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
git, typescript
領域
cli, devtools

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
TypeScript
スター
16.5k
フォーク
1.5k
平均マージ
1日 15時間
マージ済み PR(30日)
17

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

triggerdotdev/trigger.dev のほかの issue

triggerdotdev/trigger.dev の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。