Addressing upstream and downstream packages in Git repos in Porch #917
Unanswered
liamfallon
asked this question in
Development
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
The aim of this discussion is to
How Porch works now
Porch uses the concepts of Repository, Package, and PackageRevision to wrangle packages and their contents in a given namespace.
Repository
A Porch repository is NOT equivalent to a Git repository, see the Repository API definiton. A Porch Repository is a reference to a branch and directory in a git repository.
To fully dereference a Porch repository in a namespace, you must specify:
Package
The concept of a package is a weak concept in Porch, see the Package API definition. Porch does not support API calls on Package resources and internally Porch uses filtering to do package-oriented checks.
The PackageName (key) of a Package is of the form repository-name.[directory-path-in-repo-]package-name.workspace-name
There is no support for defeferencing packages in Porch
PackageRevision
The concept of a PackageRevision is the most important nad fundamental concept in Porch, see the PackageRevision API definition. Package Revisions are the entities that Porch manipulates to deliver its use cases.
To fully dereference a Porch PackageRevision in a namespace, you must specify:
The Name (key) of a PackageRevision is of the form repository-name.package-name.workspace-name
WorkspaceName on PackageRevision
A WorkspaceName is the unique identifier of a PackageRevision within a package. It is assigned at package init/clone time and can be any string that is compliant with DNS name conventions. This means that
Examples:
Revision on PackageRevision
A Revision on a PackageRevision identifies the order of publishing on published package revisions. When a PackageRevision is published, it is assigned a Revision one higher than the highest existing revision.
The following rules apply:
Note:
The following listing shows some legal but strongly discouraged examples:
The placholder PackageRevision
The placeholder PackageRevision is a dummy PackageRevision reference that points at the latest PackageRevision of a package.
The placeholder PackageRevision is created by Porch when the first PackageRevision on a package is created and is updated (actually deleted and recreated) each time a new PackageRevision is published on a package.
The following rules apply
Discussion Point Is there a better way of finding the latest package revision than using these placeholder package revisions?
Reading PackageRevision instances from git
When Porch starts, it reads the existing PackageRevision instances from the Porch repositories defined in Repository resources. Porch runs a periodic job that checks for updates on repositories and refreshes the PackageRevision instances if any changes are detected.
Porch uses the following approach:
Iterate over the specified branch of each repository and walks the repository tree from the root down each subdirectory
a. the subdirectory contains a file called "KptFile"
__i. Create a PackageRevision with the name repo-name.[directory-path-to-this-subdirectory-]subdirectory-name.branch-name
__ii. The WorkspaceName of the PackageRevision is set to the branch name of the porch repository.
__iii. Exit from this subdirectory to the next highest level
b. The subdirectory does not contain a file called "KptFile"
__i. Continue searching subdirectories of this subdirectory (go to a. above)
Iterate over all tags in the Porch repository that match a path in the repository on that tag, tag is of the form path-to-directory-containing-package-revision/version
a. There is a "kptFile" at the "path-to-directory-containing-package-revision" location in the Porch repository
__i. Create a PackageRevision with the name repo-name.path-to-directory-containing-package-revision.version
__ii. The WorkspaceName of the PackageRevision is set to the version of the tag.
__iii. If the version is of the form vx, set the Revision of the PackageRevision to the value of x
__iiv. Continue to next tag
b. Report a warning and continue to next tag
Consider the Porch Catalog git repository
It has the branches "main", "v4", and "v3".
The package "oai-ran-operator" has the following tags:
Consider the three Porch repositories defined below:
Porch discovers the following PackageRevision instances for the "oai-ran-operator" package"
Writing PackageRevision instances to git
How Porch should work
All reactions