mirror of
https://github.com/openstf/stf
synced 2025-10-04 18:29:17 +02:00
Implement APK uploads using the new storage system. Installation from URL still does not work, and dropping the file on the screen may not work either.
This commit is contained in:
parent
1db48e9fcb
commit
41ed33f5c4
17 changed files with 389 additions and 336 deletions
85
lib/cli.js
85
lib/cli.js
|
@ -403,6 +403,9 @@ program
|
|||
.option('--storage-plugin-image-url <url>'
|
||||
, 'URL to image storage plugin'
|
||||
, String)
|
||||
.option('--storage-plugin-apk-url <url>'
|
||||
, 'URL to apk storage plugin'
|
||||
, String)
|
||||
.option('-u, --connect-sub <endpoint>'
|
||||
, 'sub endpoint'
|
||||
, cliutil.list)
|
||||
|
@ -424,6 +427,9 @@ program
|
|||
if (!options.storagePluginImageUrl) {
|
||||
this.missingArgument('--storage-plugin-image-url')
|
||||
}
|
||||
if (!options.storagePluginApkUrl) {
|
||||
this.missingArgument('--storage-plugin-apk-url')
|
||||
}
|
||||
if (!options.connectSub) {
|
||||
this.missingArgument('--connect-sub')
|
||||
}
|
||||
|
@ -438,6 +444,7 @@ program
|
|||
, authUrl: options.authUrl
|
||||
, storageUrl: options.storageUrl
|
||||
, storagePluginImageUrl: options.storagePluginImageUrl
|
||||
, storagePluginApkUrl: options.storagePluginApkUrl
|
||||
, endpoints: {
|
||||
sub: options.connectSub
|
||||
, push: options.connectPush
|
||||
|
@ -446,44 +453,6 @@ program
|
|||
})
|
||||
})
|
||||
|
||||
program
|
||||
.command('cache-apk')
|
||||
.description('apk cache')
|
||||
.option('-p, --port <port>'
|
||||
, 'port (or $PORT)'
|
||||
, Number
|
||||
, process.env.PORT || 7100)
|
||||
.option('--public-ip <ip>'
|
||||
, 'public ip for global access'
|
||||
, String
|
||||
, ip())
|
||||
.option('--save-dir <dir>'
|
||||
, 'where to save files'
|
||||
, String
|
||||
, os.tmpdir())
|
||||
.option('--id <id>'
|
||||
, 'communication identifier'
|
||||
, String
|
||||
, 'storage')
|
||||
.option('--connect-push <endpoint>'
|
||||
, 'push endpoint'
|
||||
, cliutil.list)
|
||||
.action(function(options) {
|
||||
if (!options.connectPush) {
|
||||
this.missingArgument('--connect-push')
|
||||
}
|
||||
|
||||
require('./roles/storage/temp')({
|
||||
port: options.port
|
||||
, publicIp: options.publicIp
|
||||
, saveDir: options.saveDir
|
||||
, id: options.id
|
||||
, endpoints: {
|
||||
push: options.connectPush
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
program
|
||||
.command('storage-temp')
|
||||
.description('start temp storage')
|
||||
|
@ -532,6 +501,32 @@ program
|
|||
})
|
||||
})
|
||||
|
||||
program
|
||||
.command('storage-plugin-apk')
|
||||
.description('start storage apk plugin')
|
||||
.option('-p, --port <port>'
|
||||
, 'port (or $PORT)'
|
||||
, Number
|
||||
, process.env.PORT || 7100)
|
||||
.option('-r, --storage-url <url>'
|
||||
, 'URL to storage client'
|
||||
, String)
|
||||
.option('--cache-dir <dir>'
|
||||
, 'where to cache images'
|
||||
, String
|
||||
, os.tmpdir())
|
||||
.action(function(options) {
|
||||
if (!options.storageUrl) {
|
||||
this.missingArgument('--storage-url')
|
||||
}
|
||||
|
||||
require('./roles/storage/plugins/apk')({
|
||||
port: options.port
|
||||
, storageUrl: options.storageUrl
|
||||
, cacheDir: options.cacheDir
|
||||
})
|
||||
})
|
||||
|
||||
program
|
||||
.command('migrate')
|
||||
.description('migrates the database to the latest version')
|
||||
|
@ -596,6 +591,10 @@ program
|
|||
, 'storage image plugin port'
|
||||
, Number
|
||||
, 7103)
|
||||
.option('--storage-plugin-apk-port <port>'
|
||||
, 'storage apk plugin port'
|
||||
, Number
|
||||
, 7104)
|
||||
.option('--provider <name>'
|
||||
, 'provider name (or os.hostname())'
|
||||
, String
|
||||
|
@ -688,6 +687,8 @@ program
|
|||
, util.format('http://localhost:%d/', options.storagePort)
|
||||
, '--storage-plugin-image-url'
|
||||
, util.format('http://localhost:%d/', options.storagePluginImagePort)
|
||||
, '--storage-plugin-apk-url'
|
||||
, util.format('http://localhost:%d/', options.storagePluginApkPort)
|
||||
, '--connect-sub', options.bindAppPub
|
||||
, '--connect-push', options.bindAppPull
|
||||
].concat((function() {
|
||||
|
@ -711,6 +712,14 @@ program
|
|||
, '--storage-url'
|
||||
, util.format('http://localhost:%d/', options.storagePort)
|
||||
])
|
||||
|
||||
// apk processor
|
||||
, procutil.fork(__filename, [
|
||||
'storage-plugin-apk'
|
||||
, '--port', options.storagePluginApkPort
|
||||
, '--storage-url'
|
||||
, util.format('http://localhost:%d/', options.storagePort)
|
||||
])
|
||||
]
|
||||
|
||||
function shutdown() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue