| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- When a downstream type failed to prepare a repository the loop over
lorries would abort unexpectly meaning any following lorries were
never added into the minion's queue. Such cases are now simply skipped
over so that lorry controller does not get stuck.
- Catching Exception doesn't feel nice or correct, but we don't want any
unexpected exceptions to cause the same problem of getting stuck so I
don't see any obvious alternative in the short term. Perhaps the
overall code can be reworked to avoid needing to do this.
Log exceptions when skipping lorries
When a repository fails to prepare, ensure there is a log of the
exception that occured and the associated lorry.
Update skipped lorry last run and exit data
- Update last run to prevent frequent repeated failure
- Update exit for user visiblity on status page
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Provide a status page that lists only the lorries that failed to
update on the last attempt. This will make it easier to spot problems
that require an update to the lorry configuration.
Reuse some of the existing status page logic and render the run queue
with a different template.
Add a link to this page from the status page.
Closes #20.
|
|
|
|
|
|
|
|
|
|
|
|
| |
pyflakes isn't able to recognise that:
__all__ = locals()
effectively uses all the imported names. Replace this with an
explicit list of names.
Running pyflakes in CI should ensure that the list doesn't get
out of sync.
|
|
|
|
|
|
| |
Various modules are imported and not used.
Caught by pyflakes.
|
|
|
|
|
|
|
| |
pyflakes found various assignments to local variables which are not
used again. In some cases we still need to evaluate the expression
that's assigned. In most places we can delete the assignment
entirely.
|
|
|
|
|
|
|
|
| |
JobShower.get_job_as_json assigns to a local 'path' variable, but
doesn't use it. Use it instead of re-evaluating the same expression
assigned to it.
Caught by pyflakes.
|
|
|
|
|
|
|
|
|
| |
ReadConfiguration.fix_up_interval was returning default_value when
the string value did not match the expected format. This variable
is not defined, but default_interval is.
This bug has been present since the beginning of LC development, and
was caught by pyflakes.
|
|
|
|
|
|
|
|
| |
Commit bc7f80d "givemejob: Move upstream host metadata lookup out of
get_repo_metadata" failed to pass through the statedb variable into
the new function, so it will never work.
Caught by pyflakes.
|
|
|
|
|
|
|
|
|
| |
First, the lorry files are parsed as YAML. If the parser fails, then the
lorry files are parsed as JSON. If the YAML parser has advanced the Lorry
file's file-descriptor, this can lead to JSON parser errors.
This change resets the file descriptor to the start of the file before
calling the JSON parser.
|
|\
| |
| |
| |
| |
| |
| | |
Add metadata for single repositories
Closes #15
See merge request CodethinkLabs/lorry/lorry-controller!17
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
In testing the change to define the default branch for single
repositories, I found that GitLab will reject a change of default
branch if the branch does not yet exist. (It doesn't seem to do this
when creating a repository.)
Ignore failure to change the default branch, as we will fix it on the
next run after the branch has been created.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
When mirroring a repository found through a 'lorries' configuration
section (instead of 'trove' or 'gitlab'), we currently don't set a
description or default branch.
* Set the description to the upstream repository path, but allow this
to be overridden by a description field in the .lorry file. Prepend
the host-name, just as we do when mirroring an Upstream Host.
* Set the default branch to:
- Bazaar: 'trunk'
- Git: upstream default branch, found using 'git ls-remote'
- others: 'master'
Closes #15.
|
| |
| |
| |
| |
| |
| | |
In preparation for adding metadata for single repositories, move the
code for looking up metadata through the Upstream Host connector into
a separate function.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Any lorry in the database should have been either:
1. Generated based on a 'trove' or 'gitlab' section, with
'from_host' set to the Upstream Host name.
2. Read from a lorry referred to in a 'lorries' section, with
'from_host' set to an empty string.
So this error case indicates a dangling reference in the database.
The current schema does not use foreign keys so this could happen,
but it's reasonable to just give up and return empty metadata.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
'git init' copies files into the repository from a template directory,
which contains a 'replace me' description that we don't want. Provide
and use our own template directory instead.
While we're at it, also add the git-daemon-export-ok flag file that
git-daemon and git-http-backend may check for (depending on their
configuration).
Closes #16.
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In Python 2, the / operator between two integer-typed values produces
another integer. In Python 3, it produces a float. We need to use
the // operator to get the old behaviour.
The change to floats in get_free_disk_space resulted in unnecessarily
precise values for free disk space.
The change in formats_secs_nicely doesn't seem to make a difference
since we format the quotients with '%d', but I'm making it use // so
it's clearer what we want.
Closes #14.
|
|\
| |
| |
| |
| | |
STATEDB: Avoid depending on SQLite json1 extension
See merge request CodethinkLabs/lorry-controller!13
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The migration to a generalised hosts table uses json_object(), which
is part of the optional json1 extension to SQLite. This is not
enabled by default, and isn't enabled in the Freedesktop-SDK build
of SQLite.
Since GitLab tokens shouldn't include double-quotes, we can avoid
this by using standard SQL concatenation instead.
|
|/ |
|
|\
| |
| |
| | |
# Conflicts:
# lorry-controller-webapp
|
| |\
| | |
| | |
| | | |
Resolved conflicts (neighbouring insertions) in lorry-controller-webapp and
lorrycontroller/gerrit.py.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Lorry's account on Gerrit might not be permitted to change these
attributes later, so include them in the create-project command.
Closes #7.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
GerritDownstream does not specify a parent project for create-project,
so it implicitly creates projects directly under 'All-Projects'. This
requires that Lorry's user account is given broad permissions on
All-Projects, which seems undesirable.
Allow specifying an alternate parent project, so that Lorry can be
given permissions on only that project.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Implement organisation and repository creation using the Gitea REST
API v1. Add a 'gitea-access-token' application setting for this.
Closes #9.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
In order to support Downstream Hosts with restricted repository
hierarchies (like Gitea's 2 levels), it is useful to be able to map
both a directory and a subdirectory of it from an Upstream Host that
has a deeper hierarchy.
Convert the prefixmap into a list of (remote, local) tuples and sort
in reverse order, so that a subdirectory prefix will appear before its
parent directory prefix if both are present.
|
|\ \ \
| |/ /
|/| /
| |/ |
|
| |
| |
| |
| |
| |
| | |
Currently we always use the 'http' scheme to talk to GitLab's REST
API. Use the 'https' scheme instead, if the configured protocol
is 'https' or 'ssh' (as the SSH server doesn't expose this API).
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Replace the current hardcoded Downstream Host parameters with
application settings.
In general, Downstream Host connectors will use some combination of
HTTP(S) and/or SSH, so these are added in lorry-controller-webapp.
Currently only the gerrit connector will use downstream-ssh-url
and only the gitlab connector will use downstream-http-url.
Turn *on* StrictHostKeyChecking for the gerrit connector when not
talking to localhost.
Closes #4.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Most of the ssh parameters are given by a URL, which should be
configurable. Additional options can be set by keyword arguments.
runcmd already has a function like this, but it doesn't take a URL and
runcmd.shell_quote doesn't handle empty strings correctly.
Use this in the Gerrit host connector. It could be used in the Gitano
host connector as well, but I want to avoid making further changes
there that I can't test.
|
| |\ |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
The Secure Shell protocol does not allow passing an argument vector,
only a command line that will be interpreted by a specific program
(usually a shell, but in this case Gerrit) on the remote host.
OpenSSH's ssh command simply concatenates the remote command arguments
with spaces between them, so we need to shell-quote them first.
Closes #8.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
It generally doesn't make sense for a pure mirror to have issues,
merge requests, CI, a wiki, snippets, GitLab Pages, container images,
or LFS. Disable all of these.
Closes #6.
|
|/ /
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
GitLab groups can have a visibility of 'private' (only members),
'internal'/'limited' (only authenticated users), or 'public' (anyone).
GitLab subgroups and projects can have the same visibilities as
groups, but cannot be more visible than the containing group.
When mirroring public source code, it may be desirable to make the
entities we create more visible than the current default of 'private'.
Add an option to set any of the three levels of visibility supported
by GitLab, with the default unchanged. (The same levels are supported
by Gitea, though with one named differently.) Never change the
visibility of a group or repository that already exists.
Note that the GitLab connector previously tried to create all projects
as public, but this stopped working after the change to API v4.
In Gerrit and Gitano the access control model is lot more complex, and
generally only administrators can set visibility. Make their
connectors reject visibility other than 'private'.
Relates to #6, #9.
|
| |
| |
| |
| |
| | |
* GitlabUpstream: Implement get_repo_metadata
* {Gerrit,Gitlab,Local}Downstream: Use given metadata in prepare_repo
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
We won't be able to set metadata on a repository before we've created
it. So do that in prepare_repo instead of deferring it to Lorry.
This requires adding an application setting for the base directory.
Also update the method doc-string so the old lazy behaviour is not
allowed.
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
* Introduce UpnstreamHost abstract base class
* Define a subclass of this for each Upstream Host type
* Define a name-type map for these in the lorrycontroller package,
* Use these classes to replace type-specific code elsewhere
Related to #5.
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
* Introduce hosts module and DownstreamHost abstract base class
* Define a subclass of this for each Downstream Host type
* Define a name-type map for these in the lorrycontroller package
* Use these classes to replace type-specific code elsewhere
Related to #5.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
I will move validation of the GitLab-specific field out to the gitlab
module. In future we may also add further fields for specific
Upstream Host types, that will also need to be validated in the
associated modules.
In preparation for that, drop the leading '_' from the more general
methods in LorryControllerConfValidator, to mark them as public.
|
|\ \ |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
The current code only uses top-level groups since GitLab did not
originally support subgroups. For repositories with more than two
path components, it joins multiple components together as the project
name.
However, subgroups were implemented in version 9.0, so we can use them
and remove this mangling.
|
| |/
| |
| |
| |
| | |
python-gitlab dropped support for projects.search(...) along with the
GitLab v3 API. Instead we have to use projects.list(search=...).
|