Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More nix #121

Open
wants to merge 54 commits into
base: main
Choose a base branch
from
Open

More nix #121

wants to merge 54 commits into from

Conversation

Reasonable-Solutions
Copy link
Contributor

This is a nix flake that gives us 3 things or so

  1. it builds a docker file for unleasherator, ~49 mb or such nix build .#docker.<aarch>
  2. it also builds unleasherator, nix build
  3. and you get an automatic build environment with a reproducible set of tools for building, testing etc. see Detect when makefile binaries are out of date #111, no checks needed. Correct environment every time

downsides: You have to update sha's every now and then.

@Reasonable-Solutions Reasonable-Solutions requested a review from a team as a code owner May 23, 2023 08:38
@Starefossen
Copy link
Member

Makefile no work unless u have nix installed? 🤨

@Reasonable-Solutions
Copy link
Contributor Author

Reasonable-Solutions commented May 23, 2023

Makefile no work unless u have nix installed? 🤨

have nix installed, and you have to materialized all the stuff from it in your environment, i.e nix develop or transparently through direnv

Should I have the makefile branch depeinding on what kind of environment you are in? E.g If you have the tools then do this and if not then mkdir, download, etc?

@Reasonable-Solutions
Copy link
Contributor Author

Reasonable-Solutions commented May 23, 2023

oh, I should also, use the flake in the github workflow ..

@x10an14-nav
Copy link

Doesn't build for me on x86_64-linux:

Bash log of build
-> $ nom build .#docker.x86_64-linux
these 10 derivations will be built:
  /nix/store/nm3gb0q09708fpc3bpmnr7mh1b13jq32-unleasherator.drv
  /nix/store/831yjw37pn847g087pjxqzlspdyvbv89-unleasherator-customisation-layer.drv
  /nix/store/hhiczsms1mvpzgkdriw687s3ji7qkpxa-unleasherator-base.json.drv
  /nix/store/hyq4pl4i23xmw2kl54z22c0vy2vhjnax-closure.drv
  /nix/store/9sqqy75wznf15pmsx5ncqh1ljy6w694c-closure-paths.drv
  /nix/store/bp0f0jv8yddbc50nf45nxavscnrghlb1-unleasherator-conf.json.drv
  /nix/store/mbbbfaxym81qjjcc60r9h5vj9fj90lzh-pythoncheck.sh.drv
  /nix/store/z8fs1107lwdy2a5h1shjgrzn607yrlqc-stream.drv
  /nix/store/yig8q1ka37gmiw66biwbvm9vrpb41rw6-stream-unleasherator.drv
  /nix/store/v1vgqjws61frw51lzfhrw6raxps87vdx-unleasherator.tar.gz.drv
these 16 paths will be fetched (0.85 MiB download, 2.97 MiB unpacked):
  /nix/store/2y2nabl483f2ri15x11b4sv03ds6z15x-make-shell-wrapper-hook
  /nix/store/5wv3rxgc3pnsh5rcq8vhbn9478bgpdxl-jq-1.6-lib
  /nix/store/88596av4s0n3d76283zdyl0l923r8y93-python3.10-pyflakes-3.0.1
  /nix/store/ac7j8g4ba3b6zqbc00pyya5j7bpylk83-python3.10-flake8-6.0.0
  /nix/store/ga59c4cl43652bbxbp6pghzxmm5c2xcs-python3.10-mccabe-0.7.0
  /nix/store/k913qyi8mmhiaibznsb3rd1ihmgcxjin-python3.10-pycodestyle-2.10.0
  /nix/store/mcaq97q726jywjbi7c6b323cvvf36qgp-dash-0.5.12
  /nix/store/r3ic1scj4yc64fqagb51qfyia89mxgm1-die-hook
  /nix/store/r6lzpxf3mi2530lxg9llbdhg1g4gbw9z-jq-1.6-dev
  /nix/store/vkbzqxn1y9jszz3af7f3vw5pf0hz50ya-pigz-2.6
  /nix/store/w5ysgngbdv6xvm0kgbgzyzbk6ylx5fq2-jq-1.6-bin
  /nix/store/x8nq8x6g4r0hncw5wa3p1mshjmyr73fm-oniguruma-6.9.8-lib
  /nix/store/xsm6rb1cy6wcf24yx7jj4rh9r69w0lk5-libedit-20221030-3.1
  /nix/store/zb35c0z8mq53zvp3gs6px6h7fxy8mllm-lndir-1.0.4
  /nix/store/zs39mqfazj1b9s4z77mlajhzl088wa02-getopt-1.1.6
  /nix/store/zxsfb9gaci6689vrryzpd73g44829cj0-fakeroot-1.29
copying path '/nix/store/vkbzqxn1y9jszz3af7f3vw5pf0hz50ya-pigz-2.6' from 'https://cache.nixos.org'
copying path '/nix/store/r3ic1scj4yc64fqagb51qfyia89mxgm1-die-hook' from 'https://cache.nixos.org'
copying path '/nix/store/xsm6rb1cy6wcf24yx7jj4rh9r69w0lk5-libedit-20221030-3.1' from 'https://cache.nixos.org'
copying path '/nix/store/ga59c4cl43652bbxbp6pghzxmm5c2xcs-python3.10-mccabe-0.7.0' from 'https://cache.nixos.org'
copying path '/nix/store/k913qyi8mmhiaibznsb3rd1ihmgcxjin-python3.10-pycodestyle-2.10.0' from 'https://cache.nixos.org'
copying path '/nix/store/88596av4s0n3d76283zdyl0l923r8y93-python3.10-pyflakes-3.0.1' from 'https://cache.nixos.org'
copying path '/nix/store/zs39mqfazj1b9s4z77mlajhzl088wa02-getopt-1.1.6' from 'https://cache.nixos.org'
copying path '/nix/store/zb35c0z8mq53zvp3gs6px6h7fxy8mllm-lndir-1.0.4' from 'https://cache.nixos.org'
copying path '/nix/store/x8nq8x6g4r0hncw5wa3p1mshjmyr73fm-oniguruma-6.9.8-lib' from 'https://cache.nixos.org'
unleasherator> building '/nix/store/nm3gb0q09708fpc3bpmnr7mh1b13jq32-unleasherator.drv'
copying path '/nix/store/mcaq97q726jywjbi7c6b323cvvf36qgp-dash-0.5.12' from 'https://cache.nixos.org'
copying path '/nix/store/2y2nabl483f2ri15x11b4sv03ds6z15x-make-shell-wrapper-hook' from 'https://cache.nixos.org'
copying path '/nix/store/zxsfb9gaci6689vrryzpd73g44829cj0-fakeroot-1.29' from 'https://cache.nixos.org'
unleasherator> unpacking sources
unleasherator> unpacking source archive /nix/store/2ksh0rxcs12av348vfay91kyn5d0jzz3-source
copying path '/nix/store/5wv3rxgc3pnsh5rcq8vhbn9478bgpdxl-jq-1.6-lib' from 'https://cache.nixos.org'
unleasherator> source root is source
copying path '/nix/store/ac7j8g4ba3b6zqbc00pyya5j7bpylk83-python3.10-flake8-6.0.0' from 'https://cache.nixos.org'
unleasherator> patching sources
unleasherator> configuring
copying path '/nix/store/w5ysgngbdv6xvm0kgbgzyzbk6ylx5fq2-jq-1.6-bin' from 'https://cache.nixos.org'
copying path '/nix/store/r6lzpxf3mi2530lxg9llbdhg1g4gbw9z-jq-1.6-dev' from 'https://cache.nixos.org'
pythoncheck.sh> building '/nix/store/mbbbfaxym81qjjcc60r9h5vj9fj90lzh-pythoncheck.sh.drv'
stream> building '/nix/store/z8fs1107lwdy2a5h1shjgrzn607yrlqc-stream.drv'
unleasherator> building
unleasherator> Building subPackage ./api/v1
unleasherator> Building subPackage ./cmd
unleasherator> Building subPackage ./controllers
unleasherator> Building subPackage ./pkg/resources
unleasherator> Building subPackage ./pkg/unleash
unleasherator> Building subPackage ./pkg/utils
unleasherator> running tests
unleasherator> ok       github.com/nais/unleasherator/api/v1    0.007s
unleasherator> Running Suite: Controller Suite - /build/source/controllers
unleasherator> ===========================================================
unleasherator> Random Seed: 1685532369
unleasherator>
unleasherator> Will run 7 of 8 specs
unleasherator> ------------------------------
unleasherator> [BeforeSuite] [FAILED] [3.875 seconds]
unleasherator> [BeforeSuite]
unleasherator> /build/source/controllers/suite_test.go:44
unleasherator>
unleasherator>   Timeline >>
unleasherator>   STEP: bootstrapping test environment @ 05/31/23 11:26:09.999
unleasherator>   2023-05-31T11:26:09Z   DEBUG   controller-runtime.test-env     starting control plane
unleasherator>   2023-05-31T11:26:10Z   ERROR   controller-runtime.test-env     unable to start the controlplane        {"tries": 0, "error": "timeout waiting for process kube-apiserver to start successfully (it may have failed to start, or stopped unexpectedly before becoming ready)"}
unleasherator>   sigs.k8s.io/controller-runtime/pkg/envtest.(*Environment).startControlPlane
unleasherator>          /build/source/vendor/sigs.k8s.io/controller-runtime/pkg/envtest/server.go:329
unleasherator>   sigs.k8s.io/controller-runtime/pkg/envtest.(*Environment).Start
unleasherator>          /build/source/vendor/sigs.k8s.io/controller-runtime/pkg/envtest/server.go:259
unleasherator>   github.com/nais/unleasherator/controllers.glob..func3
unleasherator>          /build/source/controllers/suite_test.go:60
unleasherator>   github.com/onsi/ginkgo/v2/internal.extractBodyFunction.func3
unleasherator>          /build/source/vendor/github.com/onsi/ginkgo/v2/internal/node.go:463
unleasherator>   github.com/onsi/ginkgo/v2/internal.(*Suite).runNode.func3
unleasherator>          /build/source/vendor/github.com/onsi/ginkgo/v2/internal/suite.go:863
unleasherator>   2023-05-31T11:26:11Z   ERROR   controller-runtime.test-env     unable to start the controlplane        {"tries": 1, "error": "timeout waiting for process kube-apiserver to start successfully (it may have failed to start, or stopped unexpectedly before becoming ready)"}
unleasherator>   sigs.k8s.io/controller-runtime/pkg/envtest.(*Environment).startControlPlane
unleasherator>          /build/source/vendor/sigs.k8s.io/controller-runtime/pkg/envtest/server.go:329
unleasherator>   sigs.k8s.io/controller-runtime/pkg/envtest.(*Environment).Start
unleasherator>          /build/source/vendor/sigs.k8s.io/controller-runtime/pkg/envtest/server.go:259
unleasherator>   github.com/nais/unleasherator/controllers.glob..func3
unleasherator>          /build/source/controllers/suite_test.go:60
unleasherator>   github.com/onsi/ginkgo/v2/internal.extractBodyFunction.func3
unleasherator>          /build/source/vendor/github.com/onsi/ginkgo/v2/internal/node.go:463
unleasherator>   github.com/onsi/ginkgo/v2/internal.(*Suite).runNode.func3
unleasherator>          /build/source/vendor/github.com/onsi/ginkgo/v2/internal/suite.go:863
unleasherator>   2023-05-31T11:26:11Z   ERROR   controller-runtime.test-env     unable to start the controlplane        {"tries": 2, "error": "timeout waiting for process kube-apiserver to start successfully (it may have failed to start, or stopped unexpectedly before becoming ready)"}
unleasherator>   sigs.k8s.io/controller-runtime/pkg/envtest.(*Environment).startControlPlane
unleasherator>          /build/source/vendor/sigs.k8s.io/controller-runtime/pkg/envtest/server.go:329
unleasherator>   sigs.k8s.io/controller-runtime/pkg/envtest.(*Environment).Start
unleasherator>          /build/source/vendor/sigs.k8s.io/controller-runtime/pkg/envtest/server.go:259
unleasherator>   github.com/nais/unleasherator/controllers.glob..func3
unleasherator>          /build/source/controllers/suite_test.go:60
unleasherator>   github.com/onsi/ginkgo/v2/internal.extractBodyFunction.func3
unleasherator>          /build/source/vendor/github.com/onsi/ginkgo/v2/internal/node.go:463
unleasherator>   github.com/onsi/ginkgo/v2/internal.(*Suite).runNode.func3
unleasherator>          /build/source/vendor/github.com/onsi/ginkgo/v2/internal/suite.go:863
unleasherator>   2023-05-31T11:26:12Z   ERROR   controller-runtime.test-env     unable to start the controlplane        {"tries": 3, "error": "timeout waiting for process kube-apiserver to start successfully (it may have failed to start, or stopped unexpectedly before becoming ready)"}
unleasherator>   sigs.k8s.io/controller-runtime/pkg/envtest.(*Environment).startControlPlane
unleasherator>          /build/source/vendor/sigs.k8s.io/controller-runtime/pkg/envtest/server.go:329
unleasherator>   sigs.k8s.io/controller-runtime/pkg/envtest.(*Environment).Start
unleasherator>          /build/source/vendor/sigs.k8s.io/controller-runtime/pkg/envtest/server.go:259
unleasherator>   github.com/nais/unleasherator/controllers.glob..func3
unleasherator>          /build/source/controllers/suite_test.go:60
unleasherator>   github.com/onsi/ginkgo/v2/internal.extractBodyFunction.func3
unleasherator>          /build/source/vendor/github.com/onsi/ginkgo/v2/internal/node.go:463
unleasherator>   github.com/onsi/ginkgo/v2/internal.(*Suite).runNode.func3
unleasherator>          /build/source/vendor/github.com/onsi/ginkgo/v2/internal/suite.go:863
unleasherator>   2023-05-31T11:26:13Z   ERROR   controller-runtime.test-env     unable to start the controlplane        {"tries": 4, "error": "timeout waiting for process kube-apiserver to start successfully (it may have failed to start, or stopped unexpectedly before becoming ready)"}
unleasherator>   sigs.k8s.io/controller-runtime/pkg/envtest.(*Environment).startControlPlane
unleasherator>          /build/source/vendor/sigs.k8s.io/controller-runtime/pkg/envtest/server.go:329
unleasherator>   sigs.k8s.io/controller-runtime/pkg/envtest.(*Environment).Start
unleasherator>          /build/source/vendor/sigs.k8s.io/controller-runtime/pkg/envtest/server.go:259
unleasherator>   github.com/nais/unleasherator/controllers.glob..func3
unleasherator>          /build/source/controllers/suite_test.go:60
unleasherator>   github.com/onsi/ginkgo/v2/internal.extractBodyFunction.func3
unleasherator>          /build/source/vendor/github.com/onsi/ginkgo/v2/internal/node.go:463
unleasherator>   github.com/onsi/ginkgo/v2/internal.(*Suite).runNode.func3
unleasherator>          /build/source/vendor/github.com/onsi/ginkgo/v2/internal/suite.go:863
unleasherator>   [FAILED] in [BeforeSuite] - /build/source/controllers/suite_test.go:61 @ 05/31/23 11:26:13.874
unleasherator>   << Timeline
unleasherator>
unleasherator>   [FAILED] Unexpected error:
unleasherator>       <*fmt.wrapError | 0xc0000b08a0>:
unleasherator>       unable to start control plane itself: failed to start the controlplane. retried 5 times: timeout waiting for process kube-apiserver to start successfully (it may have failed to start, or stopped unexpectedly before becoming ready)
unleasherator>       {
unleasherator>           msg: "unable to start control plane itself: failed to start the controlplane. retried 5 times: timeout waiting for process kube-apiserver to start successfully (it may have failed to start, or stopped unexpectedly before becoming ready)",
unleasherator>           err: <*fmt.wrapError | 0xc0000b0880>{
unleasherator>               msg: "failed to start the controlplane. retried 5 times: timeout waiting for process kube-apiserver to start successfully (it may have failed to start, or stopped unexpectedly before becoming ready)",
unleasherator>               err: <*errors.errorString | 0xc00026efa0>{
unleasherator>                   s: "timeout waiting for process kube-apiserver to start successfully (it may have failed to start, or stopped unexpectedly before becoming ready)",
unleasherator>               },
unleasherator>           },
unleasherator>       }
unleasherator>   occurred
unleasherator>   In [BeforeSuite] at: /build/source/controllers/suite_test.go:61 @ 05/31/23 11:26:13.874
unleasherator> ------------------------------
unleasherator>
unleasherator> Summarizing 1 Failure:
unleasherator>   [FAIL] [BeforeSuite]
unleasherator>   /build/source/controllers/suite_test.go:61
unleasherator>
unleasherator> Ran 0 of 8 Specs in 3.875 seconds
unleasherator> FAIL! -- A BeforeSuite node failed so all tests were skipped.
unleasherator> --- FAIL: TestAPIs (3.88s)
unleasherator> FAIL
unleasherator> FAIL     github.com/nais/unleasherator/controllers       3.885s
unleasherator> FAIL
error: builder for '/nix/store/nm3gb0q09708fpc3bpmnr7mh1b13jq32-unleasherator.drv' failed with exit code 1;
       last 10 log lines:
       > Summarizing 1 Failure:
       >   [FAIL] [BeforeSuite]
       >   /build/source/controllers/suite_test.go:61
       >
       > Ran 0 of 8 Specs in 3.875 seconds
       > FAIL! -- A BeforeSuite node failed so all tests were skipped.
       > --- FAIL: TestAPIs (3.88s)
       > FAIL
       > FAIL   github.com/nais/unleasherator/controllers       3.885s
       > FAIL
       For full logs, run 'nix log /nix/store/nm3gb0q09708fpc3bpmnr7mh1b13jq32-unleasherator.drv'.
