Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configuration migrations #176

Closed
wants to merge 2 commits into from
Closed

Conversation

lbarcziova
Copy link
Member

@lbarcziova lbarcziova commented Apr 12, 2023

See commit messages and help of the commands for more info

TODO:

  • test the migrate command
  • move this script somewhere else?

Copy link
Member

@jpopelka jpopelka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nicely structured, LGTM

Comment on lines +356 to +412
dir_path = os.path.join(config_dir, dir_name)

Path(dir_path).mkdir(parents=True, exist_ok=True)

file_path = os.path.join(dir_path, repo.package_config_path)
with open(file_path, "w") as config_file:
config_file.write(repo.package_config)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
dir_path = os.path.join(config_dir, dir_name)
Path(dir_path).mkdir(parents=True, exist_ok=True)
file_path = os.path.join(dir_path, repo.package_config_path)
with open(file_path, "w") as config_file:
config_file.write(repo.package_config)
dir_path = repo_store_path / dir_name
dir_path.mkdir(parents=True, exist_ok=True)
file_path = dir_path / repo.package_config_path
file_path.write_text(repo.package_config)

Comment on lines +102 to +108
url_file = os.path.join(directory, URL_FILE_NAME)
if not os.path.isfile(url_file):
return None

with open(url_file) as file:
url = file.read()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
url_file = os.path.join(directory, URL_FILE_NAME)
if not os.path.isfile(url_file):
return None
with open(url_file) as file:
url = file.read()
url_file = directory / URL_FILE_NAME
if not url_file.is_file():
return None
url = url_file.read_text()

The script provides 3 commands (see particular command's --help for more info):
1. download-configs - to download the configs of the repos that used Packit Service in the past year
2. list-affected - to list the projects affected by particular migration
3. migrate - to update the config and create PR

Related to packit#159
Related to packit/packit-service#1775
Copy link
Member

@TomasTomecek TomasTomecek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is really impressive

would be amazing to move all the code in a dedicated project: I have a sense we'll use it more in the future :)

@lbarcziova
Copy link
Member Author

lbarcziova commented Apr 25, 2023

@TomasTomecek yes, agreed, I will move it to a new dedicated repo; so now the harder part, what should be the name 😀 :

  • (automatic)-configuration-updates
  • (automatic)-configuration-migrations
  • configuration-checker
  • ?

@nforro
Copy link
Member

nforro commented Apr 25, 2023

  • (automatic)-configuration-migrations

I think this makes sense.

@lbarcziova
Copy link
Member Author

The content of this PR was moved to the new repo, therefore closing.

@lbarcziova lbarcziova closed this Apr 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants