Age | Commit message (Collapse) | Author |
|
Upgrade to the latest versions of git2go and libgit2.
Changelog: changed
|
|
ref: Return structured error when update error is not ErrAlreadyLocked
Closes #4497
See merge request https://gitlab.com/gitlab-org/gitaly/-/merge_requests/4897
Merged-by: Justin Tobler <jtobler@gitlab.com>
Approved-by: Patrick Steinhardt <psteinhardt@gitlab.com>
Approved-by: Justin Tobler <jtobler@gitlab.com>
Co-authored-by: John Cai <jcai@gitlab.com>
|
|
We have a bug wherein we still return a successful response with an
error embedded in the response if the Prepare() step fails with an error
but the error is not an ErrAlreadyLocked. Fix the code such that we
return an error instead of a response when there is a non
ErrAlreadyLocked error during the Prepare() call.
Changelog: fixed
|
|
Revert "Merge branch 'jc-spawn-git-in-pgid' into 'master'"
See merge request https://gitlab.com/gitlab-org/gitaly/-/merge_requests/4908
Merged-by: Toon Claes <toon@gitlab.com>
Approved-by: Toon Claes <toon@gitlab.com>
Co-authored-by: John Cai <jcai@gitlab.com>
|
|
This reverts merge request !4889
|
|
command: Add option to spawn a command with a pgid
Closes #4493
See merge request https://gitlab.com/gitlab-org/gitaly/-/merge_requests/4889
Merged-by: karthik nayak <knayak@gitlab.com>
Approved-by: Justin Tobler <jtobler@gitlab.com>
Co-authored-by: John Cai <jcai@gitlab.com>
|
|
linguist: Support linguist overrides in .gitattributes
Closes #4451
See merge request https://gitlab.com/gitlab-org/gitaly/-/merge_requests/4877
Merged-by: James Fargher <proglottis@gmail.com>
Approved-by: Pavlo Strokov <pstrokov@gitlab.com>
Approved-by: James Fargher <proglottis@gmail.com>
Co-authored-by: Toon Claes <toon@gitlab.com>
|
|
We want all git commands to be tied to a pgid, the gitaly process. This
way, when gitaly gets killed, all git processes can be killed alongside it,
in case there are any zombie processes hanging around.
Add a gitalyPid option to the NewExecCommandFactory() constructor, and
update the callsites with the option.
Changelog: changed
|
|
Processes can be spawned with pgid [1], which can then be used to kill a
process and all child processes that were spawned with that pid as a pgid.
This allows us to, in a later commit, tie all Git commands to the
main Gitaly process. When a Gitaly process exits, a sys admin, a script,
or Gitlab Omnibus can do a `kill -9 -<old gitaly pid>` to kill any process
that has <old gitaly pid> as its pgid.
Add an option to allow commands to be instantiated with a parent pid.
1. https://pkg.go.dev/syscall#SysProcAttr
|
|
[ci skip]
|
|
golangci-lint: Restore default revive lints
See merge request https://gitlab.com/gitlab-org/gitaly/-/merge_requests/4903
Merged-by: karthik nayak <knayak@gitlab.com>
Approved-by: Patrick Steinhardt <psteinhardt@gitlab.com>
Approved-by: karthik nayak <knayak@gitlab.com>
Co-authored-by: Will Chandler <wchandler@gitlab.com>
|
|
Trim secret before signing JWT tokens
See merge request https://gitlab.com/gitlab-org/gitaly/-/merge_requests/4898
Merged-by: Patrick Steinhardt <psteinhardt@gitlab.com>
Approved-by: Pavlo Strokov <pstrokov@gitlab.com>
Approved-by: Patrick Steinhardt <psteinhardt@gitlab.com>
Co-authored-by: Igor Drozdov <idrozdov@gitlab.com>
|
|
helper: Preserve status code of underlying error
See merge request https://gitlab.com/gitlab-org/gitaly/-/merge_requests/4895
Merged-by: James Fargher <proglottis@gmail.com>
Approved-by: Justin Tobler <jtobler@gitlab.com>
Approved-by: James Fargher <proglottis@gmail.com>
Co-authored-by: Pavlo Strokov <pstrokov@gitlab.com>
|
|
repository: Small fixes in FindLicense handling
See merge request https://gitlab.com/gitlab-org/gitaly/-/merge_requests/4851
Merged-by: Justin Tobler <jtobler@gitlab.com>
Approved-by: Pavlo Strokov <pstrokov@gitlab.com>
Approved-by: Justin Tobler <jtobler@gitlab.com>
Co-authored-by: Toon Claes <toon@gitlab.com>
|
|
go: Update github.com/ProtonMail/go-crypto digest to c6815a8
See merge request https://gitlab.com/gitlab-org/gitaly/-/merge_requests/4904
Merged-by: Will Chandler <wchandler@gitlab.com>
Approved-by: James Fargher <proglottis@gmail.com>
Approved-by: Will Chandler <wchandler@gitlab.com>
Co-authored-by: GitLab Renovate Bot <gitlab-bot@gitlab.com>
|
|
We've implemented a bunch of fixes to the language calculation. To
ensure we recalculate repositories using these new rules, bump up the
version in the cache file.
|
|
When the user has modified .gitattributes since last time the stats
where calculated, the numbers might be completely different for files
that aren't modified. To overcome any miscalculation in this case, just
do a full recalculation when .gitattributes was modified.
|
|
The functionality of newLanguageStats() was a bit overloaded. Split it
up and stop returning pointers.
|
|
Users can override [1] the linguist behavior by writing things in
gitattributes(5). This change copies that behavior into the go
implementation.
[1]: https://github.com/github/linguist/blob/master/docs/overrides.md
|
|
Files that are either documentation, vendored, or generated should be
excluded from the stats.
|
|
In 5da3e9a23 (gitpipe: Add LsTree that calls git-ls-tree(1), 2022-06-14)
we've added a skipResult function to the gitpipe.lsTreeConfig, but there
was no way to actually use that feature outside the gitpipe package.
This change adds LsTreeWithSkip() so a user of LsTree() can specify a
skip function, similar to DiffTreeWithSkip().
|
|
As an extra step to prep for more features, this change moves the
determining the language of a single file into a separate file and
struct.
|
|
We're about to make to override language statistics using
gitattributes(5). This change would make the inner loop for handling
each file a lot more complex.
To prepare for this added complexity, refactor the code so it's easier
to extend.
|
|
To make it easier to split out code in smaller functions, move some
variables we need to the linguist.Instance struct. This will allow
future refactoring.
|
|
Now linguist no longer loads colors when it's created, there's no more
need to create an instance when Gitaly is started. So remove linguist as
a dependency.
|
|
Now we're no longer loading language colors from a json file, it also
does not make sense to make the path of this json file configurable. So
remove it from the config.
|
|
We're about to go all-in on go-enry for the language detection. Which
means we'll soon no longer can load the language colors from a json file
provided by the linguist gem. We could copy the file, but go-enry
provides colors as well. So use those instead.
This also made it possible so turn the Color() function into a normal
function, instead of a receiver function.
This has a little disadvantage: it's no longer possible to load a custom
set of colors. We believe this isn't used, so we're willing to give up
on that.
|
|
To have a little bit of insurance the colors on the languages don't
change at random, test a handful of languages and their color.
|
|
The linguist Instance does not use the git.CommandFactory variable, so
we can safely remove it.
|
|
The nickname is used as primary source for the text in the license badge
in the UI. Using "LICENSE" is a lot more informative than "Other"
|
|
The URL used by the "Other" license gives a 404, so remove it.
|
|
With 7e87131ed (golangci-lint: Allow `testing.T` as first parameter,
2022-08-10) we set `context-as-argument` the sole argument to
`revive:rules`. This causes golangci-lint to disable all revive lints
that were previously enabled by default.
Re-enable the default revive lints by explicitly listing them in our
config. This triggers a large number of lint errors, resolve these as
well in this commit.
|
|
With this change we don't rely on the secret to either contain
a newline or not contain it.
Changelog: fixed
|
|
|
|
Refactor remaining users of the ioutil package
See merge request https://gitlab.com/gitlab-org/gitaly/-/merge_requests/4899
Merged-by: Sami Hiltunen <shiltunen@gitlab.com>
Approved-by: James Fargher <proglottis@gmail.com>
Co-authored-by: Patrick Steinhardt <psteinhardt@gitlab.com>
|
|
|
|
Go 1.15 has deprecated the `ioutil` package and made replacements
available in the `io` or `os` packages. While we have already migrated
most callsites away, one notable omission was `ioutil.ReadDir()` as this
function doesn't have an exact replacement: the new `os.ReadDir()`
function does not stat all directory entries anymore.
Refactor the cleanup of stale cached files in the `cache` package to use
the new function.
|
|
Go 1.15 has deprecated the `ioutil` package and made replacements
available in the `io` or `os` packages. While we have already migrated
most callsites away, one notable omission was `ioutil.ReadDir()` as this
function doesn't have an exact replacement: the new `os.ReadDir()`
function does not stat all directory entries anymore.
Refactor the cleanup of stale leases in the `cache` package to use the
new function.
|
|
Go 1.15 has deprecated the `ioutil` package and made replacements
available in the `io` or `os` packages. While we have already migrated
most callsites away, one notable omission was `ioutil.ReadDir()` as this
function doesn't have an exact replacement: the new `os.ReadDir()`
function does not stat all directory entries anymore.
Refactor the cleanup of stale keep-around references in the
`GarbageCollect` RPC to use the new function.
|
|
Go 1.15 has deprecated the `ioutil` package and made replacements
available in the `io` or `os` packages. While we have already migrated
most callsites away, one notable omission was `ioutil.ReadDir()` as this
function doesn't have an exact replacement: the new `os.ReadDir()`
function does not stat all directory entries anymore.
Refactor the cleanup of stale worktrees in the `housekeeping` package
to use the new function.
|
|
Go 1.15 has deprecated the `ioutil` package and made replacements
available in the `io` or `os` packages. While we have already migrated
most callsites away, one notable omission was `ioutil.ReadDir()` as this
function doesn't have an exact replacement: the new `os.ReadDir()`
function does not stat all directory entries anymore.
Refactor `stats.GetPackfiles()` to use the new function and manually
stat the packfiles at callsites as required.
|
|
Go 1.15 has deprecated the `ioutil` package and made replacements
available in the `io` or `os` packages. While we have already migrated
most callsites away, one notable omission was `ioutil.ReadDir()` as this
function doesn't have an exact replacement: the new `os.ReadDir()`
function does not stat all directory entries anymore.
Refactor the `tempdir` package's clean walker to use the new function
and manually stat the directory entries as required.
|
|
[ci skip]
|
|
[ci skip]
|
|
[ci skip]
|
|
proto: Deprecate embedded errors
See merge request https://gitlab.com/gitlab-org/gitaly/-/merge_requests/4894
Merged-by: Patrick Steinhardt <psteinhardt@gitlab.com>
Approved-by: karthik nayak <knayak@gitlab.com>
Approved-by: Justin Tobler <jtobler@gitlab.com>
|
|
The variations of the Err<StatusCode>() and Err<StatusCode>f()
functions don't verify if the passed in error wraps gRPC error
already on some nested level except the upper one only.
That is why initially InvalidArgument code error could be
returned with Internal code and wrapped inside the message, so
it would look like there was another RPC method invocation.
The GrpcCode is refactored here as well, to follow the same approach.
Now it unwraps the errors and looks for the initial status most
deeply nested. If found it becomes the final for the RPC invocation
and send to the caller.
|
|
While the embedded error in the UserDeleteBranchResponse message has
been deprecated already, there is no information when the field will be
removed. Add it so we don't forget to clean it up.
|
|
The UserCherryPick RPC was converted to return structured errors instead
of embedding errors in a successful response. These embedded errors are
thus never set by Gitaly anymore and should be phased out.
Mark them as deprecated and slate them for removal in release 16.0.
Change: deprecated
|
|
The UserCreateBranch RPC was converted to return structured errors
instead of embedding errors in a successful response. These embedded
errors are thus never set by Gitaly anymore and should be phased out.
Mark them as deprecated and slate them for removal in release 16.0.
Change: deprecated
|