Add env vars in build settings + alt install method

This commit is contained in:
Stéphane Bidoul 2022-01-27 23:36:50 +01:00
parent b0ee0172be
commit c3e84d1256
No known key found for this signature in database
GPG key ID: BCAB2555446B5B92
3 changed files with 19 additions and 7 deletions

View file

@ -171,9 +171,9 @@ def make_deployment_vars(
commit_info=commit_info,
image_name=image_name,
image_tag=image_tag,
build_env=settings.build_env or {},
build_secret_env=settings.build_secret_env or {},
build_template_vars=settings.build_template_vars or {},
build_env=settings.build_env | build_settings.env,
build_secret_env=settings.build_secret_env | build_settings.secret_env,
build_template_vars=settings.build_template_vars | build_settings.template_vars,
)

View file

@ -15,7 +15,15 @@ git fetch origin $RUNBOAT_GIT_REF:build
git checkout build
# Install.
INSTALL_METHOD=${INSTALL_METHOD:-oca_install_addons}
if [[ "${INSTALL_METHOD}" == "oca_install_addons" ]] ; then
oca_install_addons
elif [[ "${INSTALL_METHOD}" == "editable_pip_install" ]] ; then
pip install -e .
else
echo "Unsupported INSTALL_METHOD: '${INSTALL_METHOD}'"
exit 1
fi
# Keep a copy of the venv that we can re-use for shorter startup time.
DEBIAN_FRONTEND=noninteractive apt-get -yqq install rsync

View file

@ -7,6 +7,10 @@ from .exceptions import RepoOrBranchNotSupported
class BuildSettings(BaseModel):
image: str # container image:tag
# These extend the respective global settings.
env: dict[str, str] = {}
secret_env: dict[str, str] = {}
template_vars: dict[str, str] = {}
class RepoSettings(BaseModel):
@ -40,13 +44,13 @@ class Settings(BaseSettings):
# The wildcard domain where the builds will be reacheable.
build_domain: str
# A dictionary of environment variables to set in the build container and jobs.
build_env: dict[str, str] | None
build_env: dict[str, str] = {}
# A dictionary of secret environment variables to set in the build container and
# jobs.
build_secret_env: dict[str, str] | None
build_secret_env: dict[str, str] = {}
# A dictionary of variables to be set in the jinja rendering context for the
# kubefiles.
build_template_vars: dict[str, str] | None
build_template_vars: dict[str, str] = {}
# The token to use for the GitHub api calls (to query branches and pull requests,
# and report build statuses).
github_token: str | None