Skip to content

Commit

Permalink
V2.3.8 (#1297)
Browse files Browse the repository at this point in the history
- added `--skip` and `--url` flags to `cm init`
- added support to pull CM repos using --url with "git@"
  • Loading branch information
gfursin authored Sep 27, 2024
2 parents 443bd03 + 657db09 commit 07e3ac5
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 22 deletions.
4 changes: 4 additions & 0 deletions cm/CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## V2.3.8
- added `--skip` and `--url` flags to `cm init`
- added support to pull CM repos using --url with "git@"

## V2.3.7
- added cmind.core.debug to make it easier to debug CM automations
- added env CM_CORE_SKIP_FIX_REPO_PATH to skip fixing non-existent repo paths
Expand Down
1 change: 1 addition & 0 deletions cm/COPYRIGHT.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Copyright (c) 2022-2024 MLCommons

2 changes: 1 addition & 1 deletion cm/cmind/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# Written by Grigori Fursin

__version__ = "2.3.7"
__version__ = "2.3.8"

from cmind.core import access
from cmind.core import error
Expand Down
47 changes: 31 additions & 16 deletions cm/cmind/repo/automation/core/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

class CMInit():
###############################################################
def run(self, quiet = False, repo_name = 'mlcommons@cm4mlops', repo_branch = ''):
def run(self, quiet = False, skip = False, repo_name = 'mlcommons@cm4mlops', repo_url = '', repo_branch = ''):
import cmind

print ('Checking platform information ...')
Expand All @@ -27,19 +27,29 @@ def run(self, quiet = False, repo_name = 'mlcommons@cm4mlops', repo_branch = '')
if r['return']>0 or r.get('warning','') !='' :
return r

print ('')
print ('Obtaining default automation repository ...')
rr = {'return':0}

print ('')
ii = {'action':'pull',
'automation':'repo',
'artifact':repo_name,
'out':'con'}
if not skip:

print ('')
print ('Pulling default automation repository ...')

print ('')
ii = {'action':'pull',
'automation':'repo',
'out':'con'}

if repo_url != '':
ii['url'] = repo_url
elif repo_name != '':
ii['artifact'] = repo_name

if repo_branch !='':
ii['branch'] = repo_branch

if repo_branch !='':
ii['branch'] = repo_branch
rr = cmind.access(ii)

return cmind.access(ii)
return rr

###############################################################
def install_system_packages(self, quiet):
Expand Down Expand Up @@ -215,9 +225,10 @@ def init(self, i):
(CM input dict):
(quiet) (bool): if True, skip asking questions about sudo, etc
(repo) (str): automation repository to pull ('mlcommons@cm4mlops' by default)
(repo) (str): main automation repository to pull ('mlcommons@cm4mlops' by default)
(url) (str): main automation repository to pull via url (can use git@ instead of https)
(branch) (str): branch to use ('' by default)
(skip) (bool): skip pulling main automation repository
Returns:
(CM return dict):
Expand All @@ -230,12 +241,16 @@ def init(self, i):

quiet = i.get('quiet', False)

repo_name = i.get('repo', '')
if repo_name == '': repo_name = 'mlcommons@cm4mlops'
skip = i.get('skip', False)

repo_name = i.get('repo', '').strip()
repo_url = i.get('url', '').strip()
if repo_url == '' and repo_name == '':
repo_name = 'mlcommons@cm4mlops'

repo_branch = i.get('branch', '')

r = cm_init.run(quiet = quiet, repo_name = repo_name, repo_branch = repo_branch)
r = cm_init.run(quiet = quiet, skip = skip, repo_name = repo_name, repo_url = repo_url, repo_branch = repo_branch)
if r['return']>0: return r

warning = r.get('warning', '')
Expand Down
16 changes: 11 additions & 5 deletions cm/cmind/repo/automation/repo/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,17 @@ def pull(self, i):
else:
if alias.endswith('.git'): alias=alias[:-4]

j = alias.find('//')
if j>=0:
j1 = alias.find('/', j+2)
if j1>=0:
alias = alias[j1+1:].replace('/','@')
if alias.startswith('git@'):
j = alias.find(':')
if j>=0:
alias = alias[j+1:].replace('/','@')
else:
j = alias.find('//')
if j>=0:
j1 = alias.find('/', j+2)
if j1>=0:
alias = alias[j1+1:].replace('/','@')


if url == '':
pull_repos = []
Expand Down

0 comments on commit 07e3ac5

Please sign in to comment.