|
25 | 25 | DEFAULT_HOST_OS = "el9" |
26 | 26 | DEFAULT_MYSQL_VER = "mysql:8.4.4" |
27 | 27 | DEFAULT_ES_VER = "opensearchproject/opensearch:2.18.0" |
| 28 | +# In MacOSX with Arm (MX), there's an issue with opensearch |
| 29 | +# You *must* set the ES_PLATFORM flag to `linux/arm64` to make it work. |
| 30 | +DEFAULT_ES_PLATFORM = "linux/amd64" |
28 | 31 | DEFAULT_IAM_VER = "indigoiam/iam-login-service:v1.10.2" |
29 | 32 | FEATURE_VARIABLES = { |
30 | 33 | "DIRACOSVER": "master", |
|
36 | 39 | "INSTALLATION_BRANCH": "", |
37 | 40 | "DEBUG": "Yes", |
38 | 41 | } |
39 | | -DIRACX_OPTIONS = () |
40 | 42 | DEFAULT_MODULES = {"DIRAC": Path(__file__).parent.absolute()} |
| 43 | +# All services that have a FutureClient, but we *explicitly* deactivate |
| 44 | +# (for example if we did not finish to develop it) |
| 45 | +DIRACX_DISABLED_SERVICES = [ |
| 46 | + "WorkloadManagement/JobMonitoring", |
| 47 | +] |
41 | 48 |
|
42 | 49 | # Static configuration |
43 | 50 | DB_USER = "Dirac" |
|
71 | 78 | } |
72 | 79 | LOG_PATTERN = re.compile(r"^[\d\-]{10} [\d:]{8} UTC [^\s]+ ([A-Z]+):") |
73 | 80 |
|
| 81 | +# In niche cases where we use MacOSX with Orbstack, some commands may not work with docker compose |
| 82 | +# If you're in that case, set in your environment `export DOCKER_COMPOSE_CMD="docker-compose"` |
| 83 | +DOCKER_COMPOSE_CMD = shlex.split(os.environ.get("DOCKER_COMPOSE_CMD", "docker compose")) |
| 84 | + |
74 | 85 |
|
75 | 86 | class NaturalOrderGroup(typer.core.TyperGroup): |
76 | 87 | """Group for showing subcommands in the correct order""" |
@@ -140,6 +151,19 @@ def list_commands(self, ctx): |
140 | 151 | After restarting your terminal you command completion is available using: |
141 | 152 |
|
142 | 153 | typer ./integration_tests.py run ... |
| 154 | +
|
| 155 | +## DiracX |
| 156 | +
|
| 157 | +If you want to activate DiracX, you have to set the flag TEST_DIRACX to "Yes". |
| 158 | +It will search for legacy adapted services (services with a future client activated) |
| 159 | +and do the necessary to make DIRAC work alongside DiracX. |
| 160 | +
|
| 161 | +To deactivate a legacy adapted service (to pass CI for example), you have to add it in |
| 162 | +the `DIRACX_DISABLED_SERVICES` list. If you don't, the program will set this service to be used |
| 163 | +with DiracX, and if it is badly adapted, errors will be raised. |
| 164 | +
|
| 165 | +> Note that you can provide a DiracX project (repository, branch) by building it and providing |
| 166 | +the dist folder to the prepare-environment command. |
143 | 167 | """, |
144 | 168 | ) |
145 | 169 |
|
@@ -193,8 +217,8 @@ def destroy(): |
193 | 217 | typer.secho("Shutting down and removing containers", err=True, fg=c.GREEN) |
194 | 218 | with _gen_docker_compose(DEFAULT_MODULES) as docker_compose_fn: |
195 | 219 | os.execvpe( |
196 | | - "docker", |
197 | | - ["docker", "compose", "-f", docker_compose_fn, "down", "--remove-orphans", "-t", "0", "--volumes"], |
| 220 | + DOCKER_COMPOSE_CMD[0], |
| 221 | + [*DOCKER_COMPOSE_CMD, "-f", docker_compose_fn, "down", "--remove-orphans", "-t", "0", "--volumes"], |
198 | 222 | _make_env({}), |
199 | 223 | ) |
200 | 224 |
|
@@ -253,7 +277,7 @@ def prepare_environment( |
253 | 277 | typer.secho("Running docker compose to create containers", fg=c.GREEN) |
254 | 278 | with _gen_docker_compose(modules, diracx_dist_dir=diracx_dist_dir) as docker_compose_fn: |
255 | 279 | subprocess.run( |
256 | | - ["docker", "compose", "-f", docker_compose_fn, "up", "-d", "dirac-server", "dirac-client", "dirac-pilot"] |
| 280 | + [*DOCKER_COMPOSE_CMD, "-f", docker_compose_fn, "up", "-d", "dirac-server", "dirac-client", "dirac-pilot"] |
257 | 281 | + extra_services, |
258 | 282 | check=True, |
259 | 283 | env=docker_compose_env, |
@@ -360,7 +384,7 @@ def prepare_environment( |
360 | 384 | subStderr = open(docker_compose_fn_final / "stderr", "w") |
361 | 385 |
|
362 | 386 | subprocess.Popen( |
363 | | - ["docker", "compose", "-f", docker_compose_fn_final / "docker-compose.yml", "up", "-d", "diracx"], |
| 387 | + [*DOCKER_COMPOSE_CMD, "-f", docker_compose_fn_final / "docker-compose.yml", "up", "-d", "diracx"], |
364 | 388 | env=docker_compose_env, |
365 | 389 | stdin=None, |
366 | 390 | stdout=subStdout, |
@@ -569,7 +593,7 @@ def _gen_docker_compose(modules, *, diracx_dist_dir=None): |
569 | 593 | # Load the docker compose configuration and mount the necessary volumes |
570 | 594 | input_fn = Path(__file__).parent / "tests/CI/docker-compose.yml" |
571 | 595 | docker_compose = yaml.safe_load(input_fn.read_text()) |
572 | | - # diracx-wait-for-db needs the volume to be able to run the witing script |
| 596 | + # diracx-wait-for-db needs the volume to be able to run the waiting script |
573 | 597 | for ctn in ("dirac-server", "dirac-client", "dirac-pilot", "diracx-wait-for-db"): |
574 | 598 | if "volumes" not in docker_compose["services"][ctn]: |
575 | 599 | docker_compose["services"][ctn]["volumes"] = [] |
@@ -619,7 +643,7 @@ def _gen_docker_compose(modules, *, diracx_dist_dir=None): |
619 | 643 | def _check_containers_running(*, is_up=True): |
620 | 644 | with _gen_docker_compose(DEFAULT_MODULES) as docker_compose_fn: |
621 | 645 | running_containers = subprocess.run( |
622 | | - ["docker", "compose", "-f", docker_compose_fn, "ps", "-q", "-a"], |
| 646 | + [*DOCKER_COMPOSE_CMD, "-f", docker_compose_fn, "ps", "-q", "-a"], |
623 | 647 | stdout=subprocess.PIPE, |
624 | 648 | env=_make_env({}), |
625 | 649 | # docker compose ps has a non-zero exit code when no containers are running |
@@ -701,6 +725,7 @@ def _make_env(flags): |
701 | 725 | else: |
702 | 726 | env["MYSQL_ADMIN_COMMAND"] = "mysqladmin" |
703 | 727 | env["ES_VER"] = flags.pop("ES_VER", DEFAULT_ES_VER) |
| 728 | + env["ES_PLATFORM"] = flags.pop("ES_PLATFORM", DEFAULT_ES_PLATFORM) |
704 | 729 | env["IAM_VER"] = flags.pop("IAM_VER", DEFAULT_IAM_VER) |
705 | 730 | if "CVMFS_DIR" not in env or not Path(env["CVMFS_DIR"]).is_dir(): |
706 | 731 | typer.secho(f"CVMFS_DIR environment value: {env.get('CVMFS_DIR', 'NOT SET')}", fg=c.YELLOW) |
@@ -1163,10 +1188,16 @@ def _make_config(modules, flags, release_var, editable): |
1163 | 1188 | typer.secho(f"Required feature variable {key!r} is missing", err=True, fg=c.RED) |
1164 | 1189 | raise typer.Exit(code=1) |
1165 | 1190 |
|
1166 | | - # If we test DiracX, enable all the options |
| 1191 | + # If we test DiracX, add specific config |
1167 | 1192 | if config["TEST_DIRACX"].lower() in ("yes", "true"): |
1168 | | - for key in DIRACX_OPTIONS: |
1169 | | - config[key] = "Yes" |
| 1193 | + if DIRACX_DISABLED_SERVICES: |
| 1194 | + # We link all disabled services |
| 1195 | + # config["DIRACX_DISABLED_SERVICES"] = "Service1 Service2 Service3 ..." |
| 1196 | + diracx_disabled_services = " ".join(DIRACX_DISABLED_SERVICES) |
| 1197 | + |
| 1198 | + typer.secho(f"The following services won't be legacy adapted: {diracx_disabled_services}", fg="yellow") |
| 1199 | + |
| 1200 | + config["DIRACX_DISABLED_SERVICES"] = diracx_disabled_services |
1170 | 1201 |
|
1171 | 1202 | config["TESTREPO"] = [f"/home/dirac/LocalRepo/TestCode/{name}" for name in modules] |
1172 | 1203 | config["ALTERNATIVE_MODULES"] = [f"/home/dirac/LocalRepo/ALTERNATIVE_MODULES/{name}" for name in modules] |
|
0 commit comments