Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
orchestra-v3
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alessandro Di Federico
orchestra-v3
Commits
d6c124bb
Commit
d6c124bb
authored
4 years ago
by
Filippo Cremonese
Browse files
Options
Downloads
Patches
Plain Diff
Added update command
parent
491e8433
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
orchestra/cmds/__init__.py
+6
-4
6 additions, 4 deletions
orchestra/cmds/__init__.py
orchestra/cmds/update.py
+54
-0
54 additions, 0 deletions
orchestra/cmds/update.py
with
60 additions
and
4 deletions
orchestra/cmds/__init__.py
+
6
−
4
View file @
d6c124bb
import
argparse
from
.
import
components
from
.
import
environment
from
.
import
clone
from
.
import
components
from
.
import
configure
from
.
import
install
from
.
import
uninstall
from
.
import
environment
from
.
import
graph
from
.
import
install
from
.
import
shell
from
.
import
uninstall
from
.
import
update
class
CustomArgumentParser
(
argparse
.
ArgumentParser
):
...
...
@@ -26,6 +27,7 @@ def install_subcommands(argparser):
components
.
install_subcommand
(
subparsers
)
environment
.
install_subcommand
(
subparsers
)
clone
.
install_subcommand
(
subparsers
)
update
.
install_subcommand
(
subparsers
)
configure
.
install_subcommand
(
subparsers
)
install
.
install_subcommand
(
subparsers
)
uninstall
.
install_subcommand
(
subparsers
)
...
...
This diff is collapsed.
Click to expand it.
orchestra/cmds/update.py
0 → 100644
+
54
−
0
View file @
d6c124bb
import
os.path
import
subprocess
from
glob
import
glob
from
loguru
import
logger
from
..model.configuration
import
Configuration
def
install_subcommand
(
sub_argparser
):
cmd_parser
=
sub_argparser
.
add_parser
(
"
update
"
,
handler
=
handle_update
)
def
handle_update
(
args
,
config
:
Configuration
):
logger
.
info
(
"
Updating binary archives
"
)
os
.
makedirs
(
config
.
binary_archives_dir
,
exist_ok
=
True
)
for
name
,
url
in
config
.
binary_archives_remotes
.
items
():
binary_archive_path
=
os
.
path
.
join
(
config
.
binary_archives_dir
,
name
)
if
os
.
path
.
exists
(
binary_archive_path
):
pull_binary_archive
(
name
,
config
)
else
:
clone_binary_archive
(
name
,
url
,
config
)
logger
.
info
(
"
Updating repositories
"
)
for
git_repo
in
glob
(
os
.
path
.
join
(
config
.
sources_dir
,
"
**/.git
"
),
recursive
=
True
):
git_repo
=
os
.
path
.
dirname
(
git_repo
)
logger
.
info
(
f
"
Pulling
{
git_repo
}
"
)
result
=
git_pull
(
git_repo
)
if
result
.
returncode
:
logger
.
error
(
f
"
Could not pull repository
{
git_repo
}
"
)
def
pull_binary_archive
(
name
,
config
):
binary_archive_path
=
os
.
path
.
join
(
config
.
binary_archives_dir
,
name
)
logger
.
info
(
f
"
Pulling binary archive
{
binary_archive_path
}
"
)
result
=
git_pull
(
binary_archive_path
)
if
result
.
returncode
:
logger
.
error
(
f
"
Could not pull binary archive
{
binary_archive_path
}
"
)
def
clone_binary_archive
(
name
,
url
,
config
):
logger
.
info
(
f
"
Trying to clone binary archive from remote
{
name
}
(
{
url
}
)
"
)
binary_archive_path
=
os
.
path
.
join
(
config
.
binary_archives_dir
,
name
)
env
=
os
.
environ
env
[
"
GIT_LFS_SKIP_SMUDGE
"
]
=
"
1
"
result
=
subprocess
.
run
([
"
git
"
,
"
clone
"
,
url
,
binary_archive_path
],
env
=
env
)
if
result
.
returncode
:
logger
.
info
(
f
"
Could not clone binary archive from remote
{
name
}
!
"
)
def
git_pull
(
directory
):
env
=
os
.
environ
env
[
"
GIT_LFS_SKIP_SMUDGE
"
]
=
"
1
"
return
subprocess
.
run
([
"
git
"
,
"
-C
"
,
directory
,
"
pull
"
,
"
--ff-only
"
],
env
=
env
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment