diff --git a/__tests__/e2e/artifact/s.yaml b/__tests__/e2e/artifact/s.yaml index 3799c13..dbc9c82 100644 --- a/__tests__/e2e/artifact/s.yaml +++ b/__tests__/e2e/artifact/s.yaml @@ -7,7 +7,7 @@ edition: 3.0.0 name: hello-world-app access: "quanxi" -vars: +vars: region: ${env('REGION', 'cn-huhehaote')} resources: @@ -19,7 +19,7 @@ resources: description: 'hello world by serverless devs' runtime: "python3.10" code: ./code - artifact: test-devs-artifact_cn-hangzhou + artifact: test-devs-artifact-1001 handler: index.handler memorySize: 128 timeout: 40 diff --git a/src/subCommands/deploy/impl/function.ts b/src/subCommands/deploy/impl/function.ts index ae01d7c..731c7cf 100644 --- a/src/subCommands/deploy/impl/function.ts +++ b/src/subCommands/deploy/impl/function.ts @@ -94,6 +94,9 @@ export default class Service extends Base { if (process.env.ARTIFACT_ENDPOINT) { config.endpoint = process.env.ARTIFACT_ENDPOINT; } + if (process.env.artifact_endpoint) { + config.endpoint = process.env.artifact_endpoint; + } this.devsClient = new Devs20230714(config); } // 准备动作 @@ -504,10 +507,14 @@ nasConfig: // const artifactName = truncateString(`${functionName}_${region}`); const downloadDir: string = path.join(tmpDir, 'artifacts'); + if (!fs.existsSync(downloadDir)) { + fs.mkdirSync(downloadDir); + } const zipFile = path.join(downloadDir, `${artifactName}_${uuidV4()}.zip`); + + logger.info(`download ${url} to ${zipFile}`); await downloadFile(url, zipFile); - logger.debug(zipFile); const resp = await this.devsClient.fetchArtifactTempBucketToken(); logger.debug(JSON.stringify(resp.body)); const { credentials, ossRegion, ossBucketName, ossObjectName } = resp.body; diff --git a/src/subCommands/deploy/index.ts b/src/subCommands/deploy/index.ts index a7331a7..fbf9b3e 100644 --- a/src/subCommands/deploy/index.ts +++ b/src/subCommands/deploy/index.ts @@ -77,7 +77,6 @@ export default class Deploy { const run3 = await this.asyncInvokeConfig?.run(); const run4 = await this.vpcBinding?.run(); const run5 = await this.customDomain?.run(); - // 获取输出 if (run1 && run2 && run3 && run4 && run5) { const info = new Info(this.inputs); @@ -88,6 +87,7 @@ export default class Deploy { return result; } const mergedObj = Object.assign({}, result, artifact); + logger.debug(`mergedObj = ${JSON.stringify(mergedObj, null, 2)}`); return mergedObj; } }