EOX GitLab Instance

Skip to content
Snippets Groups Projects
Commit 5041428b authored by Bernhard Mallinger's avatar Bernhard Mallinger
Browse files

Generate docker image versions from vs-deployment

parent b4c28990
No related branches found
No related tags found
1 merge request!1Remove base and logging conf from vs-starter
Pipeline #20621 passed
......@@ -12,6 +12,7 @@ def render_config(
) -> None:
# get helm data
configmaps = get_helm_data(helm_config_path, file_type="configmap")
deployments = get_helm_data(helm_config_path, file_type="deployment")
env = get_helm_data(helm_config_path, file_type="deployment", index=True)
# extract envs
......@@ -19,6 +20,10 @@ def render_config(
# merge envs and params
merged_params = {**params, **envs}
merged_params["docker_image_versions"] = dict(
yaml_open(d)["spec"]["template"]["spec"]["containers"][0]["image"].split(":")
for d in deployments
)
# prepare the configs
mapping = prepare_configs(configmaps)
......@@ -65,8 +70,7 @@ def get_helm_data(helm_config_path: str, file_type: str, index: bool = False) ->
def prepare_configs(configmaps: List[str]) -> Dict[str, str]:
file_config_mapping = {}
for configmap in configmaps:
with open(configmap, "r", encoding="utf-8") as cfg:
config = yaml.load(cfg, Loader=yaml.SafeLoader)
config = yaml_open(configmap)
config = config["data"]
if config:
file_name = list(config.keys())[0]
......@@ -127,10 +131,14 @@ def render_templates(destination: str, params: Dict[str, str]) -> None:
def extract_env_vars(env: str) -> Dict[str, str]:
envs = {}
with open(env, "r", encoding="utf-8") as cfg:
config = yaml.load(cfg, Loader=yaml.SafeLoader)
env_vars = config["spec"]["template"]["spec"]["containers"][0]["env"]
for var in env_vars:
envs[var["name"]] = var["value"]
config = yaml_open(env)
env_vars = config["spec"]["template"]["spec"]["containers"][0]["env"]
for var in env_vars:
envs[var["name"]] = var["value"]
return envs
def yaml_open(path: str) -> Any:
with open(path, "r", encoding="utf-8") as f:
return yaml.safe_load(f)
......@@ -9,7 +9,7 @@ services:
tmpfs:
size: 536870912
renderer:
image: registry.gitlab.eox.at/esa/prism/vs/pvs_core{{release_version}} # bumpversion
image: registry.gitlab.eox.at/vs/core:{{ docker_image_versions['registry.gitlab.eox.at/vs/core'] }}
environment:
INSTALL_DIR: "/var/www/pvs/ops/"
INSTANCE_DIR: "/var/www/pvs/ops/pvs_instance/"
......@@ -87,7 +87,7 @@ services:
networks:
- extnet
cache:
image: registry.gitlab.eox.at/esa/prism/vs/pvs_cache{{release_version}} # bumpversion
image: registry.gitlab.eox.at/esa/vs/cache:{{ docker_image_versions['registry.gitlab.eox.at/vs/cache'] }}
configs:
- source: mapcache-ops
target: /mapcache-template.xml
......@@ -169,7 +169,7 @@ services:
networks:
- extnet
registrar:
image: registry.gitlab.eox.at/esa/prism/vs/pvs_core{{release_version}} # bumpversion
image: registry.gitlab.eox.at/vs/core:{{ docker_image_versions['registry.gitlab.eox.at/vs/core'] }}
environment:
INSTALL_DIR: "/var/www/pvs/ops/"
INSTANCE_DIR: "/var/www/pvs/ops/pvs_instance/"
......@@ -181,7 +181,7 @@ services:
placement:
constraints: [node.role == manager]
ingestor:
image: registry.gitlab.eox.at/esa/prism/vs/pvs_ingestor{{release_version}} # bumpversion
image: registry.gitlab.eox.at/vs/ingestor:{{ docker_image_versions['registry.gitlab.eox.at/vs/ingestor'] }}
environment:
REDIS_PREPROCESS_MD_QUEUE_KEY: "preprocess_queue"
INOTIFY_MASKS: "IN_MOVED_TO"
......@@ -189,7 +189,7 @@ services:
placement:
constraints: [node.role == manager]
sftp:
image: registry.gitlab.eox.at/esa/prism/vs/pvs_sftp{{release_version}} # bumpversion
image: registry.gitlab.eox.at/esa/prism/vs/pvs_sftp:release-2.0.0
deploy:
placement:
constraints: [node.role == manager]
......@@ -201,7 +201,7 @@ services:
target: /etc/ssh/ssh_host_ed25519_key
mode: 0600
client:
image: registry.gitlab.eox.at/esa/prism/vs/pvs_client{{release_version}} # bumpversion
image: registry.gitlab.eox.at/vs/client:{{ docker_image_versions['registry.gitlab.eox.at/vs/client'] }}
configs:
- source: client-ops
target: /usr/share/nginx/html/index.html
......@@ -242,7 +242,7 @@ services:
networks:
- extnet
preprocessor:
image: registry.gitlab.eox.at/esa/prism/vs/pvs_preprocessor{{release_version}} # bumpversion
image: registry.gitlab.eox.at/vs/preprocessor:{{ docker_image_versions['registry.gitlab.eox.at/vs/preprocessor'] }}
volumes:
- type: bind
source: /var/vhr
......@@ -259,7 +259,7 @@ services:
- node.labels.type == internal
{%- endif %}
shibauth-{{slug}}:
image: registry.gitlab.eox.at/esa/prism/vs/pvs_shibauth{{release_version}} # bumpversion
image: registry.gitlab.eox.at/esa/prism/vs/pvs_shibauth:release-2.0.0
environment:
APACHE_SERVERNAME: "https://sso.{{slug}}.pass.copernicus.eu:443"
USER_CATEGORY_ALLOW_RENDERER: "{{shibauth_renderer}}"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment