Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
funkwhale
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
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
Service Desk
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
Martin Giger
funkwhale
Commits
dc6f2e4f
Verified
Commit
dc6f2e4f
authored
5 years ago
by
Eliot Berriot
Browse files
Options
Downloads
Patches
Plain Diff
Added script to check if a given version is the latest
parent
60758358
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
docs/get-releases-json.py
+2
-0
2 additions, 0 deletions
docs/get-releases-json.py
scripts/is-docker-latest.py
+40
-0
40 additions, 0 deletions
scripts/is-docker-latest.py
with
42 additions
and
0 deletions
docs/get-releases-json.py
100644 → 100755
+
2
−
0
View file @
dc6f2e4f
#!/usr/bin/env python3
import
json
import
subprocess
...
...
This diff is collapsed.
Click to expand it.
scripts/is-docker-latest.py
0 → 100755
+
40
−
0
View file @
dc6f2e4f
#!/usr/bin/env python3
import
argparse
import
json
import
sys
from
distutils.version
import
StrictVersion
def
main
(
current
,
releases_json
):
try
:
version
=
StrictVersion
(
current
)
except
ValueError
:
print
(
"
Version number
'
{}
'
isn
'
t valid
"
.
format
(
current
))
sys
.
exit
(
1
)
releases
=
json
.
loads
(
releases_json
)
latest_release
=
releases
[
"
releases
"
][
0
][
"
id
"
]
if
version
!=
latest_release
:
print
(
"
Version number
'
{}
'
doesn
'
t match latest release {}
"
.
format
(
current
,
latest_release
)
)
sys
.
exit
(
1
)
print
(
"
Version number
'
{}
'
is latest release!
"
.
format
(
current
))
if
__name__
==
"
__main__
"
:
parser
=
argparse
.
ArgumentParser
(
description
=
"""
Exit with code 0 if the given version matches the latest one
fron the list of releases found in releases_json. Primary use
is to check whether the current version can be safely pushed
as the latest one on the docker Hub.
"""
)
parser
.
add_argument
(
"
current
"
,
help
=
"
Current version
"
)
parser
.
add_argument
(
"
releases_json
"
,
type
=
argparse
.
FileType
(
"
r
"
))
args
=
parser
.
parse_args
()
main
(
args
.
current
,
args
.
releases_json
.
read
())
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