Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Backend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Arkindex
Backend
Merge requests
!2509
Create RecommendedWorkerVersionRetrieve endpoint
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Create RecommendedWorkerVersionRetrieve endpoint
wv-rec
into
release-1.7.2
Overview
12
Commits
5
Pipelines
0
Changes
3
Merged
ml bonhomme
requested to merge
wv-rec
into
release-1.7.2
2 months ago
Overview
10
Commits
5
Pipelines
0
Changes
1
Expand
closes
#1888 (closed)
0
0
Merge request reports
Compare
version 2
version 11
96184c8c
2 months ago
version 10
5d46d386
2 months ago
version 9
bfbd38ec
2 months ago
version 8
7d5eec1e
2 months ago
version 7
b17010a4
2 months ago
version 6
02a4835d
2 months ago
version 5
1b2d4db0
2 months ago
version 4
1b2d4db0
2 months ago
version 3
6623a37e
2 months ago
version 2
232b34d0
2 months ago
version 1
d1cd3e09
2 months ago
release-1.7.2 (base)
and
version 3
latest version
d8b4ed5d
5 commits,
2 months ago
version 11
96184c8c
5 commits,
2 months ago
version 10
5d46d386
4 commits,
2 months ago
version 9
bfbd38ec
4 commits,
2 months ago
version 8
7d5eec1e
3 commits,
2 months ago
version 7
b17010a4
3 commits,
2 months ago
version 6
02a4835d
3 commits,
2 months ago
version 5
1b2d4db0
2 commits,
2 months ago
version 4
1b2d4db0
3 commits,
2 months ago
version 3
6623a37e
2 commits,
2 months ago
version 2
232b34d0
1 commit,
2 months ago
version 1
d1cd3e09
1 commit,
2 months ago
Show latest version
1 file
+
3
−
1
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
arkindex/process/api.py
+
3
−
1
Options
@@ -1180,12 +1180,14 @@ class RecommendedWorkerVersionRetrieve(RetrieveAPIView):
# tag_as_int is created by splitting on an eventual '-' so if we have '0.3.2' and '0.3.2-rc2' they both have 32
# as `tag_as_int`. The second ordering by tag (regular alphabetical ordering) ensures that the main version (0.3.2)
# is returned in this case.
# The concatenation of a 0 at the beginning of each tag_as_int ensures that the casting to integer will always work,
# even if after applying the regex we end up with an empty string.
# This will not order such version tags satisfactorily if the '-rc{number}' part goes beyond 9, as this is
# alphabetical ordering so 1 > 10 > 2 > 3 > 4 etc.
return
(
self
.
worker
.
versions
.
filter
(
tag__isnull
=
False
)
.
filter
(
state
=
WorkerVersionState
.
Available
)
\
.
annotate
(
tag_as_int
=
RawSQL
(
"
split_part(regexp_replace(tag,
'
[^0-9-]
'
,
''
,
'
g
'
),
'
-
'
, 1)::int
"
,
[]))
.
annotate
(
tag_as_int
=
RawSQL
(
"
concat(
'
0
'
,
split_part(regexp_replace(tag,
'
[^0-9-]
'
,
''
,
'
g
'
),
'
-
'
, 1)
)
::int
"
,
[]))
.
using
(
"
default
"
)
\
.
select_related
(
"
worker__type
"
)
\
.
distinct
()
\
Loading