ml-tooling / contaxy

MIT License
10 stars 8 forks source link

Allow usage of default environment variables in service/job template mappings. #26

Closed JNKielmann closed 2 years ago

JNKielmann commented 2 years ago

There are some environment variables that are automatically set for a new service. For example the CONTAXY_DEPLOYMENT_NAME environment variable which contains the name of the docker container/pod of the service. However, sometimes these values need to be set with a different variable name because the service image can not be adjusted. An example is the ml-workspace image. It requires the SSH_JUMPHOST_TARGET variable to be set to the hostname of the service. This is exactly the value of the CONTAXY_DEPLOYMENT_NAMEvariable. With the changes in this PR, it is possible to use any default environment variable in the service template syntax:

workspace_service_config = ServiceInput(
    container_image="mltooling/ml-workspace",
    parameters={
        "SSH_JUMPHOST_TARGET": "{env.CONTAXY_DEPLOYMENT_NAME}",
    },

This way the workspace image does not need to be modified.

JNKielmann commented 2 years ago

Failing build pipeline should be fixed by https://github.com/ml-tooling/universal-build/commit/9a99c8960e61864c697b70f2d41efd50accb691e#diff-c48d3fb06eca0ef614292237af85a5cae9123b5e53731a11c19df2b7c06f69c5 Waiting for new base image to be pushed.

lukasmasuch commented 2 years ago

LGTM, awesome :) I'm working on the universal build fix, a recent pipenv update with some bugs caused a bit of trouble :(