]> git.ipfire.org Git - pakfire.git/commitdiff
build: Ignore if cgroup limits could not be applied
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 14 Dec 2024 16:18:38 +0000 (16:18 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 14 Dec 2024 16:18:38 +0000 (16:18 +0000)
This should ideally not happen in a real environment, but sadly is a
restriction we have in Jenkins when we are running the tests.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/build.c

index 2df93a737d456a086cba8940fd5f4b9a85a574a2..2eb3050cbfcec89e2e43b52bd7092ea924b90941 100644 (file)
@@ -1378,16 +1378,32 @@ static int pakfire_build_setup_cgroup(struct pakfire_build* build) {
                "memory_guaranteed", PAKFIRE_BUILD_MEMORY_GUARANTEED);
        if (memory_guaranteed) {
                r = pakfire_cgroup_set_guaranteed_memory(build->cgroup, memory_guaranteed);
-               if (r)
-                       goto ERROR;
+               if (r < 0) {
+                       switch (-r) {
+                               case ENOTSUP:
+                                       ERROR(build->ctx, "Could not apply the memory guarantee. Ignoring.\n");
+                                       break;
+
+                               default:
+                                       goto ERROR;
+                       }
+               }
        }
 
        // Limit memory
        size_t memory_limit = pakfire_config_get_bytes(config, "build", "memory_limit", 0);
        if (memory_limit) {
                r = pakfire_cgroup_set_memory_limit(build->cgroup, memory_limit);
-               if (r)
-                       goto ERROR;
+               if (r < 0) {
+                       switch (-r) {
+                               case ENOTSUP:
+                                       ERROR(build->ctx, "Could not apply the memory limit. Ignoring.\n");
+                                       break;
+
+                               default:
+                                       goto ERROR;
+                       }
+               }
        }
 
        // Set PID limit
@@ -1395,8 +1411,16 @@ static int pakfire_build_setup_cgroup(struct pakfire_build* build) {
                "pid_limit", PAKFIRE_BUILD_PID_LIMIT);
        if (pid_limit) {
                r = pakfire_cgroup_set_pid_limit(build->cgroup, pid_limit);
-               if (r)
-                       goto ERROR;
+               if (r < 0) {
+                       switch (-r) {
+                               case ENOTSUP:
+                                       ERROR(build->ctx, "Could not apply the PID limit. Ignoring.\n");
+                                       break;
+
+                               default:
+                                       goto ERROR;
+                       }
+               }
        }
 
 ERROR: