product-os / katapult

A tool for launching environment variants on different modes and targets, based on kompose format files.
Apache License 2.0
8 stars 1 forks source link

Include schemas in build #72

Closed joshbwlng closed 3 years ago

joshbwlng commented 3 years ago

Change-type: patch Signed-off-by: Josh Bowling josh@balena.io


By including the /schemas directory in the end product, we will be able to execute katapult normally after installing with npm i and not require developers to clone -> build -> manually set alias to built code. By not including /schemas, the following error occurs:

$ npx katapult generate ...

    Error: Cannot find module '../../../../schemas/config-manifest-schema.json'
    Require stack:
    - /home/josh/git/product-os/example/node_modules/@balena/katapult/lib/lib/controllers/config-manifest/config-man

    ifest.js

    - /home/josh/git/product-os/example/node_modules/@balena/katapult/lib/commands/generate.js
    - /home/josh/git/product-os/example/node_modules/@oclif/config/lib/plugin.js
    - /home/josh/git/product-os/example/node_modules/@oclif/config/lib/config.js
    - /home/josh/git/product-os/example/node_modules/@oclif/config/lib/index.js
    - /home/josh/git/product-os/example/node_modules/@oclif/command/lib/command.js
    - /home/josh/git/product-os/example/node_modules/@oclif/command/lib/index.js
    - /home/josh/git/product-os/example/node_modules/@balena/katapult/bin/run
    Code: MODULE_NOT_FOUND
joshbwlng commented 3 years ago

@ab77 Tested with the beta package built from this branch that things work as expected. Just have a problem with the Wait for Kubernetes step in this repo's CircleCI tests. Any ideas? My changes are so minimal that I think we could safely ignore that CI step and force merge if need be.

joshbwlng commented 3 years ago

Did some digging and found that locally I get the following error when trying to start a Kubernetes cluster with the latest bsycorp/kind image:

...
kubelet: started
Error on line 46
Startup timeout, didn't become healthy after 3 mins.. details:
2021-07-28 06:47:36,421 INFO exited: start (exit status 1; not expected)

Running this command, which is ran inside of the kind image for the config-serve service, fails with the following error:

bash-5.0# /usr/local/bin/docker run --rm -v /var/kube-config/:/usr/share/nginx/html:ro -p 10080:80 nginx:1.13
/usr/local/bin/docker: Error response from daemon: cgroups: cgroup mountpoint does not exist: unknown.

This seems to help, but this would require changes to scripts baked into the bsycorp/kind image we're using:

bash-5.0# sudo mkdir /sys/fs/cgroup/systemd
bash-5.0# sudo mount -t cgroup -o none,name=systemd cgroup /sys/fs/cgroup/systemd
bash-5.0# /usr/local/bin/docker run --rm -v /var/kube-config/:/usr/share/nginx/html:ro -p 10080:80 nginx:1.13

I'm thinking we should just install and execute the kind binary?

joshbwlng commented 3 years ago

@balena-ci I self certify!

ab77 commented 3 years ago

@ab77 Tested with the beta package built from this branch that things work as expected. Just have a problem with the Wait for Kubernetes step in this repo's CircleCI tests. Any ideas? My changes are so minimal that I think we could safely ignore that CI step and force merge if need be.

@joshbwlng anything in CircleCI should actually be removed, so I would just delete .circle directory and plan to implement the tests in balenaCI, eventually.