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

Adding Artifact Repository #1380

Closed
wants to merge 3 commits into from
Closed

Adding Artifact Repository #1380

wants to merge 3 commits into from

Conversation

ttrently
Copy link
Contributor

@ttrently ttrently commented Sep 17, 2022

UPDATE: Latest commit implements an artifact repository based on discussions found on #1393

Add support for artifact_repository plugins which allow for hosting of package payloads in remote servers. This works in conjunction with a MongoDB instance that contains the package information for querying and lookup.

Requirements

This implementation requires some additional packages that have not been included in rez.vendor.

  • awscli
  • pymongo

These can be installed via python -m pip install PKG --target path\to\rez\Lib\site-packages.

How To Use

In order to use you will need an existing S3 bucket and a MongoDB instance with a named database and a collection called "packages".

In your rezconfig.py you will need to set the following:

packages_path = [
    "mongo@localhost:27017/db_name",
]

artifacts_path = [
    "s3@s3://bucket-1/packages",
]

default_cachable = True
package_cache_same_device = True
package_cache_async  = False

If your MongoDB instance also requires a username / password, you can set it via:

REZ_MONGO_USERNAME=username
REZ_MONGO_PASSWORD=password

When these are set, it will format the packages path url as:

{REZ_MONGO_USERNAME}:{REZ_MONGO_PASSWORD}@localhost:27017/db_name

rez-build

The rez-build command has been extended to allow for installing to artifact repositories. This is done through the new -a --artifact-path argument from rez-build.

Example:

foo> rez-build --install -p mongo@uri:port/db_name -a s3@s3://bucket-1/packages

This build command will do the following:

  1. Build the foo package normally
  2. Install build results to a temporary location of $TEMP\rez\package_name\package_version, this is what will be pushed to the artifact repository.
  3. Add a new variant entry to the specified mongo@ package repository
  4. Push the installed build results to the s3@ artifact repository.

Missing / To-Do

  • This uses a basic implementation of the artifact repository where they are defined separately from the package repository. On lookup, the artifact repositories are searched in order for the package payload, this seems to work well since the location stored in the database is the artifact_path qualifier, but may need to be more complex in the future.
  • Artifact repository paths need to be extended to other cli's, such as move, release, and any others that interact with repositories.
  • MongoDB authentication is still somewhat of an issue if you use multiple different databases that require different credentials.

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Sep 17, 2022

CLA Signed

The committers listed above are authorized under a signed CLA.

@JeanChristopheMorinPerso
Copy link
Member

This is pretty exciting @ttrently! I haven't reviewed any of it yet, but I took some time to link to some resources.

Long ago, someone tried to create a MongoDB repository plugin and even created a PR, see #205. You could potentially re-use part of it or at maybe just take inspirations from it.

Additionally, there is REP-003 that tracks package caching. In the REP (Rez Enhancement Proposal) and its comments, there is some wording that makes me believe the package repository could say "I need all my packages to be locally cached". This would allow to mix and match multiple package repository types without forcing all resolved packages to be cached.

@JeanChristopheMorinPerso JeanChristopheMorinPerso added the Blocked by CLA Waiting on CLA to be signed label Sep 21, 2022
@ttrently ttrently changed the title Adding S3 Package Repository support. Adding Artifact Repository Oct 8, 2022
@JeanChristopheMorinPerso
Copy link
Member

@ttrently is your latest commit implementing what you described in #1393?

@ttrently
Copy link
Contributor Author

ttrently commented Oct 8, 2022

@ttrently is your latest commit implementing what you described in #1393?

Yes, to a degree, and primary comment updated with usage information. I'm still a bit unsure of how to handle complex paths, so for this I kept it close to how normal package repositories are handled, ie. Artifact repository paths are defined and lookups happen based on the order of those paths.

@JeanChristopheMorinPerso
Copy link
Member

The new description is helpful and thanks for that. Can you update the description to mention that you implement part of that discussion, what's implemented, what's not, etc. I would also suggest that you mention which library it depends, etc.

(Note that I won't have time to review until next week).

@JeanChristopheMorinPerso JeanChristopheMorinPerso removed the Blocked by CLA Waiting on CLA to be signed label Oct 15, 2022
@JeanChristopheMorinPerso
Copy link
Member

Hey @ttrently , I'm curious if you made more progress on this work. Let us know if we can help in any way!

Pull head REZ to ttrently/rez master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement WIP work in progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants