Skip to content

Commit 8eb8a6d

Browse files
authored
Merge pull request #62 from jmtd/podman
Some adjustments to use behave tests with Podman
2 parents 1c70cb2 + ac4b3a2 commit 8eb8a6d

3 files changed

Lines changed: 18 additions & 6 deletions

File tree

steps/container.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@
3535
# A future version of Cekit will expose this to us, for now we hard-code
3636
DOCKER_API_VERSION = "1.35"
3737

38-
d = docker.APIClient(version=DOCKER_API_VERSION)
38+
base_url = os.environ.get("DOCKER_HOST", docker.constants.DEFAULT_UNIX_SOCKET)
39+
d = docker.APIClient(version=DOCKER_API_VERSION, base_url=base_url)
3940

4041

4142
class ExecException(Exception):

steps/image_steps.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import os
12
import docker
23

34

@@ -6,7 +7,8 @@
67
# A future version of Cekit will expose this to us, for now we hard-code
78
DOCKER_API_VERSION = "1.35"
89

9-
DOCKER_CLIENT = docker.APIClient(version=DOCKER_API_VERSION)
10+
base_url = os.environ.get("DOCKER_HOST", docker.constants.DEFAULT_UNIX_SOCKET)
11+
DOCKER_CLIENT = docker.APIClient(version=DOCKER_API_VERSION, base_url=base_url)
1012

1113
@then(u'the image should contain label {label}')
1214
@then(u'the image should contain label {label} {check} value {value}')

steps/s2i_steps.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,19 @@ def s2i_inner(context, application, path='.', env="", incremental=False, tag="ma
2929
mirror = "-e 'MAVEN_MIRROR_URL=%s'" % os.getenv("MAVEN_MIRROR_URL")
3030

3131
image_id = "integ-" + context.image
32-
command = "s2i build --loglevel=5 --pull-policy if-not-present %s --context-dir=%s -r=%s %s %s %s %s %s %s" % (
33-
mirror, path, tag, env, application, context.image, image_id, "--incremental" if incremental else "",
34-
"--runtime-image="+runtime_image if runtime_image else ""
35-
)
32+
33+
command = f"""s2i build --loglevel=5 --pull-policy if-not-present\
34+
{mirror}\
35+
--context-dir={path}\
36+
-r={tag}\
37+
{env}\
38+
{application}\
39+
{context.image}\
40+
{image_id}\
41+
{"--incremental" if incremental else ""}\
42+
{"--runtime-image="+runtime_image if runtime_image else ""}\
43+
"""
44+
3645
logger.info("Executing new S2I build with the command [%s]..." % command)
3746

3847
success, output = _execute(command)

0 commit comments

Comments
 (0)