Skip to content

Commit f3d6e03

Browse files
committed
fix: actually mounting volumes
1 parent 1f30699 commit f3d6e03

File tree

2 files changed

+27
-5
lines changed

2 files changed

+27
-5
lines changed

integration_tests.py

+10-5
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ def destroy():
181181
with _gen_docker_compose(DEFAULT_MODULES) as docker_compose_fn:
182182
os.execvpe(
183183
"docker",
184-
["docker", "compose", "-f", docker_compose_fn, "down", "--remove-orphans", "-t", "0"],
184+
["docker", "compose", "-f", docker_compose_fn, "down", "--remove-orphans", "-t", "0", "--volumes"],
185185
_make_env({}),
186186
)
187187

@@ -510,16 +510,21 @@ class TestExit(typer.Exit):
510510

511511
@contextmanager
512512
def _gen_docker_compose(modules):
513-
# Load the docker-compose configuration and mount the necessary volumes
513+
# Load the docker compose configuration and mount the necessary volumes
514514
input_fn = Path(__file__).parent / "tests/CI/docker-compose.yml"
515515
docker_compose = yaml.safe_load(input_fn.read_text())
516+
for ctn in ("dirac-server", "dirac-client"):
517+
if "volumes" not in docker_compose["services"][ctn]:
518+
docker_compose["services"][ctn]["volumes"] = []
516519
volumes = [f"{path}:/home/dirac/LocalRepo/ALTERNATIVE_MODULES/{name}" for name, path in modules.items()]
517520
volumes += [f"{path}:/home/dirac/LocalRepo/TestCode/{name}" for name, path in modules.items()]
518-
docker_compose["services"]["dirac-server"]["volumes"] = volumes[:]
519-
docker_compose["services"]["dirac-client"]["volumes"] = volumes[:]
521+
docker_compose["services"]["dirac-server"]["volumes"].extend(volumes[:])
522+
docker_compose["services"]["dirac-client"]["volumes"].extend(volumes[:])
523+
524+
module_configs = _load_module_configs(modules)
520525

521526
# Add any extension services
522-
for module_name, module_configs in _load_module_configs(modules).items():
527+
for module_name, module_configs in module_configs.items():
523528
for service_name, service_config in module_configs["extra-services"].items():
524529
typer.secho(f"Adding service {service_name} for {module_name}", err=True, fg=c.GREEN)
525530
docker_compose["services"][service_name] = service_config.copy()

tests/CI/docker-compose.yml

+17
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
volumes:
2+
# Volume used to store the certificates of dirac
3+
certs_data:
24
# Volume used to store the jwks of the IAM service
35
diracx-iam-key-store:
46

@@ -88,6 +90,15 @@ services:
8890
- debug=true
8991
pull_policy: always
9092

93+
dirac-init-certificates:
94+
image: ghcr.io/diracgrid/management/certificates-generation:latest
95+
container_name: dirac-init-certificates
96+
volumes:
97+
- certs_data:/ca/certs/
98+
entrypoint: |
99+
/entrypoint.sh
100+
pull_policy: always
101+
91102
dirac-server:
92103
image: ${CI_REGISTRY_IMAGE}/${HOST_OS}-dirac
93104
container_name: server
@@ -98,8 +109,12 @@ services:
98109
condition: service_healthy
99110
elasticsearch:
100111
condition: service_healthy
112+
dirac-init-certificates:
113+
condition: service_completed_successfully # Let the init container create the certificates
101114
ulimits:
102115
nofile: 8192
116+
volumes:
117+
- certs_data:/ca/certs
103118
pull_policy: always
104119
command: ["sleep", "infinity"] # This is necessary because of the issue described in https://github.com/moby/moby/issues/42275. What is added here is a hack/workaround.
105120

@@ -111,6 +126,8 @@ services:
111126
user: "${DIRAC_UID}:${DIRAC_GID}"
112127
depends_on:
113128
- dirac-server
129+
volumes:
130+
- certs_data:/ca/certs
114131
ulimits:
115132
nofile: 8192
116133
pull_policy: always

0 commit comments

Comments
 (0)