Skip to content

Commit

Permalink
Merge pull request #223 from owncloud/update-drone-starlark-20190928
Browse files Browse the repository at this point in the history
Update drone starlark code
  • Loading branch information
individual-it authored Sep 29, 2019
2 parents 141b19a + dc2111d commit d780b81
Showing 1 changed file with 57 additions and 35 deletions.
92 changes: 57 additions & 35 deletions .drone.starlark
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,11 @@ def phpstan():
'base': '/var/www/owncloud',
'path': 'server/apps/%s' % config['app']
},
'steps': [
installCore('daily-master-qa', 'sqlite', False),
setupServerAndApp(phpVersion, params['logLevel']),
'steps':
installCore('daily-master-qa', 'sqlite', False) +
installApp(phpVersion) +
setupServerAndApp(phpVersion, params['logLevel']) +
[
{
'name': 'phpstan',
'image': 'owncloudci/php:%s' % phpVersion,
Expand Down Expand Up @@ -314,8 +316,9 @@ def phan():
'base': '/var/www/owncloud',
'path': 'server/apps/%s' % config['app']
},
'steps': [
installCore('daily-master-qa', 'sqlite', False),
'steps':
installCore('daily-master-qa', 'sqlite', False) +
[
{
'name': 'phan',
'image': 'owncloudci/php:%s' % phpVersion,
Expand Down Expand Up @@ -382,9 +385,11 @@ def javascript():
'base': '/var/www/owncloud',
'path': 'server/apps/%s' % config['app']
},
'steps': [
installCore('daily-master-qa', 'sqlite', False),
setupServerAndApp('7.0', params['logLevel']),
'steps':
installCore('daily-master-qa', 'sqlite', False) +
installApp('7.0') +
setupServerAndApp('7.0', params['logLevel']) +
[
params['extraSetup'],
{
'name': 'js-tests',
Expand Down Expand Up @@ -502,10 +507,12 @@ def phptests(testType):
'base': '/var/www/owncloud',
'path': 'server/apps/%s' % config['app']
},
'steps': [
installCore('daily-master-qa', db, False),
installExtraApps(phpVersion, params['extraApps']),
setupServerAndApp(phpVersion, params['logLevel']),
'steps':
installCore('daily-master-qa', db, False) +
installApp(phpVersion) +
installExtraApps(phpVersion, params['extraApps']) +
setupServerAndApp(phpVersion, params['logLevel']) +
[
params['extraSetup'],
{
'name': '%s-tests' % testType,
Expand Down Expand Up @@ -655,10 +662,10 @@ def acceptance():
'base': '/var/www/owncloud',
'path': 'testrunner/apps/%s' % config['app']
},
'steps': [
installCore(server, db, params['useBundledApp']),
installTestrunner(phpVersion, params['useBundledApp'])
] + ([
'steps':
installCore(server, db, params['useBundledApp']) +
installTestrunner(phpVersion, params['useBundledApp']) +
([
{
'name': 'install-federation',
'image': 'owncloudci/core',
Expand All @@ -684,12 +691,16 @@ def acceptance():
]
},
owncloudLog('federated')
] if params['federatedServerNeeded'] else []) + [
installExtraApps(phpVersion, params['extraApps']),
setupServerAndApp(phpVersion, params['logLevel']),
] if params['federatedServerNeeded'] else []) +
installApp(phpVersion) +
installExtraApps(phpVersion, params['extraApps']) +
setupServerAndApp(phpVersion, params['logLevel']) +
[
owncloudLog('server'),
params['extraSetup'],
fixPermissions(phpVersion, params['federatedServerNeeded']),
] +
fixPermissions(phpVersion, params['federatedServerNeeded']) +
[
({
'name': 'acceptance-tests',
'image': 'owncloudci/php:%s' % phpVersion,
Expand Down Expand Up @@ -930,10 +941,10 @@ def installCore(version, db, useBundledApp):
if not useBundledApp:
stepDefinition['settings']['exclude'] = 'apps/%s' % config['app']

return stepDefinition
return [stepDefinition]

def installTestrunner(phpVersion, useBundledApp):
return {
return [{
'name': 'install-testrunner',
'image': 'owncloudci/php:%s' % phpVersion,
'pull': 'always',
Expand All @@ -947,12 +958,12 @@ def installTestrunner(phpVersion, useBundledApp):
'cd /var/www/owncloud/testrunner',
'make install-composer-deps vendor-bin-deps'
]
}
}]

def installExtraApps(phpVersion, extraApps):
if type(extraApps) == "list":
if extraApps == []:
return None
return []
apps = {}
for app in extraApps:
apps[app] = None
Expand All @@ -965,30 +976,41 @@ def installExtraApps(phpVersion, extraApps):
for app, command in apps.items():
commandArray.append('git clone https://github.com/owncloud/%s.git /var/www/owncloud/testrunner/apps/%s' % (app, app))
commandArray.append('cp -r /var/www/owncloud/testrunner/apps/%s /var/www/owncloud/server/apps/' % app)
if (command != None):
if ((command != None) and (command != '')):
commandArray.append('cd /var/www/owncloud/server/apps/%s' % app)
commandArray.append(command)
commandArray.append('cd /var/www/owncloud/server')
commandArray.append('php occ a:l')
commandArray.append('php occ a:e %s' % app)
commandArray.append('php occ a:l')

return {
return [{
'name': 'install-extra-apps',
'image': 'owncloudci/php:%s' % phpVersion,
'pull': 'always',
'commands': commandArray
}
}]

def setupServerAndApp(phpVersion, logLevel):
return {
'name': 'setup-server-%s' % config['app'],
def installApp(phpVersion):
if 'appInstallCommand' not in config:
return []

return [{
'name': 'install-app-%s' % config['app'],
'image': 'owncloudci/php:%s' % phpVersion,
'pull': 'always',
'commands': ([
'commands': [
'cd /var/www/owncloud/server/apps/%s' % config['app'],
config['appInstallCommand']
] if 'appInstallCommand' in config else []) + [
]
}]

def setupServerAndApp(phpVersion, logLevel):
return [{
'name': 'setup-server-%s' % config['app'],
'image': 'owncloudci/php:%s' % phpVersion,
'pull': 'always',
'commands': [
'cd /var/www/owncloud/server',
'php occ a:l',
'php occ a:e %s' % config['app'],
Expand All @@ -997,10 +1019,10 @@ def setupServerAndApp(phpVersion, logLevel):
'php occ config:system:set trusted_domains 1 --value=server',
'php occ log:manage --level %s' % logLevel,
]
}
}]

def fixPermissions(phpVersion, federatedServerNeeded):
return {
return [{
'name': 'fix-permissions',
'image': 'owncloudci/php:%s' % phpVersion,
'pull': 'always',
Expand All @@ -1009,7 +1031,7 @@ def fixPermissions(phpVersion, federatedServerNeeded):
] + ([
'chown -R www-data /var/www/owncloud/federated'
] if federatedServerNeeded else [])
}
}]

def owncloudLog(server):
return {
Expand Down

0 comments on commit d780b81

Please sign in to comment.