Skip to content
Merged
Show file tree
Hide file tree
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
8 changes: 2 additions & 6 deletions src/deploy-actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,12 +174,8 @@ async function deployWsk (scriptConfig, manifestContent, logFunc, filterEntities
apihost: scriptConfig.ow.apihost,
apiversion: scriptConfig.ow.apiversion,
api_key: scriptConfig.ow.auth,
namespace: scriptConfig.ow.namespace
}

// TODO: remove this once the feature flag is removed
if ('auth_handler' in scriptConfig.ow && scriptConfig.ow.auth_handler) {
owOptions.auth_handler = scriptConfig.ow.auth_handler
namespace: scriptConfig.ow.namespace,
auth_handler: scriptConfig.ow.auth_handler
}

const lastDeployedActionsPath = path.join(scriptConfig.root, 'dist', 'last-deployed-actions.json')
Expand Down
8 changes: 2 additions & 6 deletions src/print-action-logs.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,8 @@ async function printActionLogs (config, logger, limit, filterActions, strip, tai
apihost: config.ow.apihost,
apiversion: config.ow.apiversion,
api_key: config.ow.auth,
namespace: config.ow.namespace
}

// TODO: remove this once the feature flag is removed
if ('auth_handler' in config.ow && config.ow.auth_handler) {
runtimeOptions.auth_handler = config.ow.auth_handler
namespace: config.ow.namespace,
auth_handler: config.ow.auth_handler
}

const runtime = await new IOruntime().init(runtimeOptions)
Expand Down
8 changes: 2 additions & 6 deletions src/undeploy-actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,8 @@ async function undeployActions (config, logFunc) {
apihost: config.ow.apihost,
apiversion: config.ow.apiversion,
api_key: config.ow.auth,
namespace: config.ow.namespace
}

// TODO: remove this once the feature flag is removed
if ('auth_handler' in config.ow && config.ow.auth_handler) {
owOptions.auth_handler = config.ow.auth_handler
namespace: config.ow.namespace,
auth_handler: config.ow.auth_handler
}

// replace package name
Expand Down
15 changes: 7 additions & 8 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -437,22 +437,21 @@ function getActionEntryFile (pkgJsonPath) {
*/
function zip (filePath, out, pathInZip = false) {
aioLogger.debug(`Creating zip of file/folder ${filePath}`)
const stream = fs.createWriteStream(out)
const archive = archiver('zip', { zlib: { level: 9 } })

return new Promise((resolve, reject) => {
stream.on('close', () => resolve())
archive.pipe(stream)
archive.on('error', err => reject(err))

let stats
try {
stats = fs.lstatSync(filePath) // throws if ENOENT
} catch (e) {
archive.destroy()
reject(e)
return reject(e)
}

const stream = fs.createWriteStream(out)
const archive = archiver('zip', { zlib: { level: 9 } })
stream.on('close', () => resolve())
archive.pipe(stream)
archive.on('error', err => reject(err))

if (stats.isDirectory()) {
archive.directory(filePath, pathInZip)
} else {
Expand Down
1 change: 1 addition & 0 deletions test/utils.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2232,6 +2232,7 @@ describe('zip', () => {
await expect(utils.zip('/notexist.js', '/out.zip')).rejects.toEqual(expect.objectContaining({
message: expect.stringContaining('ENOENT')
}))

expect(archiver.mockFile).toHaveBeenCalledTimes(0)
expect(archiver.mockDirectory).toHaveBeenCalledTimes(0)
expect(fs.existsSync('/out.zip')).toEqual(false)
Expand Down