The current developer instructions how to fork and clone all the REANA source code repositories, as presented in reana-dev --help | less, are not fully working. Here is a test case how to reproduce the issue:
$ mkvirtualenv reana -p python3.8
$ pip install git+git://github.com/reanahub/reana.git#egg=reana
$ mkdir -p /tmp/mysrc
$ cd /tmp/mysrc
$ reana-dev git-clone -c ALL -u tiborsimko
...
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command 'git rev-parse --show-toplevel' returned non-zero exit status 128.
The issue is a chicken-and-egg problem: the first repository cannot be cloned since reana-dev cannot detect where are REANA repositories located.
The first workaround is to clone the "reana" repository manually first:
However, this is not ideal, since this technique does not set "upstream" properly in the "reana" repository, for it sees it already existing and it won't touch it:
The second workaround is to edit reana/.git/config to manually add "upstream" sources.
Expected behaviour
We should allow users to override the behaviour of reana-dev git-clone so that it wouldn't look where the sources are but rather perform all the cloning for the first time automatically.
Since the cloning operation can be "dangerous" because it can clutter the working directory and because it may be rather time-consuming, we should proceed somewhat carefully:
detect if the current working directory is fully empty;
if it is empty, then warn the user and ask whether the user would like to clone the sources here; the user can reply Y/N before the action is executed;
if it is not empty, then warn the user about this and abort.
Alternatively, we can introduce a new CLI option called say --target-directory that would allow to override the detection of source code repository locations, so that people would be able to write:
$ cd /tmp/mysrc
$ reana-dev git-clone -c ALL --target-directory .
and everything would be cloned without a glitch.
P.S.1: The documentation in reana-dev --help should be amended accordingly.
P.S.2: Later we could even switch to using gh CLI client, but that would be for another times.
@marcdiazsan I have just realised that I had created this issue in a wrong repository... The fix will for for reana-dev which lives in the "reana" repository, please see reana/reana_dev/git.py file there...
Current behaviour
The current developer instructions how to fork and clone all the REANA source code repositories, as presented in
reana-dev --help | less
, are not fully working. Here is a test case how to reproduce the issue:The issue is a chicken-and-egg problem: the first repository cannot be cloned since
reana-dev
cannot detect where are REANA repositories located.The first workaround is to clone the "reana" repository manually first:
after which the cloning script works:
However, this is not ideal, since this technique does not set "upstream" properly in the "reana" repository, for it sees it already existing and it won't touch it:
The second workaround is to edit
reana/.git/config
to manually add "upstream" sources.Expected behaviour
We should allow users to override the behaviour of
reana-dev git-clone
so that it wouldn't look where the sources are but rather perform all the cloning for the first time automatically.Since the cloning operation can be "dangerous" because it can clutter the working directory and because it may be rather time-consuming, we should proceed somewhat carefully:
Alternatively, we can introduce a new CLI option called say
--target-directory
that would allow to override the detection of source code repository locations, so that people would be able to write:and everything would be cloned without a glitch.
P.S.1: The documentation in
reana-dev --help
should be amended accordingly.P.S.2: Later we could even switch to using
gh
CLI client, but that would be for another times.