Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
H
heptapod-docker
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
Container Registry
Model registry
Operate
Environments
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
heptapod
heptapod-docker
Commits
4ff63b9757b6
Commit
4ff63b9757b6
authored
1 day ago
by
Georges Racinet
Browse files
Options
Downloads
Patches
Plain Diff
launch: using the configuration file to choose between podamn and docker
parent
1a82dc61c279
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#101675
failed
13 hours ago
Stage: test
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
launch
+18
-4
18 additions, 4 deletions
launch
with
18 additions
and
4 deletions
launch
+
18
−
4
View file @
4ff63b97
...
@@ -9,6 +9,7 @@
...
@@ -9,6 +9,7 @@
import
re
import
re
import
subprocess
import
subprocess
import
tarfile
import
tarfile
import
tomllib
# available in Python≥3.11
HOME
=
os
.
environ
[
'
HOME
'
]
HOME
=
os
.
environ
[
'
HOME
'
]
# ! Docker context directory for the *heptapod-dev* image!
# ! Docker context directory for the *heptapod-dev* image!
...
@@ -94,6 +95,9 @@
...
@@ -94,6 +95,9 @@
parser
.
add_argument
(
'
-s
'
,
'
--simulate
'
,
action
=
'
store_true
'
,
parser
.
add_argument
(
'
-s
'
,
'
--simulate
'
,
action
=
'
store_true
'
,
help
=
"
Output configuration instead of
"
help
=
"
Output configuration instead of
"
"
executing commands
"
)
"
executing commands
"
)
parser
.
add_argument
(
'
--config
'
,
help
=
"
Path to configuration file (TOML)
"
,
default
=
'
config.toml
'
)
vol_group
=
parser
.
add_argument_group
(
"
Docker volumes options
"
)
vol_group
=
parser
.
add_argument_group
(
"
Docker volumes options
"
)
vol_group
.
add_argument
(
'
--volumes-dir
'
,
vol_group
.
add_argument
(
'
--volumes-dir
'
,
help
=
"
Base directory for the three standard
"
help
=
"
Base directory for the three standard
"
...
@@ -125,7 +129,8 @@
...
@@ -125,7 +129,8 @@
run_group
.
add_argument
(
'
--http-port
'
,
type
=
int
,
default
=
8081
)
run_group
.
add_argument
(
'
--http-port
'
,
type
=
int
,
default
=
8081
)
run_group
.
add_argument
(
'
--ssh-port
'
,
type
=
int
,
default
=
2022
)
run_group
.
add_argument
(
'
--ssh-port
'
,
type
=
int
,
default
=
2022
)
run_group
.
add_argument
(
'
--container-name
'
,
default
=
'
heptapod
'
)
run_group
.
add_argument
(
'
--container-name
'
,
default
=
'
heptapod
'
)
run_group
.
add_argument
(
'
--podman
'
,
action
=
"
store_true
"
)
run_group
.
add_argument
(
'
--driver
'
,
help
=
"
docker or podman, defaults to config file
"
)
run_group
.
add_argument
(
'
--root-password
'
,
default
=
'
5iveL!fe
'
,
run_group
.
add_argument
(
'
--root-password
'
,
default
=
'
5iveL!fe
'
,
help
=
"
Force the value of root password in
"
help
=
"
Force the value of root password in
"
"
the Heptapod instance. By default, is the
"
"
the Heptapod instance. By default, is the
"
...
@@ -145,6 +150,13 @@
...
@@ -145,6 +150,13 @@
"
container if already present
"
)
"
container if already present
"
)
parsed_args
=
parser
.
parse_args
()
parsed_args
=
parser
.
parse_args
()
if
os
.
path
.
exists
(
parsed_args
.
config
):
with
open
(
parsed_args
.
config
,
'
rb
'
)
as
fobj
:
config
=
tomllib
.
load
(
fobj
)
else
:
config
=
{}
common_config
=
config
.
get
(
'
common
'
,
{})
simulate
=
parsed_args
.
simulate
simulate
=
parsed_args
.
simulate
volumes_dir
=
get_volumes_dir
(
parsed_args
,
parser
)
volumes_dir
=
get_volumes_dir
(
parsed_args
,
parser
)
...
@@ -155,6 +167,5 @@
...
@@ -155,6 +167,5 @@
image_tag
=
parsed_args
.
image_tag
image_tag
=
parsed_args
.
image_tag
run_image_tag
=
image_tag
run_image_tag
=
image_tag
podman
=
bool
(
parsed_args
.
podman
)
pull
=
not
bool
(
parsed_args
.
no_pull
)
pull
=
not
bool
(
parsed_args
.
no_pull
)
...
@@ -159,6 +170,9 @@
...
@@ -159,6 +170,9 @@
pull
=
not
bool
(
parsed_args
.
no_pull
)
pull
=
not
bool
(
parsed_args
.
no_pull
)
docker
=
'
podman
'
if
podman
else
'
docker
'
docker
=
parsed_args
.
driver
if
docker
is
None
:
docker
=
common_config
.
get
(
'
driver
'
,
'
docker
'
)
is_podman
=
docker
==
'
podman
'
full_image_tag
=
f
'
{
parsed_args
.
image_repo
}
:
{
run_image_tag
}
'
full_image_tag
=
f
'
{
parsed_args
.
image_repo
}
:
{
run_image_tag
}
'
...
@@ -207,7 +221,7 @@
...
@@ -207,7 +221,7 @@
print
()
print
()
if
pull
:
if
pull
:
subprocess
.
check_call
(
pull_cmd
)
subprocess
.
check_call
(
pull_cmd
)
if
podman
:
if
is_
podman
:
ensure_volumes
(
bind_mounts
)
ensure_volumes
(
bind_mounts
)
subprocess
.
check_call
(
run_cmd
)
subprocess
.
check_call
(
run_cmd
)
print
()
print
()
...
...
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