Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 187: make sure 'jenkins-agent' is allowed to use cron #189

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion modules/profile/manifests/jenkins/agent.pp
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,19 @@
require => User[$agent_username],
}

# ensure jenkins-agent user is allowed to use cron
file { "/etc/cron.allow":
mode => '0600',
owner => 'root',
group => 'root',
ensure => 'file',
}
file_line { 'allow_jenkins_user_to_use_cron':
path => '/etc/cron.allow',
line => "${agent_username}",
require => File['/etc/cron.allow'],
}

# clean up containers and dangling images https://github.com/docker/docker/issues/928#issuecomment-58619854
cron {'docker_cleanup_images':
command => "bash -c \"python3 -u /home/${agent_username}/cleanup_docker_images.py --minimum-free-percent 10 --minimum-free-space 50\"",
Expand All @@ -123,7 +136,7 @@
hour => '*',
minute => '*/15',
weekday => absent,
require => User[$agent_username],
require => [ User[$agent_username], File_line['allow_jenkins_user_to_use_cron'] ],
}

exec { 'systemctl-daemon-reload':
Expand Down