Skip to content
This repository was archived by the owner on Mar 16, 2024. It is now read-only.

Commit fa374ae

Browse files
Merge pull request #2406 from ibuildthecloud/main
Bump function builder
2 parents 43dbcbf + a4680f9 commit fa374ae

File tree

10 files changed

+153
-40
lines changed

10 files changed

+153
-40
lines changed

go.mod

+9-9
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ require (
99
github.com/acorn-io/aml/cli v0.0.0-20240106192317-21afc7320c77
1010
github.com/acorn-io/baaah v0.0.0-20240105013849-c4f82d7a5a41
1111
github.com/acorn-io/broadcaster v0.0.0-20240105011354-bfadd4a7b45d
12-
github.com/acorn-io/function-builder v0.0.0-20240106051830-f0d368d2382c
12+
github.com/acorn-io/function-builder v0.0.0-20240111042311-041315dd7091
1313
github.com/acorn-io/mink v0.0.0-20240105015834-b1f7af4fadea
1414
github.com/acorn-io/namegenerator v0.0.0-20220915160418-9e3d5a0ffe78
1515
github.com/acorn-io/schemer v0.0.0-20240105014212-9739d5485208
@@ -54,9 +54,9 @@ require (
5454
github.com/stretchr/testify v1.8.4
5555
github.com/tonistiigi/fsutil v0.0.0-20230629203738-36ef4d8c0dbb
5656
github.com/wI2L/jsondiff v0.3.0
57-
golang.org/x/crypto v0.14.0
58-
golang.org/x/exp v0.0.0-20231006140011-7918f672742d
59-
golang.org/x/sync v0.4.0
57+
golang.org/x/crypto v0.16.0
58+
golang.org/x/exp v0.0.0-20240103183307-be819d1f06fc
59+
golang.org/x/sync v0.5.0
6060
google.golang.org/grpc v1.58.3
6161
inet.af/tcpproxy v0.0.0-20221017015627-91f861402626
6262
k8s.io/api v0.29.0
@@ -285,14 +285,14 @@ require (
285285
go.starlark.net v0.0.0-20230525235612-a134d8f9ddca // indirect
286286
go.uber.org/multierr v1.11.0 // indirect
287287
go.uber.org/zap v1.26.0 // indirect
288-
golang.org/x/mod v0.13.0 // indirect
289-
golang.org/x/net v0.17.0 // indirect
288+
golang.org/x/mod v0.14.0 // indirect
289+
golang.org/x/net v0.19.0 // indirect
290290
golang.org/x/oauth2 v0.12.0 // indirect
291291
golang.org/x/sys v0.15.0 // indirect
292-
golang.org/x/term v0.13.0 // indirect
293-
golang.org/x/text v0.13.0 // indirect
292+
golang.org/x/term v0.15.0 // indirect
293+
golang.org/x/text v0.14.0 // indirect
294294
golang.org/x/time v0.3.0 // indirect
295-
golang.org/x/tools v0.14.0 // indirect
295+
golang.org/x/tools v0.16.0 // indirect
296296
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
297297
google.golang.org/appengine v1.6.7 // indirect
298298
google.golang.org/genproto v0.0.0-20230803162519-f966b187b2e5 // indirect

go.sum

+18-18
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ github.com/acorn-io/broadcaster v0.0.0-20240105011354-bfadd4a7b45d h1:hfpNQkJ4I2
117117
github.com/acorn-io/broadcaster v0.0.0-20240105011354-bfadd4a7b45d/go.mod h1:WF6FYrEqW0+ZtY5OKb21JhSL0aeL5VJoVrm+u0d4gOE=
118118
github.com/acorn-io/cmd v0.0.0-20230929053520-ebe1b9879b38 h1:oJMGvI702ZW5L0JjJfGV9ekzU2IqqTGjmAQl4gkO6Ro=
119119
github.com/acorn-io/cmd v0.0.0-20230929053520-ebe1b9879b38/go.mod h1:bo9ONX4kagbQmXcG4bnfoK53MBFFtbUZ5fR7s9NfS+M=
120-
github.com/acorn-io/function-builder v0.0.0-20240106051830-f0d368d2382c h1:xfOXFsu5BBsZg6B+xkD4mrP1vacp+WofRTfReSYpS1A=
121-
github.com/acorn-io/function-builder v0.0.0-20240106051830-f0d368d2382c/go.mod h1:yf8qvacJItEV62UVTgNoTTnZHF/1/kqu+eU0CNf9hLw=
120+
github.com/acorn-io/function-builder v0.0.0-20240111042311-041315dd7091 h1:l+cuQsOK7aoC8VIq6C+Q98Svq9OgmzNCWuCcWhRw27w=
121+
github.com/acorn-io/function-builder v0.0.0-20240111042311-041315dd7091/go.mod h1:b60OzYlyV4fuiTw3HExgOJITsXnfm0c0uIoywz7s+Y4=
122122
github.com/acorn-io/mink v0.0.0-20240105015834-b1f7af4fadea h1:HyH8nh7zZ7qZeWOjBGtK/iAI5gCu/c5iSnN703hlHHY=
123123
github.com/acorn-io/mink v0.0.0-20240105015834-b1f7af4fadea/go.mod h1:EmoDPUYsPyBEhEpSC+LpRGUs2GeSI5nPOTa7WO7jwlc=
124124
github.com/acorn-io/namegenerator v0.0.0-20220915160418-9e3d5a0ffe78 h1:5zs9L/CXNkuTdJSbhFWczAorbmx67nqlqswx5CQi7XI=
@@ -1107,8 +1107,8 @@ golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0
11071107
golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4=
11081108
golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU=
11091109
golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw=
1110-
golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc=
1111-
golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4=
1110+
golang.org/x/crypto v0.16.0 h1:mMMrFzRSCF0GvB7Ne27XVtVAaXLrPmgPC7/v0tkwHaY=
1111+
golang.org/x/crypto v0.16.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4=
11121112
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
11131113
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
11141114
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
@@ -1119,8 +1119,8 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0
11191119
golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
11201120
golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM=
11211121
golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU=
1122-
golang.org/x/exp v0.0.0-20231006140011-7918f672742d h1:jtJma62tbqLibJ5sFQz8bKtEM8rJBtfilJ2qTU199MI=
1123-
golang.org/x/exp v0.0.0-20231006140011-7918f672742d/go.mod h1:ldy0pHrwJyGW56pPQzzkH36rKxoZW1tw7ZJpeKx+hdo=
1122+
golang.org/x/exp v0.0.0-20240103183307-be819d1f06fc h1:ao2WRsKSzW6KuUY9IWPwWahcHCgR0s52IfwutMfEbdM=
1123+
golang.org/x/exp v0.0.0-20240103183307-be819d1f06fc/go.mod h1:iRJReGqOEeBhDZGkGbynYwcHlctCvnjTYIamk7uXpHI=
11241124
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
11251125
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
11261126
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
@@ -1150,8 +1150,8 @@ golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
11501150
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
11511151
golang.org/x/mod v0.10.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
11521152
golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
1153-
golang.org/x/mod v0.13.0 h1:I/DsJXRlw/8l/0c24sM9yb0T4z9liZTduXvdAWYiysY=
1154-
golang.org/x/mod v0.13.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
1153+
golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0=
1154+
golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
11551155
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
11561156
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
11571157
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
@@ -1202,8 +1202,8 @@ golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc=
12021202
golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns=
12031203
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
12041204
golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI=
1205-
golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM=
1206-
golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE=
1205+
golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c=
1206+
golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U=
12071207
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
12081208
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
12091209
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
@@ -1231,8 +1231,8 @@ golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJ
12311231
golang.org/x/sync v0.0.0-20220819030929-7fc1605a5dde/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
12321232
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
12331233
golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
1234-
golang.org/x/sync v0.4.0 h1:zxkM55ReGkDlKSM+Fu41A+zmbZuaPVbGMzvvdUPznYQ=
1235-
golang.org/x/sync v0.4.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
1234+
golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE=
1235+
golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
12361236
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
12371237
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
12381238
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
@@ -1324,8 +1324,8 @@ golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U=
13241324
golang.org/x/term v0.7.0/go.mod h1:P32HKFT3hSsZrRxla30E9HqToFYAQPCMs/zFMBUFqPY=
13251325
golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
13261326
golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU=
1327-
golang.org/x/term v0.13.0 h1:bb+I9cTfFazGW51MZqBVmZy7+JEJMouUHTUSKVQLBek=
1328-
golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U=
1327+
golang.org/x/term v0.15.0 h1:y/Oo/a/q3IXu26lQgl04j/gjuBDOBlx7X6Om1j2CPW4=
1328+
golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0=
13291329
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
13301330
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
13311331
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
@@ -1341,8 +1341,8 @@ golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
13411341
golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
13421342
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
13431343
golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
1344-
golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k=
1345-
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
1344+
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
1345+
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
13461346
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
13471347
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
13481348
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
@@ -1413,8 +1413,8 @@ golang.org/x/tools v0.4.0/go.mod h1:UE5sM2OK9E/d67R0ANs2xJizIymRP5gJU295PvKXxjQ=
14131413
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
14141414
golang.org/x/tools v0.8.0/go.mod h1:JxBZ99ISMI5ViVkT1tr6tdNmXeTrcpVSD3vZ1RsRdN4=
14151415
golang.org/x/tools v0.12.0/go.mod h1:Sc0INKfu04TlqNoRA1hgpFZbhYXHPr4V5DzpSBTPqQM=
1416-
golang.org/x/tools v0.14.0 h1:jvNa2pY0M4r62jkRQ6RwEZZyPcymeL9XZMLBbV7U2nc=
1417-
golang.org/x/tools v0.14.0/go.mod h1:uYBEerGOWcJyEORxN+Ek8+TT266gXkNlHdJBwexUsBg=
1416+
golang.org/x/tools v0.16.0 h1:GO788SKMRunPIBCXiQyo2AaexLstOrVhuAL5YwsckQM=
1417+
golang.org/x/tools v0.16.0/go.mod h1:kYVVN6I1mBNoB1OX+noeBjbRk4IUEPa7JJ+TJMEooJ0=
14181418
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
14191419
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
14201420
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=

pkg/apis/internal.acorn.io/v1/appspec.go

+5
Original file line numberDiff line numberDiff line change
@@ -705,8 +705,13 @@ type Assistant struct {
705705
Name string `json:"name,omitempty"`
706706
Description string `json:"description,omitempty"`
707707
Prompts Prompts `json:"prompts,omitempty"`
708+
Vision bool `json:"vision,omitempty"`
709+
Model string `json:"model,omitempty"`
708710
Dependencies Dependencies `json:"tools,omitempty"`
709711
InputSchema *jsonschema.Schema `json:"inputSchema,omitempty"`
712+
MaxTokens int `json:"maxTokens,omitempty"`
713+
JSONResponse bool `json:"jsonResponse,omitempty"`
714+
Cache *bool `json:"cache,omitempty"`
710715
}
711716

712717
type Prompts []string

pkg/apis/internal.acorn.io/v1/zz_generated.deepcopy.go

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/appdefinition/acornfile-schema.acorn

+4
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,10 @@ let types: {
487487
model?: string || Model
488488
tools: string || [string]
489489
inputSchema?: schema
490+
vision: false
491+
maxTokens?: int
492+
jsonResponse: false
493+
cache: true
490494
}
491495

492496
RouteTargetName: "^[a-z][-a-z0-9]*(:[0-9]+)?$"

pkg/appdefinition/appdefinition.go

+15-2
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,8 @@ func overlayFragment(con *v1.Container, imagesData v1.ImagesData, imageID, servi
245245

246246
strData := fmt.Sprintf(`
247247
let serviceName: "%s"
248-
{ %s } + { %s }`, serviceName, containerData, fragment)
248+
let base: { %s }
249+
{ %s } + { %s }`, serviceName, containerData, containerData, fragment)
249250

250251
return aml.Unmarshal([]byte(strData), con)
251252
}
@@ -359,6 +360,18 @@ func (a *AppDefinition) AppSpec() (*v1.AppSpec, error) {
359360
return spec, v1.AddImpliedResources(spec)
360361
}
361362

363+
func addFunctionFiles(fileSet map[string]bool, builds map[string]v1.ContainerImageBuilderSpec, cwd string) {
364+
for key, build := range builds {
365+
addContainerFiles(fileSet, build.Sidecars, cwd)
366+
context := build.Src
367+
if context == "" {
368+
context = key
369+
}
370+
fileSet[filepath.Join(cwd, context, "build.acorn")] = true
371+
fileSet[filepath.Join(cwd, context, ".dockerignore")] = true
372+
}
373+
}
374+
362375
func addContainerFiles(fileSet map[string]bool, builds map[string]v1.ContainerImageBuilderSpec, cwd string) {
363376
for _, build := range builds {
364377
addContainerFiles(fileSet, build.Sidecars, cwd)
@@ -416,7 +429,7 @@ func (a *AppDefinition) WatchFiles(cwd string) (result []string, _ error) {
416429
}
417430

418431
addContainerFiles(fileSet, spec.Containers, cwd)
419-
addContainerFiles(fileSet, spec.Functions, cwd)
432+
addFunctionFiles(fileSet, spec.Functions, cwd)
420433
addContainerFiles(fileSet, spec.Jobs, cwd)
421434
addFiles(fileSet, spec.Images, cwd)
422435
addAcorns(fileSet, spec.Services, cwd)

pkg/dev/sync.go

+32-3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"errors"
66
"io"
7+
"io/fs"
78
"os"
89
"path"
910
"path/filepath"
@@ -90,6 +91,29 @@ func containerSync(ctx context.Context, client client.Client, logger Logger, app
9091
return err
9192
}
9293

94+
func findDockerIgnore(path string) (string, error) {
95+
startPath := filepath.Join(path, ".dockerignore")
96+
for {
97+
testPath := filepath.Join(path, ".dockerignore")
98+
if _, err := os.Stat(testPath); err == nil {
99+
return testPath, nil
100+
} else if errors.Is(err, fs.ErrNotExist) {
101+
newPath := filepath.Dir(path)
102+
if newPath == path {
103+
return startPath, nil
104+
}
105+
if _, err := os.Stat(newPath); errors.Is(err, fs.ErrNotExist) {
106+
return startPath, nil
107+
} else if err != nil {
108+
return "", err
109+
}
110+
path = newPath
111+
} else {
112+
return "", err
113+
}
114+
}
115+
}
116+
93117
func invokeStartSyncForPath(ctx context.Context, client client.Client, logger Logger, con *apiv1.ContainerReplica, cwd, localDir, remoteDir string, bidirectional bool) (chan struct{}, chan error, error) {
94118
source := filepath.Join(cwd, localDir)
95119
if s, err := os.Stat(source); err == nil && !s.IsDir() {
@@ -100,7 +124,12 @@ func invokeStartSyncForPath(ctx context.Context, client client.Client, logger Lo
100124
return nil, nil, err
101125
}
102126
var exclude []string
103-
f, err := os.Open(filepath.Join(cwd, ".dockerignore"))
127+
dockerIgnorePath, err := findDockerIgnore(filepath.Join(cwd, localDir))
128+
if err != nil {
129+
return nil, nil, err
130+
}
131+
132+
f, err := os.Open(dockerIgnorePath)
104133
if err == nil {
105134
lines, err := dockerignore.ReadAll(f)
106135
_ = f.Close()
@@ -110,7 +139,7 @@ func invokeStartSyncForPath(ctx context.Context, client client.Client, logger Lo
110139
logrus.Warnf("failed to read %s for syncing: %v", filepath.Join(cwd, ".dockerignore"), err)
111140
exclude = nil
112141
}
113-
} else if !os.IsNotExist(err) {
142+
} else if !errors.Is(err, fs.ErrNotExist) {
114143
logrus.Warnf("failed to open %s for syncing: %v", filepath.Join(cwd, ".dockerignore"), err)
115144
exclude = nil
116145
}
@@ -121,7 +150,7 @@ func invokeStartSyncForPath(ctx context.Context, client client.Client, logger Lo
121150
UploadExcludePaths: exclude,
122151
InitialSync: latest.InitialSyncStrategyPreferLocal,
123152
Log: newLogger(logger, con).
124-
WithPrefix(strings.TrimPrefix(con.Name, con.Spec.AppName+".") + ": (sync): "),
153+
WithPrefix("(sync): "),
125154
})
126155
if err != nil {
127156
return nil, nil, err

pkg/log/log.go

+7-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ func pipe(input io.ReadCloser, output chan<- Message, pod *corev1.Pod, name stri
134134
var lastTS *metav1.Time
135135

136136
scanner := bufio.NewScanner(input)
137-
scanner.Buffer(nil, 1_000_000)
137+
scanner.Buffer(nil, 2_000_000)
138138
for scanner.Scan() {
139139
line := scanner.Text()
140140
ts, newLine, _ := strings.Cut(line, " ")
@@ -417,6 +417,8 @@ func matchesContainer(pod *corev1.Pod, container corev1.Container, options *Opti
417417
if containerName == "" {
418418
if pod.Labels[applabels.AcornContainerName] != "" {
419419
return pod.Name == podName && container.Name == pod.Labels[applabels.AcornContainerName]
420+
} else if pod.Labels[applabels.AcornFunctionName] != "" {
421+
return pod.Name == podName && container.Name == pod.Labels[applabels.AcornFunctionName]
420422
} else {
421423
return pod.Name == podName && container.Name == pod.Labels[applabels.AcornJobName]
422424
}
@@ -429,6 +431,7 @@ func matchesContainer(pod *corev1.Pod, container corev1.Container, options *Opti
429431
if options != nil && options.Container != "" {
430432
// Must match the acorn container name or job name on the pod
431433
if pod.Labels[applabels.AcornContainerName] != options.Container &&
434+
pod.Labels[applabels.AcornFunctionName] != options.Container &&
432435
pod.Labels[applabels.AcornJobName] != options.Container {
433436
return false
434437
}
@@ -438,6 +441,9 @@ func matchesContainer(pod *corev1.Pod, container corev1.Container, options *Opti
438441
if pod.Labels[applabels.AcornContainerName] != "" {
439442
validContainerNames = append(validContainerNames, pod.Labels[applabels.AcornContainerName])
440443
}
444+
if pod.Labels[applabels.AcornFunctionName] != "" {
445+
validContainerNames = append(validContainerNames, pod.Labels[applabels.AcornFunctionName])
446+
}
441447
if pod.Labels[applabels.AcornJobName] != "" {
442448
validContainerNames = append(validContainerNames, pod.Labels[applabels.AcornJobName])
443449
}

pkg/openapi/generated/openapi_generated.go

+30
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)