error: 1 dependencies of derivation '/nix/store/hhiczsms1mvpzgkdriw687s3ji7qkpxa-unleasherator-base.json.drv' failed to build
error: 1 dependencies of derivation '/nix/store/831yjw37pn847g087pjxqzlspdyvbv89-unleasherator-customisation-layer.drv' failed to build
error: 1 dependencies of derivation '/nix/store/bp0f0jv8yddbc50nf45nxavscnrghlb1-unleasherator-conf.json.drv' failed to build
error: 1 dependencies of derivation '/nix/store/yig8q1ka37gmiw66biwbvm9vrpb41rw6-stream-unleasherator.drv' failed to build
error: 1 dependencies of derivation '/nix/store/v1vgqjws61frw51lzfhrw6raxps87vdx-unleasherator.tar.gz.drv' failed to build
┏━ Dependency Graph:
┃    ┌─ ↓︎ ✔︎ make-shell-wrapper-hook
┃    │        ┌─ ↓︎ ✔︎ libedit-20221030-3.1
┃    │     ┌─ ↓︎ ✔︎ dash-0.5.12
┃    │     │  ┌─ ↓︎ ✔︎ python3.10-mccabe-0.7.0
┃    │     │  ├─ ↓︎ ✔︎ python3.10-pycodestyle-2.10.0
┃    │     │  ├─ ↓︎ ✔︎ python3.10-pyflakes-3.0.1
┃    │     ├─ ↓︎ ✔︎ python3.10-flake8-6.0.0
┃    │  ┌─ ✔︎ pythoncheck.sh
┃    ├─ ✔︎ stream
┃    │     ┌─ ↓︎ ✔︎ oniguruma-6.9.8
┃    │  ┌─ ↓︎ ✔︎ jq-1.6
┃    │  │     ┌─ ⏳︎ unleasherator-base.json waiting for 1 ⚠︎
┃    │  │  ┌─ ⏳︎ closure
┃    │  ├─ ⏳︎ closure-paths
┃    │  │  ┌─ ↓︎ ✔︎ lndir-1.0.4
┃    │  │  │  ┌─ ↓︎ ✔︎ getopt-1.1.6
┃    │  │  ├─ ↓︎ ✔︎ fakeroot-1.29
┃    │  │  ├─ ⚠︎ unleasherator failed with exit code 1 after ⏱︎ 36s in checkPhase
┃    │  ├─ ⏳︎ unleasherator-customisation-layer
┃    ├─ ⏳︎ unleasherator-conf.json
┃ ┌─ ⏳︎ stream-unleasherator
┃ ⏳︎ unleasherator.tar.gz
┣━━━ Builds           │ Downloads         │ Host
┃        │ ✔︎ 2 │      │     │      │      │ localhost
┃        │     │      │     │ ↓︎ 16 │      │ https://cache.nixos.org
┗━ ∑︎ ⏵︎ 0 │ ✔︎ 2 │ ⏳︎ 7 │ ↓︎ 0 │ ↓︎ 16 │ ⏳︎ 0 │ ⚠︎ Exited after 1 build failures at 13:26:14 after 38s

Copy link
Member

@Starefossen Starefossen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deploy missing from github workflow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants