Commit Graph

21 Commits

Author SHA1 Message Date
mprahl
8c6cfb702d Use small license headers in the Python files
This also removes the outdated comments around authorship of each
file. If there is still interest in this information, one can just
look at the git history.
2019-10-03 08:47:24 -04:00
mprahl
771fad6d50 Resolve the commit in the SCM.commit property method instead of the constructor
This will prevent the need to call `SCM.get_latest` in the constructor,
since not all SCM objects need the commit to the branch. It also fixes
the situation where a component's git repo doesn't have a "master" branch.

See https://pagure.io/fm-orchestrator/issue/1224
2019-05-06 15:13:24 +00:00
mprahl
66c3f82160 Format the coding style across the codebase using "black" and manual tweaks
The main benefit of this commit is that the use of double quotes
is now consistent.
2019-04-26 00:32:13 -04:00
Jan Kaluza
130911bb49 Do not retry on 'git ls-remote' failure, but instead fallback to 'git clone'. 2019-02-11 15:27:07 +01:00
Chenxiong Qi
b577b0f9e1 Refactor SCM.get_latest
git-ls-remote accepts paramter refs to just return refs for specific
ones. This refactor uses this parameter to avoid handling full list of
refs from remote repository.

In original code, option --exit-code is passed to git-ls-remote, which
would cause command return exit code 2 when no ref is found from remote
repository. SCM._run raises an error if that happens, but the raised
error is not handled. This refactor catches this error to ensure the
original behavior happens, that is if a ref is not found, treat it as a
commit hash and call SCM.get_full_commit_hash.

Signed-off-by: Chenxiong Qi <cqi@redhat.com>
2018-11-07 11:02:40 +08:00
Filip Valder
598347e1b6 Import module API 2018-09-07 17:12:01 +02:00
Yash Nanavati
ed25afd9ec Code changes for Python 3 support 2018-03-04 03:22:38 -05:00
mprahl
b7998d4402 Remove the need for nose and solely rely on pytest 2018-02-05 22:11:31 -05:00
mprahl
e91d09f7ca Change the format of the unit tests to pytest 2018-01-31 16:34:21 -05:00
Ralph Bean
1e140a6615 s/incorect/incorrect/ 2018-01-15 12:52:59 -05:00
mprahl
df5b9ab04a Ignore entries in "git ls-remote" with "refs/remotes/origin/" 2017-11-17 11:35:35 -05:00
mprahl
1622494b17 Replace the name of the "branch" parameter in "scm.get_latest" to "ref" 2017-11-13 09:20:20 -05:00
Martin Curlej
bf2369e8e0 Fixed issue with getting the latest ref
Signed-off-by: Martin Curlej <mcurlej@redhat.com>
2017-11-09 12:47:08 +01:00
mprahl
e91f4fdea6 Revert "added git option which will return correct return code"
This caused an issue when the modulemd had the ref's for its components
as commit hashes instead of branches.

This reverts commit 15f332e60f.
2017-11-03 16:20:33 -04:00
Martin Curlej
15f332e60f added git option which will return correct return code
added tests

fixing typo
2017-10-04 11:44:24 +02:00
Filip Valder
09b3f32dbb Fix #619: Support for module YAML file validation within a SCM repository 2017-08-07 13:10:53 +02:00
Filip Valder
a192dab1e2 return Unprocessable Entity in case of a commit hash which is not found within the repository 2017-04-10 16:41:24 +02:00
Jan Kaluza
4b3e295e48 Expect 'branch' while handling submission of module and use it to set the stream of module. Also verify that the commit hash belongs to that branch. 2017-03-07 11:25:06 +01:00
Ralph Bean
357b4a089d Add an internal repo for tests. 2017-02-20 21:07:20 -05:00
Ralph Bean
0ffb1f7e42 Test that we can clone repos with a trailing slash. 2017-02-20 12:44:49 -05:00
Ralph Bean
2e6e153660 Add a few tests for the SCM module.
In particular, test to see if we can pass a branch name with shell
characters, and get MBS to inadvertently execute malicious code.

The test shows that doing this in a straightforward way is not possible
and should guard against any future regressions.

Fixes #329.
2017-02-20 09:25:00 -05:00