-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bind samcli version to certain commit of app template (#3815)
bind samcli version to certain commit of app template
- Loading branch information
1 parent
23beec6
commit 19ca461
Showing
7 changed files
with
173 additions
and
20 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
""" Read info from runtime_config.json file""" | ||
|
||
import json | ||
from pathlib import Path | ||
import logging | ||
|
||
from click import ClickException | ||
|
||
LOG = logging.getLogger(__name__) | ||
|
||
CONFIG_FILE = Path(Path(__file__).resolve().parents[2], "runtime_config.json") | ||
config = json.loads(CONFIG_FILE.read_text()) | ||
|
||
|
||
def get_app_template_repo_commit(): | ||
""" | ||
Returns | ||
------- | ||
the value of app_template_repo_commit | ||
""" | ||
commit_hash = config.get("app_template_repo_commit", None) | ||
if not commit_hash: | ||
raise ClickException( | ||
message="Error when retrieving app_template_repo_commit, runtime_config.json file maybe invalid" | ||
) | ||
return commit_hash |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"app_template_repo_commit" : "09b7de41c32ee5f50ec8ceeec4a304534767844b" | ||
} |
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from unittest.case import TestCase | ||
from samcli.lib.utils import configuration | ||
|
||
|
||
class TestConfiguration(TestCase): | ||
def test_return_correct_value(self): | ||
self.assertEqual(configuration.get_app_template_repo_commit(), "09b7de41c32ee5f50ec8ceeec4a304534767844b") |
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