update command with resource with outputs generates corrupt lock file

未关闭
#2,580 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
停滞
技术栈
docker, go
领域
build-system, cli

调研方向

Follow the reproduction steps: initialize a project, add prometheus with outputs cli and out, generate the Dockerfile, run devbox update, then build the Docker image. Compare the generated devbox.lock before and after the update, focusing on the outputs entries. Done means the updated lock file preserves the requested outputs and the Docker build succeeds.

由索引模型根据 Issue 内容生成。

描述

bug triage
What happened?

When using devbox in a docker container it fails if using a package with outputs specified. This only happens when using the generated devbox dockerfile and it only happens after you have used devbox update.

Here is a snippet of the generated devbox.lock that is causing the corruption issue.

Good file

        "x86_64-linux": {
          "outputs": [
            {
              "name": "out",
              "path": "/nix/store/959wvhvp9yd1xcaqmmbabk4rhs7x8yyv-prometheus-3.1.0",
              "default": true
            },
            {
              "name": "cli",
              "path": "/nix/store/bd5qxk8agqvfn5sdjc4whj23sgycmmzz-prometheus-3.1.0-cli"
            },
            {
              "name": "doc",
              "path": "/nix/store/jabhy8j1wgaib51c6q0sr6bpp01hy2nq-prometheus-3.1.0-doc"
            }
          ],
          "store_path": "/nix/store/959wvhvp9yd1xcaqmmbabk4rhs7x8yyv-prometheus-3.1.0"
        }

Bad file after devbox update

        "x86_64-linux": {
          "outputs": [
            {
              "name": "cli",
              "path": "/nix/store/bd5qxk8agqvfn5sdjc4whj23sgycmmzz-prometheus-3.1.0-cli",
              "default": true
            },
            {
              "path": "/nix/store/959wvhvp9yd1xcaqmmbabk4rhs7x8yyv-prometheus-3.1.0",
              "default": true
            },
            {
              "name": "cli",
              "path": "/nix/store/bd5qxk8agqvfn5sdjc4whj23sgycmmzz-prometheus-3.1.0-cli",
              "default": true
            },
            {
              "path": "/nix/store/959wvhvp9yd1xcaqmmbabk4rhs7x8yyv-prometheus-3.1.0",
              "default": true
            }
          ],
          "store_path": "/nix/store/959wvhvp9yd1xcaqmmbabk4rhs7x8yyv-prometheus-3.1.0"
        }
      }
    }
  }
}
0.465 Info: Ensuring packages are installed.
0.552 Error: error running script "echo" in Devbox: Output out not found
0.552 
------
Dockerfile:13
--------------------
  11 |     
  12 |     
  13 | >>> RUN devbox run -- echo "Installed Packages."
  14 |     
  15 |     CMD ["devbox", "shell"]
--------------------
ERROR: failed to solve: process "/bin/sh -c devbox run -- echo \"Installed Packages.\"" did not complete successfully: exit code: 1
Steps to reproduce
  1. devbox init
  2. devbox add prometheus@latest -o cli,out
  3. devbox generate dockerfile
  4. devbox update
  5. docker build .

See error

Command

update

devbox.json
{
  "$schema": "https://raw.githubusercontent.com/jetify-com/devbox/0.14.0/.schema/devbox.schema.json",
  "packages": {
    "prometheus": {
      "version": "latest",
      "outputs": ["cli", "out"]
    }
  },
  "shell": {
    "init_hook": [
      "echo 'Welcome to devbox!' > /dev/null"
    ],
    "scripts": {
      "test": [
        "echo \"Error: no test specified\" && exit 1"
      ]
    }
  }
}
Devbox version

0.14.0

Nix version

nix (Nix) 2.28.1

What system does this bug occur on?

Linux (x86-64)

Debug logs

[7/7] RUN devbox run -- echo "Installed Packages.":
0.523 Info: Ensuring packages are installed.
0.576 Error: error running script "echo" in Devbox: Output out not found
0.576


Dockerfile:14

12 |
13 | RUN nix --version
14 | >>> RUN devbox run -- echo "Installed Packages."
15 |
16 | CMD ["devbox", "shell"]

ERROR: failed to solve: process "/bin/sh -c devbox run -- echo "Installed Packages."" did not complete successfully: exit code: 1

主要语言
Go
星标
12.4k
派生
358
平均合并
17 小时 12 分钟
30 天内合并 PR
31

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

jetify-com/devbox 的其他 Issue

查看 jetify-com/devbox 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。