Skip to content

Commit

Permalink
fix errors
Browse files Browse the repository at this point in the history
Signed-off-by: lorenzo farnararo <[email protected]>
  • Loading branch information
baldarn committed Aug 23, 2024
1 parent 6852a85 commit c1d3dad
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 50 deletions.
16 changes: 6 additions & 10 deletions make/harbor.yml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -319,14 +319,10 @@ cache:
# Use this section to customize the Look and Feel of your Harbor instance
# see https://goharbor.io/docs/latest/build-customize-contribute/customize-look-feel/
# look_and_feel:
# header_bg_color:
# dark_mode:
# light_mode:
# login_bg_img_base_path:
# login_bg_img_file:
# header_bg_color_dark_mode:
# header_bg_color_light_mode:
# login_bg_img:
# login_title:
# product:
# logo_base_path:
# logo_file:
# name:
# introduction:
# product_logo:
# product_name:
# product_introduction:
15 changes: 10 additions & 5 deletions make/photon/prepare/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
ARG harbor_base_image_version
ARG harbor_base_namespace
FROM ${harbor_base_namespace}/harbor-prepare-base:${harbor_base_image_version}
FROM photon:5.0

RUN tdnf install -y python3 python3-pip python3-PyYAML python3-jinja2 && tdnf clean all
RUN pip3 install pipenv==2022.1.8

#To install only htpasswd binary from photon package httpd
RUN tdnf install -y rpm cpio apr-util
RUN tdnf -y --downloadonly --downloaddir=/tmp/ install httpd && rpm2cpio /tmp/httpd-*.rpm | cpio -ivdm ./usr/bin/htpasswd && rm -f /tmp/*

ENV LANG en_US.UTF-8

WORKDIR /usr/src/app

RUN mkdir -p /harbor_make

COPY make/photon/prepare/Pipfile.lock make/photon/prepare/Pipfile /usr/src/app/
COPY Pipfile.lock Pipfile /usr/src/app/
RUN set -ex && pipenv install --deploy --system
COPY make/photon/prepare /usr/src/app
COPY . /usr/src/app

ENTRYPOINT [ "python3", "main.py" ]

Expand Down
16 changes: 6 additions & 10 deletions make/photon/prepare/migrations/version_2_12_0/harbor.yml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -740,14 +740,10 @@ core:
# Use this section to customize the Look and Feel of your Harbour instance
# see https://goharbor.io/docs/latest/build-customize-contribute/customize-look-feel/
# look_and_feel:
# header_bg_color:
# dark_mode:
# light_mode:
# login_bg_img_base_path:
# login_bg_img_file:
# header_bg_color_dark_mode:
# header_bg_color_light_mode:
# login_bg_img
# login_title:
# product:
# logo_base_path:
# logo_file:
# name:
# introduction:
# product_logo:
# product_name:
# product_introduction:
Original file line number Diff line number Diff line change
Expand Up @@ -210,15 +210,15 @@ services:
- type: bind
source: ./common/config/portal/setting.json
target: /usr/share/nginx/html/setting.json
{% if look_and_feel.logo_base_path and look_and_feel.logo_file %}
{% if look_and_feel.product_logo %}
- type: bind
source: {{look_and_feel.logo_base_path}}/{{look_and_feel.logo_file}}
target: /usr/share/nginx/html/images/{{look_and_feel.logo_file}}
source: {{look_and_feel.product_logo}}
target: /usr/share/nginx/html/images/{{look_and_feel.product_logo.split("/")[-1]}}
{% endif %}
{% if look_and_feel.login_bg_img_base_path and look_and_feel.login_bg_img_file %}
{% if look_and_feel.login_bg_img %}
- type: bind
source: {{look_and_feel.login_bg_img_base_path}}/{{look_and_feel.login_bg_img_file}}
target: /usr/share/nginx/html/images/{{look_and_feel.login_bg_img_file}}
source: {{look_and_feel.login_bg_img}}
target: /usr/share/nginx/html/images/{{look_and_feel.login_bg_img.split("/")[-1]}}
{% endif %}
{% if internal_tls.enabled %}
- type: bind
Expand Down
13 changes: 0 additions & 13 deletions make/photon/prepare/templates/portal/config.json.jinja

This file was deleted.

13 changes: 13 additions & 0 deletions make/photon/prepare/templates/portal/setting.json.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"headerBgColor": {
"darkMode": "{{look_and_feel.header_bg_color_dark_mode or ''}}",
"lightMode": "{{look_and_feel.header_bg_color_light_mode or ''}}"
},
"loginBgImg": "{{look_and_feel.login_bg_img or ''}}",
"loginTitle": "{{look_and_feel.login_title or ''}}",
"product": {
"name": "{{look_and_feel.product_name or ''}}",
"logo": "{{look_and_feel.product_logo or ''}}",
"introduction": "{{look_and_feel.product_introduction or ''}}"
}
}
2 changes: 1 addition & 1 deletion make/photon/prepare/utils/configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ def parse_yaml_config(config_file_path, with_trivy):
config_dict['core'] = Core(core_config or {})

# look and feel configs
config_dict['look_and_feel'] = configs.get('look_and_feel')
config_dict['look_and_feel'] = configs.get('look_and_feel') or {}

return config_dict

Expand Down
3 changes: 3 additions & 0 deletions make/photon/prepare/utils/docker_compose.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,7 @@ def prepare_docker_compose(configs, with_trivy):
if metric:
rendering_variables['metric'] = metric

# look and feel
rendering_variables['look_and_feel'] = configs['look_and_feel']

render_jinja(docker_compose_template_path, docker_compose_yml_path, mode=0o644, **rendering_variables)
11 changes: 6 additions & 5 deletions make/photon/prepare/utils/portal.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ def prepare_portal(config_dict):
)

# Render Portal setting config
render_jinja(
str(portal_conf_setting_template_path),
portal_conf_setting,
look_and_feel=config_dict['look_and_feel']
)
if config_dict['look_and_feel']:
render_jinja(
str(portal_conf_setting_template_path),
portal_conf_setting,
look_and_feel=config_dict['look_and_feel']
)

0 comments on commit c1d3dad

Please sign in to comment.