File tree Expand file tree Collapse file tree 6 files changed +56
-0
lines changed
Expand file tree Collapse file tree 6 files changed +56
-0
lines changed Original file line number Diff line number Diff line change 1+ Fix the bug in parsing to add identify `extra-hosts` field in build parameters.
Original file line number Diff line number Diff line change @@ -3122,6 +3122,8 @@ def cleanup_temp_dockfile() -> None:
31223122 build_args .extend (["--platform" , cnt ["platform" ]])
31233123 for secret in build_desc .get ("secrets" , []):
31243124 build_args .extend (get_secret_args (compose , cnt , secret , podman_is_building = True ))
3125+ for i in build_desc .get ("extra_hosts" , []):
3126+ build_args .extend (["--add-host" , i ])
31253127 for tag in build_desc .get ("tags" , []):
31263128 build_args .extend (["-t" , tag ])
31273129 labels = build_desc .get ("labels" , [])
Original file line number Diff line number Diff line change 1+ FROM nopush/podman-compose-test
2+
3+ RUN getent hosts example.internal
Original file line number Diff line number Diff line change 1+ version : " 3"
2+ services :
3+ web1 :
4+ build :
5+ context : ./context
6+ dockerfile : Dockerfile
7+ extra_hosts :
8+ - " example.internal:127.0.0.1"
Original file line number Diff line number Diff line change 1+ # SPDX-License-Identifier: GPL-2.0
2+
3+ import os
4+ import unittest
5+
6+ from tests .integration .test_utils import RunSubprocessMixin
7+ from tests .integration .test_utils import podman_compose_path
8+ from tests .integration .test_utils import test_path
9+
10+
11+ def compose_yaml_path () -> str :
12+ """Returns the path to the compose file used for this test module"""
13+ base_path = os .path .join (test_path (), "extra_hosts" )
14+ return os .path .join (base_path , "docker-compose.yml" )
15+
16+
17+ class TestComposeExtraHosts (unittest .TestCase , RunSubprocessMixin ):
18+ def test_extra_hosts (self ) -> None :
19+ try :
20+ self .run_subprocess_assert_returncode ([
21+ podman_compose_path (),
22+ "-f" ,
23+ compose_yaml_path (),
24+ "build" ,
25+ "--no-cache" ,
26+ ])
27+
28+ self .run_subprocess_assert_returncode ([
29+ podman_compose_path (),
30+ "-f" ,
31+ compose_yaml_path (),
32+ "up" ,
33+ "-d" ,
34+ ])
35+
36+ finally :
37+ self .run_subprocess_assert_returncode ([
38+ podman_compose_path (),
39+ "-f" ,
40+ compose_yaml_path (),
41+ "down" ,
42+ ])
You can’t perform that action at this time.
0 commit comments