Skip to content

Commit

Permalink
Artifactory Bugfix (#57)
Browse files Browse the repository at this point in the history
* #57 | Fixes artifactory bug

* #57 | Bumps version, updates changelog

* #57 | Sets explicit dependency versions and updates yaml load function
  • Loading branch information
sshookman authored Aug 5, 2019
1 parent c6c6361 commit a6f5375
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 18 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ Documenting All Changes to the Skelebot Project

---

## v1.0.1
#### Changed
- **Artifactory Component** | Fixes bug where the `--user` and `--token` params were not being read in properly

---

## v1.0.0
#### Released: 2019-08-01
#### Added
Expand Down
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
FROM skelebot/python-base
MAINTAINER Sean Shookman <[email protected]>
WORKDIR /app
RUN ["pip", "install", "pyyaml"]
RUN ["pip", "install", "artifactory"]
RUN ["pip", "install", "pyyaml==5.1.2"]
RUN ["pip", "install", "artifactory==0.1.17"]
RUN ["pip", "install", "requests==2.22.0"]
RUN ["pip", "install", "coverage"]
RUN ["pip", "install", "pytest"]
COPY . /app
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.0
1.0.1
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@
"pytest"
],
install_requires=[
"pyyaml",
"artifactory",
"pyyaml==5.1.2",
"artifactory==0.1.17",
"requests==2.22.0",
"coverage",
"pytest"
],
Expand Down
5 changes: 3 additions & 2 deletions skelebot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ language: Python
ephemeral: False
primaryJob: test
dependencies:
- pyyaml
- artifactory
- pyyaml==5.1.2
- artifactory==0.1.17
- requests==2.22.0
- coverage
- pytest
ignores:
Expand Down
10 changes: 4 additions & 6 deletions skelebot/components/artifactory.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ def addParsers(self, subparsers):
# Generate the Dockerfile and dockerignore and build the docker image
def execute(self, config, args):
# Get User and Token if not provided in args
user = None
token = None
if (args.user == None):
user = args.user
token = args.token
if (user == None):
user = input("Please provide a valid Artifactory user: ")

if (args.token == None):
if (token == None):
token = input("Please provide a valid Artifactory token: ")

# Obtain the artifact that matches the provided name
Expand Down Expand Up @@ -116,8 +116,6 @@ def pullArtifact(self, user, token, file, url):
path = artifactory.ArtifactoryPath(url, auth=(user, token))
with path.open() as fd:
with open(file, "wb") as out:
content = fd.read()
print(content)
out.write(fd.read())
else:
print("Artifact Not Found: {url}".format(url=url))
4 changes: 2 additions & 2 deletions skelebot/systems/generators/yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,12 @@ def readYaml(env=None):
cfgFile = FILE_PATH.format(path=cwd)
if os.path.isfile(cfgFile):
with open(cfgFile, 'r') as stream:
yamlData = yaml.load(stream)
yamlData = yaml.load(stream, Loader=yaml.FullLoader)
if (env is not None):
envFile = ENV_FILE_PATH.format(path=cwd, env=env)
if os.path.isfile(envFile):
with open(envFile, 'r') as stream:
overrideYaml = yaml.load(stream)
overrideYaml = yaml.load(stream, Loader=yaml.FullLoader)
yamlData = override(yamlData, overrideYaml)

return yamlData
Expand Down
4 changes: 2 additions & 2 deletions test/test_components_artifactory.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def test_execute_push(self, mock_artifactory, mock_remove, mock_copy):

self.artifactory.execute(config, args)

mock_artifactory.assert_called_with("artifactory.test.com/ml/test/test_v1.0.0.pkl", auth=(None, None))
mock_artifactory.assert_called_with("artifactory.test.com/ml/test/test_v1.0.0.pkl", auth=('sean', 'abc123'))
mock_copy.assert_called_with("test.pkl", "test_v1.0.0.pkl")
mock_remove.assert_called_with("test_v1.0.0.pkl")

Expand All @@ -58,7 +58,7 @@ def test_execute_pull(self, mock_artifactory, mock_open):

self.artifactory.execute(config, args)

mock_artifactory.assert_called_with("artifactory.test.com/ml/test/test_v0.1.0.pkl", auth=(None, None))
mock_artifactory.assert_called_with("artifactory.test.com/ml/test/test_v0.1.0.pkl", auth=('sean', 'abc123'))
mock_open.assert_called_with("test_v0.1.0.pkl", "wb")

if __name__ == '__main__':
Expand Down
2 changes: 1 addition & 1 deletion test/test_systems_parsing_skeleParser.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def test_description(self):
-----------------------------------
Version: 0.1.0
Environment: test
Skelebot Version: 1.0.0
Skelebot Version: 1.0.1
-----------------------------------"""

self.assertEqual(description, expectedDescription)
Expand Down

0 comments on commit a6f5375

Please sign in to comment.