1
0
Fork 0
mirror of https://code.forgejo.org/forgejo/runner.git synced 2025-10-15 19:42:06 +00:00
forgejo-runner/act/container
Earl Warren 66a7e82c43
feat: allow --memory in workflow container options (#1079)
First hand experience to implement this feature can be found at https://codeberg.org/forgejo/forgejo/issues/9406. In a nutshell it is a service container in the CI that randomly uses massive amounts of memory (>50GB RSS) but normally less than 100MB.

---

See also the [matching documentation pull request](https://codeberg.org/forgejo/docs/pulls/1539).

---

It is already possible to limit the memory used by all containers in the config file:

```yaml
container:
  options: --memory 200M
```

This limit can be further reduced (but not increased) by the same option in a job:

```yaml
jobs:
  job:
    runs-on: docker
    container:
      image: code.forgejo.org/oci/node:20-bookworm
      options: --memory 200M
    steps:
      - run: echo OK
```

or a service container:

```yaml
job:
  my-job:
    runs-on: docker
    services:
      pgsql:
        image: postgres:15
        options: --memory 1G
```

Refs https://docs.docker.com/engine/containers/resource_constraints/#limit-a-containers-access-to-memory

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- features
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1079): <!--number 1079 --><!--line 0 --><!--description ZmVhdDogYWxsb3cgLS1tZW1vcnkgaW4gd29ya2Zsb3cgY29udGFpbmVyIG9wdGlvbnM=-->feat: allow --memory in workflow container options<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1079
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
Reviewed-by: Mathieu Fenniak <mfenniak@noreply.code.forgejo.org>
Co-authored-by: Earl Warren <contact@earl-warren.org>
Co-committed-by: Earl Warren <contact@earl-warren.org>
2025-10-10 14:33:07 +00:00
..
testdata refactor: filecollector into new package (#2174) 2024-01-30 00:46:45 +00:00
container_types.go chore: bump version to v11 (#940) 2025-09-05 07:29:38 +00:00
docker_auth.go chore: bump version to v11 (#940) 2025-09-05 07:29:38 +00:00
docker_build.go chore: bump version to v11 (#940) 2025-09-05 07:29:38 +00:00
docker_cli.go chore: remove github.com/pkg/errors (#873) 2025-08-28 09:33:52 +00:00
docker_cli_test.go chore: remove github.com/pkg/errors (#873) 2025-08-28 09:33:52 +00:00
docker_images.go chore: bump version to v11 (#940) 2025-09-05 07:29:38 +00:00
docker_images_test.go chore: use t.Context for tests, activate usetesting for lint + add t.TempDir and t.Chdir (#844) 2025-08-11 13:21:42 +00:00
DOCKER_LICENSE fix: support docker create arguments from container.options (#1022) (#1351) 2022-10-06 22:09:43 +00:00
docker_logger.go fix: fixes the build on FreeBSD (#882) 2025-08-18 06:01:33 +00:00
docker_network.go chore: bump version to v11 (#940) 2025-09-05 07:29:38 +00:00
docker_pull.go chore: bump version to v11 (#940) 2025-09-05 07:29:38 +00:00
docker_pull_test.go chore: use t.Context for tests, activate usetesting for lint + add t.TempDir and t.Chdir (#844) 2025-08-11 13:21:42 +00:00
docker_run.go feat: allow --memory in workflow container options (#1079) 2025-10-10 14:33:07 +00:00
docker_run_test.go chore: bump version to v11 (#940) 2025-09-05 07:29:38 +00:00
docker_stub.go chore: bump version to v11 (#940) 2025-09-05 07:29:38 +00:00
docker_volume.go chore: bump version to v11 (#940) 2025-09-05 07:29:38 +00:00
executions_environment.go chore: modernize code (#857) 2025-08-15 04:54:13 +00:00
host_environment.go fix: remove LXC backend leftovers when the job completes (#1054) 2025-10-03 16:14:08 +00:00
host_environment_test.go chore: use t.Context for tests, activate usetesting for lint + add t.TempDir and t.Chdir (#844) 2025-08-11 13:21:42 +00:00
linux_container_environment_extensions.go chore: modernize code (#857) 2025-08-15 04:54:13 +00:00
linux_container_environment_extensions_test.go chore: use t.Context for tests, activate usetesting for lint + add t.TempDir and t.Chdir (#844) 2025-08-11 13:21:42 +00:00
parse_env_file.go chore: bump version to v11 (#940) 2025-09-05 07:29:38 +00:00
util.go chore: upgrade golangci-lint and address findings (#1904) 2023-07-10 17:12:12 -07:00
util_openbsd_mips64.go feat: Host environment (#1293) 2022-11-16 21:29:45 +00:00
util_plan9.go feat: Host environment (#1293) 2022-11-16 21:29:45 +00:00
util_windows.go feat: Host environment (#1293) 2022-11-16 21:29:45 +00:00