Skip to content

Commit 582c309

Browse files
authored
Pre 0.1.58 (#107)
1 parent 4fe63af commit 582c309

File tree

9 files changed

+32
-22
lines changed

9 files changed

+32
-22
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ dist
1616
.s.lock
1717
website-base/
1818
.s
19+
__tests__

.signore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ node_modules
22
lib
33
docs
44
src
5+
__tests__
56
jest.config.ts
67
jest.setup.ts
78
lerna.json

package-lock.json

Lines changed: 11 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@serverless-devs/core",
3-
"version": "0.1.57",
3+
"version": "0.1.58",
44
"description": "Serverless Devs Tool Core Component",
55
"keywords": [
66
"Serverless",
@@ -38,7 +38,9 @@
3838
"fix": "f2elint fix",
3939
"pub": "npm run build && npm publish",
4040
"typecheck": "npx tsc -p tsconfig.json --noEmit",
41-
"beta": "npm publish --tag=beta"
41+
"beta": "npm publish --tag=beta",
42+
"preln": "rm -rf ~/.s/cache/core/dist",
43+
"ln": "ln -s $(pwd)/lib ~/.s/cache/core/dist"
4244
},
4345
"autoInstall": false,
4446
"main": "./dist/index.js",
@@ -48,7 +50,7 @@
4850
"@serverless-devs/acc": "^1.1.3",
4951
"@serverless-devs/got": "^8.3.2",
5052
"@serverless-devs/s-progress-bar": "^0.0.8",
51-
"@serverless-devs/utils": "^0.0.4",
53+
"@serverless-devs/utils": "^0.0.5",
5254
"@types/archiver": "^5.1.1",
5355
"@types/command-exists": "^1.2.0",
5456
"@types/command-line-usage": "^5.0.1",

publish.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Type: Component
22
Name: core
33
Provider:
44
- 阿里云
5-
Version: 0.1.57
5+
Version: 0.1.58
66
Description: Serverless Devs 核心组件
77
HomePage: https://github.com/Serverless-Devs/core
88
Tags: #标签详情

src/common/credential/getCredential/index.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { ALIYUN_CLI, ALIYUN_CONFIG_FILE } from '../../constant';
1212
import Acc from '@serverless-devs/acc/commands/run';
1313
import fs from 'fs-extra';
1414
import getAccountId from '../getAccountId';
15+
import { isCiCdEnvironment } from '@serverless-devs/utils';
1516

1617
const Crypto = require('crypto-js');
1718

@@ -46,6 +47,10 @@ async function getCredential(...args: any[]) {
4647
if (access === ALIYUN_CLI) {
4748
result = await getAcc();
4849
} else {
50+
const aliasFromEnv = process.env.serverless_devs_access_cicd_alias_name;
51+
if (isCiCdEnvironment() && aliasFromEnv) {
52+
access = aliasFromEnv;
53+
}
4954
result = await getCredentialWithAccess(access, ...params);
5055
}
5156

@@ -127,6 +132,10 @@ async function getCredentialWithAccess(access?: string, ...args: any[]) {
127132
logger.debug(`access information: ${JSON.stringify(result, null, 2)}`);
128133
return trim(result);
129134
}
135+
if (isCiCdEnvironment()) {
136+
// cicd 环境未获取到密钥信息,抛出异常
137+
throw new Error(`The access ${accessAlias} is not found.`);
138+
}
130139

131140
const userInfo = await getYamlContent(path.join(getRootHome(), 'access.yaml'));
132141

@@ -161,8 +170,7 @@ async function getCredentialWithAccess(access?: string, ...args: any[]) {
161170
}
162171
const result = formatValue(userInfo, selectAccess);
163172
logger.warn(
164-
`\n\n${
165-
os.platform() == 'win32' ? '' : '🤡'
173+
`\n\n${os.platform() == 'win32' ? '' : '🤡'
166174
} If you don't want to select access every time, configure it in yaml:${chalk.underline.cyan(
167175
'https://github.com/Serverless-Devs/Serverless-Devs/discussions/149',
168176
)}\n\n`,

src/daemon/constant.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module.exports = {
2-
DEFAULT_CORE_VERSION: '0.1.57',
2+
DEFAULT_CORE_VERSION: '0.1.58',
33
};

src/index.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
process.setMaxListeners(0);
22
(process as any).noDeprecation = true;
3-
import { isCiCdEnvironment, getCurrentEnvironment } from '@serverless-devs/utils';
4-
export const isCiCdEnv = isCiCdEnvironment;
5-
export const getCicdEnv = getCurrentEnvironment;
6-
73

84
export { IInputs } from './interface';
95
export { Logger, ILogger, makeLogFile } from './logger';
@@ -36,6 +32,6 @@ export { default as popCore } from '@alicloud/pop-core';
3632
export { default as extend2 } from 'extend2';
3733
export { default as stringArgv } from 'string-argv';
3834
export { default as tracker } from '@serverless-cd/tracker';
39-
export * from '@serverless-devs/utils';
35+
export { isDebugMode, isCiCdEnvironment as isCiCdEnv, getCurrentEnvironment as getCicdEnv, getCurrentEnvironment } from '@serverless-devs/utils';
4036

4137

test/fixtures/start-fc-event-nodejs14/s.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ name: hello-world-app
1919
# access 是当前应用所需要的密钥信息配置:
2020
# 密钥配置可以参考:https://www.serverless-devs.com/serverless-devs/command/config
2121
# 密钥使用顺序可以参考:https://www.serverless-devs.com/serverless-devs/tool#密钥使用顺序与规范
22-
access: default
22+
access: defaultxxx
2323
extend: base.yaml
2424

2525
vars: # 全局变量

0 commit comments

Comments
 (0)