ocurrent / opam-repo-ci

An OCurrent pipeline for testing submissions to opam-repository
Apache License 2.0
20 stars 22 forks source link

crashes with internal error if `capnp-secrets/` directory doesn't exist #339

Open shonfeder opened 3 months ago

shonfeder commented 3 months ago
$ dune exec -- opam-repo-ci-local --confirm harmless --repo $REPO_PATH --branch $BRANCH_NAME --capnp-address tcp:127.0.0.1:5001
opam-repo-ci-local: internal error, uncaught exception:
                    Sys_error("./capnp-secrets/secret-key.pem: No such file or directory")
                    Raised by primitive operation at Stdlib.open_out_gen in file "stdlib.ml", line 331, characters 29-55
                    Called from Capnp_rpc_unix__Vat_config.write_whole_file in file "unix/vat_config.ml", line 53, characters 11-84
                    Called from Capnp_rpc_unix__Vat_config.init_secret_key_file in file "unix/vat_config.ml", line 66, characters 4-34
                    Called from CamlinternalLazy.do_force_block in file "camlinternalLazy.ml", line 49, characters 17-27
                    Re-raised at CamlinternalLazy.do_force_block in file "camlinternalLazy.ml", line 56, characters 4-11
                    Called from CamlinternalLazy.force_lazy_block in file "camlinternalLazy.ml" (inlined), line 78, characters 27-67
                    Called from Capnp_rpc_unix__Vat_config.hashed_secret in file "unix/vat_config.ml", line 38, characters 54-77
                    Called from Capnp_rpc_unix__Vat_config.derived_id in file "unix/vat_config.ml" (inlined), line 96, characters 15-30
                    Called from Dune__exe__Capnp_setup.run in file "service/capnp_setup.ml", line 20, characters 21-69
                    Called from Dune__exe__Local.setup_capnp in file "service/local.ml", line 12, characters 2-69
                    Called from Dune__exe__Local.main in file "service/local.ml", lines 41-42, characters 4-39
                    Called from Cmdliner_term.app.(fun) in file "cmdliner_term.ml", line 24, characters 19-24
                    Called from Cmdliner_term.term_result.(fun) in file "cmdliner_term.ml", line 48, characters 25-32
                    Called from Cmdliner_eval.run_parser in file "cmdliner_eval.ml", line 35, characters 37-44

I hit this running local, but I expect the same behavior would happen running the main service. IMO, the best behavior would be to create the needed directory if doesn't already exist: this will make set up and deployment simpler, but at least, it should handle the error and report the issue correctly.

(This is easy to fix, but I'm opening an issue so as not to pollute unrelated work with this fix.)

This is probably the place where the logic should be fixed: https://github.com/ocurrent/opam-repo-ci/blob/b11b27c68993bd1725e6202fe2b56a036d537610/service/capnp_setup.ml#L10-L25

mtelvers commented 3 months ago

I hit this running local, but I expect the same behavior would happen running the main service.

This is less of a concern for the main service as we are deploying with Docker. We need to persist /capnp-secrets so it will be mounted as a Docker volume. This will cause Docker to create the mount point/directory for us.