If an intermediate tree already exists and we know this ahead of time,
we should use it without recreating it with all of its contents resolved
and written recursively. This commit adds support for such cases and
renames TreeBuilder's APIs to generalize away from accepting blob IDs
only.
Signed-off-by: Aditya Sirish <aditya@saky.in>
This commit adds a uint64 Number field to RSL entries. This allows us to
determine the ordering of distinct RSL entries, enabling optimizations
such as knowing which policy to use for an entry without always walking
the RSL.
The implementation maintains backwards compatibility, so the numbering
can start from whenever this is enabled. This is made easy by the fact
that we can guarantee gittuf is updated everywhere it is currently used.
Signed-off-by: Aditya Sirish <aditya@saky.in>
Add functions `ReorderDelegations` to handle rule reordering at backend
Add a command 'gittuf policy reorder-rules [flags]' to reorder rules
from CLI by passing a space-separated list of the rules with updated
order.
Signed-off-by: Jamal Cao <jamaltheodds@gmail.com>
The code review approval layer is now agnostic to the code review system used.
The only system supported at the moment is GitHub's pull request approvals, but
we should be able to extend this to support GitLab, Gerrit, etc.
In addition, the GitHub app key add endpoint docs have been updated to clarify
what the purpose of the key is.
Signed-off-by: Aditya Sirish A Yelgundhalli <ayelgundhall@bloomberg.net>
- Make CreateCommitObject support merge commits, with multiple parent
hashes
- Changed other files to use an array of parent hashes instead of a
single hash
- By changing the parameters for CreateCommitObject, internal/common had
errors that had to be fixed.
Signed-off-by: neilnaveen <42328488+neilnaveen@users.noreply.github.com>
This removes the sub-go.mod in favor of updating all references to the
third_party/go-git package.
This lets users `go install` from outside of the module.
Signed-off-by: Billy Lynch <billy@chainguard.dev>
Rename EntryType to Entry for a better generic term. This avoids a
collision with the actual rsl.Entry type. The old Entry type is now
named ReferenceEntry and the Annotation type is AnnotationEntry.
Signed-off-by: Aditya Sirish <aditya@saky.in>
In addition to gittuf verify-tag workflows, this commit fixes the RSL to
be more generic. An RSL entry no longer exclusively requires a commit
ID.
Signed-off-by: Aditya Sirish <aditya@saky.in>
rsl.RSLRef is now just rsl.Ref to avoid the repetition. Also,
RSLRemoteTrackerRef is no longer a constant, replaced by
rsl.RemoteTrackerRef() which returns a substituted tracker string for
the specified remote.
Signed-off-by: Aditya Sirish <aditya@saky.in>
1. Commit now returns the ID of the newly created commit. This will help
us avoid extraneous calls to repo.Reference to get the new state of
the affected ref.
2. Commit also creates the ref if it doesn't already exist. This allows
to skip initializing (to zero) refs we're about to commit to anyway.
Note: this commit does not actually remove those extra
initializations. That is left to a future patch or clean up pass.
Signed-off-by: Aditya Sirish <aditya@saky.in>
As part of this commit, some test helper code is reorganized to avoid repetition in
repository and policy.
Signed-off-by: Aditya Sirish <aditya@saky.in>
The package offered two functions: GetRepositoryHandler and
CreateTestRepository. With a series of other changes,
GetRepositoryHandler is only needed once in the repository package.
Other uses in the cmd dev subcommand will be dropped in future.
Similarly, all tests have moved to either in-memory repositories or to
using the gittuf repository itself (one instance). Therefore, this
package can now be removed.
Signed-off-by: Aditya Sirish <aditya@saky.in>
This removes several direct fs handling for namespace creation as well
as making the RSL package dependent on repo information being passed in.
This also means that several tests can move to in-memory repositories.
Signed-off-by: Aditya Sirish <aditya@saky.in>
This commit includes several plumbing changes.
* Support for trees and blobs in gitinterface
* Initialization of refs/gittuf independent of policy / RSL packages
* Initialization of policy and policy-staging namespaces
* rsl.InitializeNamespace is now only responsible for its own namespace
* Replaces some t.Error calls with t.Fatal
Signed-off-by: Aditya Sirish <aditya@saky.in>