Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to JiHu GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Chenhao Ma
core
Commits
c847844c
Commit
c847844c
authored
7 years ago
by
Harsha Kethineni
Browse files
Options
Downloads
Patches
Plain Diff
moved testing to same closure as upgrade_26_closure
parent
eec8fa8a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bin/database.py
+5
-22
5 additions, 22 deletions
bin/database.py
with
5 additions
and
22 deletions
bin/database.py
+
5
−
22
View file @
c847844c
...
...
@@ -969,6 +969,11 @@ def upgrade_to_26_closure(job):
if
tag
==
gear_name
:
logging
.
info
(
"
Gear name tag already exists
"
)
return
True
for
tag
in
job
[
'
tags
'
]:
if
tag
==
gear_name
:
gear_name_tag_count
=
gear_name_tag_count
+
1
if
gear_name_tag_count
>
1
:
raise
Exception
(
"
Job has multiple gear name tags
"
)
# Update doc
result
=
config
.
db
.
jobs
.
update_one
({
'
_id
'
:
job
[
'
_id
'
]},
{
'
$push
'
:
{
'
tags
'
:
gear_name
}})
...
...
@@ -977,28 +982,6 @@ def upgrade_to_26_closure(job):
else
:
return
'
Parallel failed: update doc
'
+
str
(
job
[
'
_id
'
])
+
'
resulted modified
'
+
str
(
result
.
modified_count
)
def
upgrade_to_26_test_closure
(
job
):
gear
=
config
.
db
.
gears
.
find_one
({
'
_id
'
:
bson
.
ObjectId
(
job
[
'
gear_id
'
])},
{
'
gear.name
'
:
1
})
# This logic WILL NOT WORK in parallel mode
if
gear
is
None
:
logging
.
info
(
'
No gear found for job
'
+
str
(
job
[
'
_id
'
]))
return
True
if
gear
.
get
(
'
gear
'
,
{}).
get
(
'
name
'
,
None
)
is
None
:
logging
.
info
(
'
No gear found for job
'
+
str
(
job
[
'
_id
'
]))
return
True
# This logic WILL NOT WORK in parallel mode
gear_name
=
gear
[
'
gear
'
][
'
name
'
]
gear_name_tag_count
=
0
# Checks if the specific gear tag already exists for the job
for
tag
in
job
[
'
tags
'
]:
if
tag
==
gear_name
:
gear_name_tag_count
=
gear_name_tag_count
+
1
if
gear_name_tag_count
>
1
:
raise
Exception
(
"
Job has multiple gear name tags
"
)
return
True
def
upgrade_to_26
():
"""
...
...
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