Merge "Fix cloning only single repo branch bug"

This commit is contained in:
Scott Hussey 2017-08-17 15:20:22 -04:00 committed by Gerrit Code Review
commit 32b26a1d5d
2 changed files with 68 additions and 49 deletions

View File

@ -135,8 +135,7 @@ class Armada(object):
def tag_cloned_repo(self, ch, repos): def tag_cloned_repo(self, ch, repos):
location = ch.get('chart').get('source').get('location') location = ch.get('chart').get('source').get('location')
ct_type = ch.get('chart').get('source').get('type') ct_type = ch.get('chart').get('source').get('type')
reference = ch.get('chart').get('source').get('reference') subpath = ch.get('chart').get('source').get('subpath', '.')
subpath = ch.get('chart').get('source').get('subpath')
if ct_type == 'local': if ct_type == 'local':
ch.get('chart')['source_dir'] = (location, subpath) ch.get('chart')['source_dir'] = (location, subpath)
@ -145,16 +144,22 @@ class Armada(object):
tarball_dir = source.get_tarball(location) tarball_dir = source.get_tarball(location)
ch.get('chart')['source_dir'] = (tarball_dir, subpath) ch.get('chart')['source_dir'] = (tarball_dir, subpath)
elif ct_type == 'git': elif ct_type == 'git':
if location not in repos.keys(): reference = ch.get('chart').get('source').get('reference',
'master')
repo_branch = (location, reference)
if repo_branch not in repos.keys():
try: try:
LOG.info('Cloning repo: %s', location) LOG.info('Cloning repo: %s branch: %s', *repo_branch)
repo_dir = source.git_clone(location, reference) repo_dir = source.git_clone(*repo_branch)
except Exception: except Exception:
raise source_exceptions.GitLocationException(location) raise source_exceptions.GitLocationException(
repos[location] = repo_dir '{} branch: {}'.format(*repo_branch))
repos[repo_branch] = repo_dir
ch.get('chart')['source_dir'] = (repo_dir, subpath) ch.get('chart')['source_dir'] = (repo_dir, subpath)
else: else:
ch.get('chart')['source_dir'] = (repos.get(location), subpath) ch.get('chart')['source_dir'] = (repos.get(repo_branch),
subpath)
else: else:
chart_name = ch.get('chart').get('chart_name') chart_name = ch.get('chart').get('chart_name')
raise source_exceptions.ChartSourceException(ct_type, chart_name) raise source_exceptions.ChartSourceException(ct_type, chart_name)

View File

