2022-12-24 16:41:27 +00:00
|
|
|
version = node.metadata.get('woodpecker-agent/version')
|
|
|
|
|
|
|
|
directories['/var/lib/woodpecker'] = {
|
|
|
|
'owner': 'woodpecker',
|
|
|
|
}
|
|
|
|
|
|
|
|
actions['install_woodpecker-agent'] = {
|
|
|
|
'command': ' && '.join([
|
|
|
|
f'wget -q -O/tmp/woodpecker-agent.deb https://github.com/woodpecker-ci/woodpecker/releases/download/v{version}/woodpecker-agent_{version}_amd64.deb',
|
|
|
|
'dpkg -i /tmp/woodpecker-agent.deb',
|
|
|
|
]),
|
|
|
|
'unless': f'''bash -c "[[ \"$(woodpecker-agent --version | cut -d' ' -f3)\" == "{version}" ]]"''',
|
2022-12-24 17:22:29 +00:00
|
|
|
'triggers': {
|
2022-12-24 16:41:27 +00:00
|
|
|
'svc_systemd:woodpecker-agent:restart',
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
files['/usr/local/lib/systemd/system/woodpecker-agent.service'] = {
|
|
|
|
'content_type': 'mako',
|
|
|
|
'context': {
|
|
|
|
'env': node.metadata.get('woodpecker-agent/environment'),
|
|
|
|
},
|
|
|
|
'triggers': {
|
|
|
|
'action:systemd-reload',
|
|
|
|
'svc_systemd:woodpecker-agent:restart',
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
svc_systemd['woodpecker-agent'] = {
|
|
|
|
'after': {
|
|
|
|
# to make sure we have docker and other eventual dependencies
|
|
|
|
'pkg_apt:',
|
|
|
|
},
|
|
|
|
'needs': {
|
|
|
|
'action:install_woodpecker-agent',
|
|
|
|
'file:/usr/local/lib/systemd/system/woodpecker-agent.service',
|
|
|
|
'user:woodpecker',
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
users['woodpecker'] = {
|
|
|
|
'home': '/var/lib/woodpecker',
|
|
|
|
}
|