bundlewrap/bundles/woodpecker-server/items.py

41 lines
1.2 KiB
Python

version = node.metadata.get('woodpecker-server/version')
directories['/var/lib/woodpecker'] = {
'owner': 'woodpecker',
}
actions['install_woodpecker-server'] = {
'command': ' && '.join([
f'wget -q -O/tmp/woodpecker-server.deb https://github.com/woodpecker-ci/woodpecker/releases/download/v{version}/woodpecker-server_{version}_amd64.deb',
'dpkg -i /tmp/woodpecker-server.deb',
]),
'unless': f'''bash -c "[[ \"$(woodpecker-server --version | cut -d' ' -f3)\" == "{version}" ]]"''',
'triggers': {
'svc_systemd:woodpecker-server:restart',
},
}
files['/usr/local/lib/systemd/system/woodpecker-server.service'] = {
'content_type': 'mako',
'context': {
'env': node.metadata.get('woodpecker-server/environment'),
},
'triggers': {
'action:systemd-reload',
'svc_systemd:woodpecker-server:restart',
},
}
svc_systemd['woodpecker-server'] = {
'needs': {
'action:install_woodpecker-server',
'file:/usr/local/lib/systemd/system/woodpecker-server.service',
'postgres_db:woodpecker',
'postgres_role:woodpecker',
'user:woodpecker',
},
}
users['woodpecker'] = {
'home': '/var/lib/woodpecker',
}