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

PSCE-302 feat: adds a task to sync third party content to a local trestle workspace #137

Merged
merged 6 commits into from
Jan 11, 2024

Conversation

jpower432
Copy link
Member

@jpower432 jpower432 commented Jan 5, 2024

Description

A SyncUpstreams Task to sync third party content/artifact dependencies in a trestle workspace to a local trestle workspace.

Review Hints

Recommended to review each commit separately.
The first two commits have preparatory changes to reduce technical debt/code duplication that would be proliferated by this feature.

Rationale

We need automation that will keep our third party content update to date that works across CI providers. We have a bash script currently performing this in one location.

This is a basic implementation for a "trestle aware" copy from upstream repository.

For future iterations, the goal is to start simple and built a task that can extend to different types of sources (i.e. release artifacts) and more selective copy options (e.g. using resolvers in trestle for dependency resolution).

Type of change

  • New feature (non-breaking change which adds functionality)

How has this been tested?

  • Unit tests added

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

…ot is valid

AuthoredObjects need to exists in valid trestle workspace. Handling the
case that the working directory is not initialized with trestle.

Signed-off-by: Jennifer Power <[email protected]>
Reduces code duplication in the end to end tests and any test that
has git and trestle checks

Signed-off-by: Jennifer Power <[email protected]>
The adds one source type, git-managed, and copies models in
the supported trestle model list (e.g. catalogs, profiles) from a
git repository to a local trestle workspace.

Signed-off-by: Jennifer Power <[email protected]>
@jpower432 jpower432 marked this pull request as ready for review January 8, 2024 19:29
@jpower432
Copy link
Member Author

@JimFuller-RedHat PTAL

validator,
)
logger.info(f"Successfully copied from {source}")
finally:
Copy link

@JimFuller-RedHat JimFuller-RedHat Jan 9, 2024

Choose a reason for hiding this comment

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

There might be a good reason not to handle any specific exceptions here ... though maybe a log.info here could give a hint if this function is ever called elsewhere.

Copy link
Member Author

@jpower432 jpower432 Jan 9, 2024

Choose a reason for hiding this comment

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

I didn't consider the potential for this to be called elsewhere. I think you are right. It would probably be better to handle the exceptions here and make execute() a bit simpler.

)
self.sources = git_sources
self.validate = validate
super().__init__(working_dir, model_filter)

Choose a reason for hiding this comment

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

curious if model_filter has any applicability in execute()

Copy link
Member Author

@jpower432 jpower432 Jan 9, 2024

Choose a reason for hiding this comment

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

Good question. Since all tasks are used for workspace maintenance operations, the model_filter is used in a concrete method on the TaskBase class that allows certain models to be skipped based on criteria (at the moment it just based on filepaths). In this task, it is called in copy_validate_models to allow certain paths to be skipped in the the clone repo during the copying process.

Copy link

@JimFuller-RedHat JimFuller-RedHat left a comment

Choose a reason for hiding this comment

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

apart from minor questions, LGTM

It makes sense to move the exception handling closer to
where the exceptions are being thrown and allows this method
called in other places.

Signed-off-by: Jennifer Power <[email protected]>
@jpower432 jpower432 added this to the 0.6.0 milestone Jan 10, 2024
Copy link
Contributor

@beatrizmcouto beatrizmcouto left a comment

Choose a reason for hiding this comment

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

LGTM, reviewed trestlebot/tasks/sync_upstreams_task.py in more detail during paired code review session today

@jpower432 jpower432 enabled auto-merge (squash) January 11, 2024 16:51
@jpower432 jpower432 merged commit ebf003d into main Jan 11, 2024
16 checks passed
@jpower432 jpower432 deleted the PSCE-302 branch January 12, 2024 21:05
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.

3 participants