Skip to content

Commit

Permalink
Added docker-group
Browse files Browse the repository at this point in the history
Signed-off-by: Roger Barker <[email protected]>
  • Loading branch information
rbarkerSL committed Jun 10, 2024
1 parent 7f83996 commit 175d470
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions .github/workflows/push-images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down

0 comments on commit 175d470

Please sign in to comment.