From 175d470e5925ce71db2969febe2c846822d1422b Mon Sep 17 00:00:00 2001 From: Roger Barker Date: Mon, 10 Jun 2024 11:25:20 -0500 Subject: [PATCH] Added docker-group Signed-off-by: Roger Barker --- .github/workflows/push-images.yaml | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/push-images.yaml b/.github/workflows/push-images.yaml index 1ad49ee8..7ffa5582 100644 --- a/.github/workflows/push-images.yaml +++ b/.github/workflows/push-images.yaml @@ -73,14 +73,14 @@ jobs: - name: Setup Control Groups run: | + set -x echo "::group::Get System Configuration" USR_ID="$(id -un)" GRP_ID="$(id -gn)" AGENT_MEM_LIMIT="2147483648" AGENT_GROUP_NAME="agent-${{ github.run_id }}" - echo ${USR_ID} - echo ${GRP_ID} - echo ${AGENT_GROUP_NAME} + DOCKER_MEM_LIMIT="30064771072" + DOCKER_GROUP_NAME="docker-${{ github.run_id }}" echo "::endgroup::" echo "::group::Install Control Group Tools" @@ -91,13 +91,17 @@ jobs: echo "::endgroup::" echo "::group::Create Control Groups" + sudo cgcreate -g cpu,memory:${DOCKER_GROUP_NAME} -a ${USR_ID}:${GRP_ID} -t ${USR_ID}:${GRP_ID} sudo cgcreate -g cpu,memory:${AGENT_GROUP_NAME} -a ${USR_ID}:${GRP_ID} -t ${USR_ID}:${GRP_ID} echo ::endgroup:: echo "::group::Set Control Group Limits" - sudo cgset -r cpu.shares=500 ${AGENT_GROUP_NAME} - sudo cgset -r memory.limit_in_bytes=${AGENT_MEM_LIMIT} ${AGENT_GROUP_NAME} - sudo cgset -r memory.memsw.limit_in_bytes=${AGENT_MEM_LIMIT} ${AGENT_GROUP_NAME} + cgset -r cpu.shares=768 ${DOCKER_GROUP_NAME} + cgset -r cpu.shares=500 ${AGENT_GROUP_NAME} + cgset -r memory.limit_in_bytes=${DOCKER_MEM_LIMIT} ${DOCKER_GROUP_NAME} + cgset -r memory.limit_in_bytes=${AGENT_MEM_LIMIT} ${AGENT_GROUP_NAME} + cgset -r memory.memsw.limit_in_bytes=${DOCKER_MEM_LIMIT} ${DOCKER_GROUP_NAME} + cgset -r memory.memsw.limit_in_bytes=${AGENT_MEM_LIMIT} ${AGENT_GROUP_NAME} echo "::endgroup::" echo "::group::Move Runner Processes to Control Group"