Skip to content

Commit

Permalink
add prepare migration script for 2.11.0
Browse files Browse the repository at this point in the history
Signed-off-by: yminer <yminer@vmware.com>
  • Loading branch information
MinerYang committed Apr 22, 2024
1 parent d759429 commit c5ba45b
Show file tree
Hide file tree
Showing 5 changed files with 761 additions and 3 deletions.
2 changes: 1 addition & 1 deletion make/harbor.yml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ log:
# port: 5140

#This attribute is for migrator to detect the version of the .cfg file, DO NOT MODIFY!
_version: 2.10.0
_version: 2.11.0

# Uncomment external_database if using external database.
# external_database:
Expand Down
2 changes: 1 addition & 1 deletion make/photon/prepare/commands/migrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
@click.command()
@click.option('-i', '--input', 'input_', required=True, help="The path of original config file")
@click.option('-o', '--output', default='', help="the path of output config file")
@click.option('-t', '--target', default='2.10.0', help="target version of input path")
@click.option('-t', '--target', default='2.11.0', help="target version of input path")
def migrate(input_, output, target):
"""
migrate command will migrate config file style to specific version
Expand Down
2 changes: 1 addition & 1 deletion make/photon/prepare/migrations/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

MIGRATION_BASE_DIR = os.path.dirname(__file__)

accept_versions = {'1.9.0', '1.10.0', '2.0.0', '2.1.0', '2.2.0', '2.3.0', '2.4.0', '2.5.0', '2.6.0', '2.7.0', '2.8.0', '2.9.0','2.10.0'}
accept_versions = {'1.9.0', '1.10.0', '2.0.0', '2.1.0', '2.2.0', '2.3.0', '2.4.0', '2.5.0', '2.6.0', '2.7.0', '2.8.0', '2.9.0','2.10.0', '2.11.0'}
21 changes: 21 additions & 0 deletions make/photon/prepare/migrations/version_2_11_0/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import os
from jinja2 import Environment, FileSystemLoader, StrictUndefined, select_autoescape
from utils.migration import read_conf

revision = '2.11.0'
down_revisions = ['2.10.0']

def migrate(input_cfg, output_cfg):
current_dir = os.path.dirname(__file__)
tpl = Environment(
loader=FileSystemLoader(current_dir),
undefined=StrictUndefined,
trim_blocks=True,
lstrip_blocks=True,
autoescape = select_autoescape()
).get_template('harbor.yml.jinja')

config_dict = read_conf(input_cfg)

with open(output_cfg, 'w') as f:
f.write(tpl.render(**config_dict))
Loading

0 comments on commit c5ba45b

Please sign in to comment.