- job: name: tcwg-cleanup-stale-containers project-type: freestyle defaults: global properties: - authorization: anonymous: - job-read - job-extended-read linaro: - job-build - job-cancel - build-discarder: days-to-keep: 30 num-to-keep: 100 - throttle: max-per-node: 1 option: project parameters: - label: name: slave_list default: tcwg-apm_64-build || tcwg-apm_64-test || tcwg-bmk-coordinator || tcwg-coordinator || tcwg-d05-01 || tcwg-lc_64-build || tcwg-sq_64-build || tcwg-thx1-01 || tcwg-tk1_32-build || tcwg-x86_64-build || tcwg-x86_64-cam all-nodes: true matching-label: 'allCases' node-eligibility: 'ignore-offline' description: 'Machines to run on' - string: name: cleanup_running_hours default: '10' description: 'Delete containers that are more then "hours" old. Use "0" to disable time check. Use negative values for dry-run.' - string: name: cleanup_stopped_hours default: '240' description: 'Delete containers that are more then "hours" old. Use "0" to disable the cleanup. Use negative values for dry-run.' - string: name: cleanup_ssh_agent_hours default: '48' description: 'Kill ssh-agent processes that are more then "hours" old. Use "0" to disable time check.' - choice: name: cleanup_volumes choices: - 'node_default' - 'false' - 'true' description: 'Whether to cleanup dangling volumes' - bool: name: cleanup_images default: 'true' description: 'Whether to cleanup images' - bool: name: verbose default: 'false' description: 'Whether to be verbose' - string: name: scripts_branch default: refs/heads/master description: 'Scripts revision to use' disabled: false concurrent: false display-name: 'TCWG CCC Cleanup stale containers' triggers: - timed: '@daily' scm: - git: url: https://git-us.linaro.org/toolchain/jenkins-scripts.git refspec: +refs/heads/*:refs/remotes/origin/* +refs/changes/*:refs/changes/* branches: - ${scripts_branch} skip-tag: true shallow-clone: true wipe-workspace: true wrappers: - timeout: timeout: 600 - timestamps - build-name: name: '#${BUILD_NUMBER}-${NODE_NAME}' builders: - shell: | #!/bin/bash set -ex case "$NODE_NAME" in tcwg-bmk-dev-*) # tcwg-bmk-dev-* nodes are hosted on dev-* machines, aka # tcwg-x86_64-dev-* nodes. We only need to cleanup ssh-agent # processes for tcwg-benchmark user, so disable all other # cleanups. cleanup_running_hours=0 cleanup_stopped_hours=0 cleanup_volumes=false cleanup_images=false ignore_result=true ;; *) ignore_result=false ;; esac case "$cleanup_volumes:$NODE_NAME" in node_default:tcwg-d05-*|node_default:tcwg-dev-*|node_default:tcwg-thx1-*) cleanup_volumes=false ;; *) cleanup_volumes=true ;; esac ./tcwg-cleanup-stale-containers.sh --cleanup-running-hours $cleanup_running_hours --cleanup-stopped-hours $cleanup_stopped_hours --cleanup-ssh-agent-hours $cleanup_ssh_agent_hours --cleanup-volumes $cleanup_volumes --cleanup-images $cleanup_images --verbose $verbose & res=0 && wait $! || res=$? if [ x"$res" != "x0" ]; then $ignore_result fi publishers: - email-ext: recipients: tcwg-validation@linaro.org aborted: true