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
59048a48
Commit
59048a48
authored
4 years ago
by
Filippo Cremonese
Browse files
Options
Downloads
Patches
Plain Diff
More robust git ls-remote handling
parent
7f232ec6
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/actions/clone.py
+11
-10
11 additions, 10 deletions
orchestra/actions/clone.py
orchestra/cmds/update.py
+6
-0
6 additions, 0 deletions
orchestra/cmds/update.py
with
17 additions
and
10 deletions
orchestra/actions/clone.py
+
11
−
10
View file @
59048a48
...
...
@@ -70,15 +70,16 @@ class CloneAction(Action):
check_returncode
=
False
).
stdout
.
decode
(
"
utf-8
"
)
if
os
.
path
.
exists
(
cache_filepath
):
with
open
(
cache_filepath
,
"
rb
"
)
as
f
:
cached_data
=
json
.
loads
(
f
.
read
())
else
:
cached_data
=
{}
cached_data
[
self
.
build
.
qualified_name
]
=
data
# TODO: prevent race condition, if two clone actions run at the same time
with
open
(
cache_filepath
,
"
w
"
)
as
f
:
json
.
dump
(
cached_data
,
f
)
if
data
:
if
os
.
path
.
exists
(
cache_filepath
):
with
open
(
cache_filepath
,
"
rb
"
)
as
f
:
cached_data
=
json
.
loads
(
f
.
read
())
else
:
cached_data
=
{}
cached_data
[
self
.
build
.
qualified_name
]
=
data
# TODO: prevent race condition, if two clone actions run at the same time
with
open
(
cache_filepath
,
"
w
"
)
as
f
:
json
.
dump
(
cached_data
,
f
)
return
data
This diff is collapsed.
Click to expand it.
orchestra/cmds/update.py
+
6
−
0
View file @
59048a48
...
...
@@ -38,6 +38,12 @@ def handle_update(args, config: Configuration):
if
os
.
path
.
exists
(
ls_remote_cache
):
os
.
remove
(
ls_remote_cache
)
for
_
,
component
in
config
.
components
.
items
():
for
_
,
build
in
component
.
builds
.
items
():
if
build
.
clone
:
logger
.
debug
(
f
"
Updating ls-remote cached info for
{
build
.
qualified_name
}
"
)
build
.
clone
.
get_remote_head
()
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
)
...
...
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