Skip to content

Commit d05724d

Browse files
author
高魏洪
committed
fix: build runit
1 parent 55a57a5 commit d05724d

13 files changed

Lines changed: 326 additions & 8 deletions

File tree

__tests__/ut/commands/model_test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ describe('Model', () => {
146146
});
147147

148148
expect(() => new Model(mockInputs)).toThrow(
149-
'Command "invalid" not found, Please use "s cli fc3 layer -h" to query how to use the command',
149+
'Command "invalid" not found, Please use "s cli fc3 model -h" to query how to use the command',
150150
);
151151
});
152152
});

package-lock.json

Lines changed: 124 additions & 0 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 & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@
5454
"temp-dir": "^2.0.0",
5555
"tty-table": "^4.2.3",
5656
"uuid": "^9.0.1",
57+
"undici": "^5.28.5",
58+
"@serverless-devs/docker-image-builder": "^0.0.0-20260518-164317-160dd89efac1",
5759
"uuid-by-string": "^4.0.0"
5860
},
5961
"devDependencies": {
@@ -76,6 +78,9 @@
7678
"resolutions": {
7779
"@alicloud/sls20191023": {
7880
"registry": "https://packages.aliyun.com/670e108663cd360abfe4be65/npm/npm-registry/"
81+
},
82+
"@serverless-devs/docker-image-builder": {
83+
"registry": "https://packages.aliyun.com/670e108663cd360abfe4be65/npm/npm-registry/"
7984
}
8085
}
8186
}

publish.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Type: Component
33
Name: fc3
44
Provider:
55
- 阿里云
6-
Version: 0.1.20
6+
Version: 0.1.21
77
Description: 阿里云函数计算全生命周期管理
88
HomePage: https://github.com/devsapp/fc3
99
Organization: 阿里云函数计算(FC)

src/commands-help/build.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ Examples:
88
$ s build --dockerfile ./code/Dockerfile --context ./code
99
$ s build --custom-env "{\\"myenv\\": \\"test\\"}" --custom-args="-i https://pypi.tuna.tsinghua.edu.cn/simple"
1010
$ s build --command="pip install -t . flask -i https://pypi.tuna.tsinghua.edu.cn/simple"
11-
$ s build --script-file my_script.sh`,
11+
$ s build --script-file my_script.sh
12+
$ s build --cloud-build-config fc3-cloud-build.yaml
13+
$ s build --cloud-build-config fc3-cloud-build.yaml --debug-instance`,
1214
summary: 'Build the dependencies',
1315
option: [
1416
['--publish-layer', '[Optional] Publishing the built artifact as a layer'],
@@ -20,6 +22,14 @@ Examples:
2022
],
2123
['--command <string>', '[Optional] Using custom commands'],
2224
['--script-file <scriptFile>', '[Optional] Using custom shell scripts'],
25+
[
26+
'--cloud-build-config <buildYaml>',
27+
'[Optional] Cloud based build configuration file, default to search for the current directory fc3-cloud-build.yaml.',
28+
],
29+
[
30+
'--debug-instance',
31+
'[Optional] Only for cloud building, start the interactive debugging window after the build is complete.',
32+
],
2333
[
2434
'-f, --dockerfile <string>',
2535
'[Optional] Specify the dockerfile path, Use docker to build the image of the custom container runtime',

src/commands-help/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import logs from './logs';
1717
import session from './session';
1818
import scaling from './scaling';
1919
import list from './list';
20+
import model from './model';
2021

2122
export default {
2223
deploy,
@@ -38,4 +39,5 @@ export default {
3839
session,
3940
scaling,
4041
list,
42+
model,
4143
};

src/commands-help/model.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
export default {
22
help: {
3-
description: 'Resource layer operation ',
4-
summary: 'Resource layer operation ',
3+
description: 'Resource model operation ',
4+
summary: 'Resource model operation ',
55
},
66
subCommands: {
77
download: {
88
help: {
99
description: `Download model`,
10-
summary: 'Publish new layer version',
10+
summary: 'Download model',
1111
option: [],
1212
},
1313
},

src/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,10 @@ export default class Fc extends Base {
133133

134134
public async build(inputs: IInputs) {
135135
await super.handlePreRun(inputs, false);
136+
const build = new BuilderFactory(inputs);
137+
if (build.findCloudBuildYaml()) {
138+
return await build.runit();
139+
}
136140

137141
const runtime = _.get(inputs, 'props.runtime');
138142
if (FC.isCustomContainerRuntime(runtime)) {

src/interface/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export interface IProps extends IFunction {
2323
endpoint?: string;
2424
supplement?: any;
2525
annotations?: any;
26+
buildDir?: string;
2627
}
2728

2829
export interface IInputs extends _IInputs {

0 commit comments

Comments
 (0)