-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* release/2.2.0: Version 2.2.0 Call sync on LOG_FILE only (fixes #10) (#13) Allow parameterising GitHub urls with GITHUB variable (#12)
- Loading branch information
Showing
5 changed files
with
54 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,6 +61,7 @@ def parse(cls, url): | |
|
||
|
||
ECMWF_BITBUCKET_URL = "ssh://[email protected]" | ||
GITHUB_URL = "https://github.com" | ||
|
||
|
||
class BundleDownloader(object): | ||
|
@@ -152,6 +153,7 @@ def __init__(self, project): | |
if project.git(): | ||
self.url = project.git() | ||
self.url = self.url.replace("${BITBUCKET}", ECMWF_BITBUCKET_URL) | ||
self.url = self.url.replace("${GITHUB}", GITHUB_URL) | ||
else: | ||
error("git not given for package " + self.name) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
### Bundle | ||
|
||
name : test-bundle-https | ||
|
||
projects : | ||
- project1 : | ||
git : ${GITHUB}/user/project1.git | ||
version : 0.0.1 | ||
bundle : false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ | |
import pytest | ||
from conftest import Watcher | ||
|
||
from ecbundle import BundleDownloader, Git, logger | ||
from ecbundle import GITHUB_URL, BundleDownloader, Git, logger | ||
|
||
os.environ["BITBUCKET"] = "ssh://[email protected]" | ||
|
||
|
@@ -337,3 +337,41 @@ def test_symlink_symlinked_project_subdir(args, here, project1_subdir1_dir, watc | |
|
||
assert ("Following projects are symlinked in") in watcher.output | ||
assert "- subdir1 (symlink_project1/subdir1)" in watcher.output | ||
|
||
|
||
@pytest.fixture( | ||
name="github_env_var", params=[None, "https://github.com", "ssh://[email protected]"] | ||
) | ||
def fixture_github_env_var(request): | ||
""" | ||
Fixture to set the GITHUB environment variable to various values | ||
""" | ||
orig_value = os.environ.get("GITHUB", None) | ||
|
||
if request.param is None: | ||
os.environ.pop("GITHUB", None) | ||
else: | ||
os.environ["GITHUB"] = request.param | ||
|
||
yield request.param or GITHUB_URL | ||
|
||
if orig_value is None: | ||
os.environ.pop("GITHUB", None) | ||
else: | ||
os.environ["GITHUB"] = orig_value | ||
|
||
|
||
def test_download_github(args, here, watcher, github_env_var): | ||
""" | ||
Simple bundle creation test that git clones a single project using | ||
the provided GITHUB environment variable value | ||
""" | ||
args["bundle"] = "%s" % (here / "bundle_github.yml") | ||
|
||
with watcher: | ||
BundleDownloader(**args).download() | ||
|
||
assert ( | ||
"git clone -o origin " + github_env_var + "/user/project1" | ||
) in watcher.output | ||
assert "git -c advice.detachedHead=false checkout 0.0.1" in watcher.output |