update command with resource with outputs generates corrupt lock file

Đang mở
#2,580 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
docker, go
Lĩnh vực
build-system, cli

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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

Ngôn ngữ chính
Go
Star
12.4k
Fork
358
Merge trung bình
17 giờ 12 phút
Pull request đã merge (30 ngày)
31

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của jetify-com/devbox

Tất cả issue của jetify-com/devbox

Issue tương tự

Thêm issue về Go

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.