Repository: prometheus-operator/kube-prometheus

Issue #2224: `jb install ...` is currently broken because pyrra is not pinned (pyrra 0.7 release)
Created: 2023-09-27T10:51:27Z
In

  
    
      kube-prometheus/jsonnetfile.lock.json
    
    
         Line 150
      in
      8ce7838
    
  
  
    

        
          
           "remote": "https://github.com/pyrra-dev/pyrra.git", 
        
    
  


we define
    {
      "source": {
        "git": {
          "remote": "https://github.com/pyrra-dev/pyrra.git",
          "subdir": "config/crd/bases"
        }
      },
      "version": "8ef5703723f0a4079d7d9ad15ca1fb6bda430a8e",
      "sum": "v0uv2DLx8qjW+OviUfzTFOzZ+0IizXqBhuglGHIhGmo="
    },

That version indeed contains the config/crd/bases directory:
https://github.com/pyrra-dev/pyrra/tree/8ef5703723f0a4079d7d9ad15ca1fb6bda430a8e/config/crd/bases
@metalmatze has 14 hours ago commited pyrra-dev/pyrra@f2052cc which seems to have removed the config/* directory tree from the repo.
Now, despite kube-prometheus's jsonnetfile.lock.json specifying 8ef570 during the jsonnet build we see the the build fetching the current HEAD of main:
GET https://github.com/pyrra-dev/pyrra/archive/f2052cce0c848bb8c4c4d5d964a97b5038237487.tar.gz 200
panic: rename vendor/.tmp/jsonnetpkg-github.com-pyrra-dev-pyrra-config-crd-bases-main336769959/config/crd/bases vendor/github.com/pyrra-dev/pyrra/config/crd/bases: no such file or directory

Specifically, this error happens during running
jb install github.com/prometheus-operator/kube-prometheus/jsonnet/kube-prometheus@7fafc4cadc1

which is a documented way to initiate the jsonnet build (which we use in our CI).
Why would the JSONNET build fetch the HEAD of main of pyrra-dev/pyrra instead of the specified commit? We seem to have a second reference to pyrra in the kube-prometheus repo, and indeed it's a moving target:
    {
      "source": {
        "git": {
          "remote": "https://github.com/pyrra-dev/pyrra.git",
          "subdir": "config/crd/bases"
        }
      },
      "version": "main"
    },

That definition lives in jsonnet/kube-prometheus/jsonnetfile.json.
Obvious question: what  is the separation of concerns is between

jsonnetfile.lock.json
jsonnet/kube-prometheus/jsonnetfile.json

?
As a quick resolution we should probably pin pyrra to a specific commit in jsonnet/kube-prometheus/jsonnetfile.json.

Duplicate issue #2227: jb install github.com/prometheus-operator/kube-prometheus/jsonnet/kube-prometheus@main not working
Created: 2023-09-29T07:07:50Z
The steps mentioned here not working. - https://github.com/prometheus-operator/kube-prometheus/blob/main/docs/customizing.md#installing
When you run jb install github.com/prometheus-operator/kube-prometheus/jsonnet/kube-prometheus@main, it errors out with below error message.
`jchammal@jchammal-desktop:~/apps/monitoring/v1/upstream-jsonnet$ jb install github.com/prometheus-operator/kube-prometheus/jsonnet/kube-prometheus@main
GET https://github.com/prometheus-operator/kube-prometheus/archive/98df18a75e0d2960720a5222592005646a68488b.tar.gz 200
GET https://github.com/coreos/kube-prometheus/archive/53f18a42769ea1d4bce833962a908f84069ef495.tar.gz 200
GET https://github.com/kubernetes/kube-state-metrics/archive/b91dd311397047f15aae4f6dacba0708f24cf446.tar.gz 200
GET https://github.com/kubernetes/kube-state-metrics/archive/b91dd311397047f15aae4f6dacba0708f24cf446.tar.gz 200
GET https://github.com/pyrra-dev/pyrra/archive/e29c5d3d59311b19f9e42693c2214d406c24c67c.tar.gz 200
panic: rename /home/jchammal/apps/monitoring/v1/upstream-jsonnet/vendor/.tmp/9a7929ebbffc63d4be4e160c61f673031661834597/config/crd/bases /home/jchammal/apps/monitoring/v1/upstream-jsonnet/vendor/github.com/pyrra-dev/pyrra/config/crd/bases: no such file or directory
goroutine 1 [running]:
github.com/jsonnet-bundler/jsonnet-bundler/pkg.(*GitPackage).Install(0xc0004f2068, {0x8764f8, 0xc0000220a0}, {0xc000020f30, 0x2b}, {0xc000026480, 0x54}, {0xc000023470, 0x4})
/home/jchammal/go/pkg/mod/github.com/jsonnet-bundler/jsonnet-bundler@v0.5.1/pkg/git.go:228 +0x1a4b
github.com/jsonnet-bundler/jsonnet-bundler/pkg.download({{0xc000078ff0, 0x0}, {0xc000023470, 0x4}, {0x0, 0x0}, 0x0, {0x0, 0x0}}, {0xc000026480, ...}, ...)
/home/jchammal/go/pkg/mod/github.com/jsonnet-bundler/jsonnet-bundler@v0.5.1/pkg/packages.go:309 +0x3b1
github.com/jsonnet-bundler/jsonnet-bundler/pkg.ensure(0xc0004fc320?, {0xc000026480, 0x54}, {0xc0004fc3c0, 0x9b}, 0x0?)
/home/jchammal/go/pkg/mod/github.com/jsonnet-bundler/jsonnet-bundler@v0.5.1/pkg/packages.go:234 +0x61d
github.com/jsonnet-bundler/jsonnet-bundler/pkg.ensure(0x53?, {0xc000026480, 0x54}, {0x0, 0x0}, 0x54?)
/home/jchammal/go/pkg/mod/github.com/jsonnet-bundler/jsonnet-bundler@v0.5.1/pkg/packages.go:265 +0xcea
github.com/jsonnet-bundler/jsonnet-bundler/pkg.Ensure({0xc000172300?, 0x10?}, {0xc000026480, 0x54}, 0x0?)
/home/jchammal/go/pkg/mod/github.com/jsonnet-bundler/jsonnet-bundler@v0.5.1/pkg/packages.go:55 +0x54
main.installCommand({0xc000026004?, 0x7f369b?}, {0x7df7da, 0x6}, {0xc00005afe0, 0x1, 0xc000046601?}, 0x0, {0x0, 0x0})
/home/jchammal/go/pkg/mod/github.com/jsonnet-bundler/jsonnet-bundler@v0.5.1/cmd/jb/install.go:85 +0x8bf
main.Main()
/home/jchammal/go/pkg/mod/github.com/jsonnet-bundler/jsonnet-bundler@v0.5.1/cmd/jb/main.go:87 +0xd4a
main.main()
/home/jchammal/go/pkg/mod/github.com/jsonnet-bundler/jsonnet-bundler@v0.5.1/cmd/jb/main.go:39 +0x19`

Closing comment (2023-09-30T11:41:32Z): Thanks for opening this issue.
It's a duplicate of #2224