@ -76,27 +76,27 @@ armada/Chart/v1
Chart Chart
^^^^^ ^^^^^
+-----------------+----------+------------------------------------------------------------------------+ +-----------------+----------+---------------------------------------------------------------------------+
| keyword | type | action | | keyword | type | action |
+=================+==========+========================================================================+ +=================+==========+===========================================================================+
| chart\_name | string | name for the chart | | chart\_name | string | name for the chart |
+-----------------+----------+------------------------------------------------------------------------+ +-----------------+----------+---------------------------------------------------------------------------+
| release\_name | string | name of the release | | release\_name | string | name of the release |
+-----------------+----------+------------------------------------------------------------------------+ +-----------------+----------+---------------------------------------------------------------------------+
| namespace | string | namespace of your chart | | namespace | string | namespace of your chart |
+-----------------+----------+------------------------------------------------------------------------+ +-----------------+----------+---------------------------------------------------------------------------+
| timeout | int | time (in seconds) allotted for chart to deploy when 'wait' flag is set | | timeout | int | time (in seconds) allotted for chart to deploy when 'wait' flag is set |
+-----------------+----------+------------------------------------------------------------------------+ +-----------------+----------+---------------------------------------------------------------------------+
| install | object | install the chart into your Kubernetes cluster | | install | object | install the chart into your Kubernetes cluster |
+-----------------+----------+------------------------------------------------------------------------+ +-----------------+----------+---------------------------------------------------------------------------+
| update | object | update the chart managed by the armada yaml | | update | object | update the chart managed by the armada yaml |
+-----------------+----------+------------------------------------------------------------------------+ +-----------------+----------+---------------------------------------------------------------------------+
| values | object | override any default values in the charts | | values | object | override any default values in the charts |
+-----------------+----------+------------------------------------------------------------------------+ +-----------------+----------+---------------------------------------------------------------------------+
| source | object | provide a path to a ``git repo`` or ``local dir`` deploy chart. | | source | object | provide a path to a ``git repo``, ``local dir``, or ``tarball url`` chart |
+-----------------+----------+------------------------------------------------------------------------+ +-----------------+----------+---------------------------------------------------------------------------+
| dependencies | object | reference any chart dependencies before install | | dependencies | object | reference any chart dependencies before install |
+-----------------+----------+------------------------------------------------------------------------+ +-----------------+----------+---------------------------------------------------------------------------+
Update - Pre or Post Update - Pre or Post
^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^
@ -148,17 +148,17 @@ Update - Actions - Update/Delete
Source Source
^^^^^^ ^^^^^^
+-------------+----------+---------------------------------------------------------------+ +-------------+----------+-------------------------------------------------------------------------------+
| keyword | type | action | | keyword | type | action |
+=============+==========+===============================================================+ +=============+==========+===============================================================================+
| type | string | source to build the chart: ``git``, ``local``, or ``tar`` | | type | string | source to build the chart: ``git``, ``local``, or ``tar`` |
+-------------+----------+---------------------------------------------------------------+ +-------------+----------+-------------------------------------------------------------------------------+
| location | string | ``url`` or ``path`` to the chart's parent directory | | location | string | ``url`` or ``path`` to the chart's parent directory |
+-------------+----------+---------------------------------------------------------------+ +-------------+----------+-------------------------------------------------------------------------------+
| subpath | string | relative path to target chart from parent | | subpath | string | (optional) relative path to target chart from parent (``.`` if not specified) |
+-------------+----------+---------------------------------------------------------------+ +-------------+----------+-------------------------------------------------------------------------------+
| reference | string | branch of the repo | | reference | string | (optional) branch of the repo (``master`` if not specified) |
+-------------+----------+---------------------------------------------------------------+ +-------------+----------+-------------------------------------------------------------------------------+
Example Example
~~~~~~~ ~~~~~~~
@ -247,10 +247,10 @@ Simple Example
namespace: default namespace: default
values: {} values: {}
source: source:
type: tar type: git
location: http://localhost:8879/namespace/repo location: http://github.com/namespace/repo
subpath: blog-2 subpath: blog-1
reference: master reference: new-feat
dependencies: [] dependencies: []
--- ---
schema: armada/ChartGroup/v1 schema: armada/ChartGroup/v1
@ -290,7 +290,7 @@ Multichart Example
source: source:
type: git type: git
location: https://github.com/namespace/repo location: https://github.com/namespace/repo
subpath: . subpath: blog1
reference: master reference: master
dependencies: [] dependencies: []
--- ---
@ -304,10 +304,23 @@ Multichart Example
namespace: default namespace: default
values: {} values: {}
source: source:
type: git type: tar
location: https://github.com/namespace/repo location: https://github.com/namespace/repo/blog2.tgz
subpath: . subpath: blog2
reference: master dependencies: []
---
schema: armada/Chart/v1
metadata:
schema: metadata/Document/v1
name: blog-3
data:
chart_name: blog-3
release: blog-3
namespace: default
values: {}
source:
type: local
location: /home/user/namespace/repo/blog3
dependencies: [] dependencies: []
--- ---
schema: armada/ChartGroup/v1 schema: armada/ChartGroup/v1
@ -329,6 +342,7 @@ Multichart Example
sequenced: False sequenced: False
chart_group: chart_group:
- blog-1 - blog-1
- blog-3
--- ---
schema: armada/Manifest/v1 schema: armada/Manifest/v1
metadata: metadata: