In the move away from environment variables, replace JANWARE_USER
support in pgit.sh by the --login option.
Signed-off-by: Jan Lindemann <jan@janware.com>
In the attempt to move away from communicating options via
environment variables from one part of jw-build software to another,
replace PGIT_CLONE_FROM_USER with the clearer --refspec option. Which
is also more versatile.
Signed-off-by: Jan Lindemann <jan@janware.com>
- Make PROJECTS_MAKEFILE_NAME point to first in $(MAKEFILE_LIST)
- Allow to include projects-dir-minimal.mk in hand-written Makefile
without fear that its going to be overwritten with a link
Signed-off-by: Jan Lindemann <jan@janware.com>
Creating user repositories is hard to test. Not sure if the concept
will survive the current workflow changes, disable it for now.
Signed-off-by: Jan Lindemann <jan@janware.com>
Don't unconditionally add proactiveAuth=basic to Git's config during
clone, but only if cloning happens after authentication.
This saves unauthenticated users funny password prompts. On the other
hand, this makes a server setting persistent which could be changed
on the server.
URL =~ /api/ (or so) => 401, followed by Basic Auth
URL !=~ /api/ (or so) => Redirect or free access, depending on resource
Currently all resources, including API, are accessible by either
basic auth or a Cookie, but basic auth needs to be present in the
first request, which throws off some clients (notably Git without
proactiveAuth=basic).
Signed-off-by: Jan Lindemann <jan@janware.com>
If jw-build is already cloned, infect all other repositories with its
remote via PROJECTS_DIR_REMOTE_BASE.
Signed-off-by: Jan Lindemann <jan@janware.com>
JW_BUILD_SSH_EXTRA_OPTS contains a -l $(JANWARE_USER), which make ssh
break if $(JANWARE_USER) is empty. Fix that case.
Signed-off-by: Jan Lindemann <jan@janware.com>
The GIT_ASKPASS environment variable can point to a relative path,
and since pgit.sh currently does a chdir, it needs to be made an
absolute path.
Signed-off-by: Jan Lindemann <jan@janware.com>
For git clone, use and persist the http.proactiveAuth=basic config
option, because it's needed for janware.com servers.
Signed-off-by: Jan Lindemann <jan@janware.com>
Currently, the primary discriminating criterion on how to handle a
set of remote repositories is whether or not JANWARE_USER is defined.
The canonical way to do that is PROJECTS_DIR_REMOTE_BASE, though, so
go from that definition.
Signed-off-by: Jan Lindemann <jan@janware.com>
Finish and test the __init_askpass() method, works.
__init_askpass() had never been tested. Finish it and make sure it
works.
Signed-off-by: Jan Lindemann <jan@janware.com>
PROJECTS_DIR_REMOTE_USER_SUBPATH is a janware.com specialty somewhat.
Having subpaths is a Forgejo feature request on Codeberg, though, so
it might also be here to stay.
Signed-off-by: Jan Lindemann <jan@janware.com>
curl exits with 0 success status, even if the server returns HTTP
401. Passing -f fixes that and has curl error out with exit code 22.
It doesn't show which error, though.
Signed-off-by: Jan Lindemann <jan@janware.com>
Pass -c http.proactiveAuth=basic to the initial "git clone jw-build"
invocation. This is necessary while jw-build is still behind
authentication. The restriction will likely be lifted (for jw-build),
but for testing now it's fine, and it doesn't do any harm, either.
With the way janware.com currently operates, it will also necessary
for push over HTTP, so make it persistent in jw-build's
configuration.
Signed-off-by: Jan Lindemann <jan@janware.com>
Pass --branch $(JW_BUILD_BRANCH) to git clone invocations during the
initial cloning of jw-build. Used for testing.
Signed-off-by: Jan Lindemann <jan@janware.com>
Add command get-auth-info to jw-projects.py. It is meant to retrieve
JANWARE_USER from an already cloned jw-build tree.
Signed-off-by: Jan Lindemann <jan@janware.com>
Linking the projects-dir Makefile fails if make pkg-rebuild has been
run on jw-build, because it leaves another projects-dir-minimal.mk
below the dist directory. Fix that.
Signed-off-by: Jan Lindemann <jan@janware.com>
Group variables related with pgit.sh (PGIT_SH and PGIT_SH_CLONE)
closer together. Define CLONE_FROM_USER early on.
Signed-off-by: Jan Lindemann <jan@janware.com>
Don't directly import from lib (i.e. from __init__.py), because that
won't work until "make all" has not run through, i.e. during fresh
checkout.
Signed-off-by: Jan Lindemann <jan@janware.com>
The usage comments heading projects-dir-minimal.mk and
projects-dir.mk state that for cloning all repositories, JANWARE_USER
needs to be defined. That restriction is now gone, so reflect that in
the comment.
Signed-off-by: Jan Lindemann <jan@janware.com>
Add the variable PROJECTS_DIR_REMOTE_BASE, defaulting to
ssh://git.janware.com/srv/git if REMOTE_USER is defined, and to
https://janware.com/code in case it isn't.
Signed-off-by: Jan Lindemann <jan@janware.com>
Do not set JANWARE_USER to $(id -un) in case it's undefined. Instead,
rely on it being set explicitly in the environment if so desired.
Signed-off-by: Jan Lindemann <jan@janware.com>
Replace git-srv-admin.sh list-personal-projects by the more universal
"jw-projects.py list-repos" for enumerating repo names. This is a
step towards supporting Git servers other than janware.com.
Signed-off-by: Jan Lindemann <jan@janware.com>
pgit.sh has ssh://$login@git.janware.com/srv/git/$fromuser/proj/$reponame
hard-coded as the remote Git URLs of every cloned project.
This commit adds support for the global option --remote-base. Passing
it changes the URL to <remote-base>/$fromuser/$reponame..
Signed-off-by: Jan Lindemann <jan@janware.com>
Adding a symbolic link to src/python/jw allows jw-projects.py to run
without pointing PYTHONPATH to that module.
Signed-off-by: Jan Lindemann <jan@janware.com>
Pass --create-remote-user-repos to pgit.sh clone in case JANWARE_USER
is defined, restoring the original behaviour.
Signed-off-by: Jan Lindemann <jan@janware.com>
Add support for --create-user-repos to pgit.sh. It controls whether
or not personal remote repositories on janware.com are created when
cloning from another user.
Signed-off-by: Jan Lindemann <jan@janware.com>
Add the command list-repos to jw-projects.py. It is meant to do the
same thing as "git-srv-adm.sh list-personal-projects", i.e. enumerate
remote Git repositories, but also support additional servers and
protocols. As of this commit, support for https://github.com and for
forgejo installations over HTTPS is implemented.
Signed-off-by: Jan Lindemann <jan@janware.com>
SSHClient(hostname) is an abstract class for SSH / SCP operations. It
comes with two implementations, SSHClientInternal an SSHClientCmd.
The former needs paramiko installed, which might be a reason to fail
on unprepared systems, the latter is slower and more limited.
Signed-off-by: Jan Lindemann <jan@janware.com>