Skip to content

Commit b03074a

Browse files
committed
Revert "Update protobuf (Azure#528)"
This reverts commit 26de245.
1 parent 667b603 commit b03074a

File tree

6 files changed

+30
-212
lines changed

6 files changed

+30
-212
lines changed

azure-pipelines.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ trigger:
55
- master
66

77
variables:
8-
DOTNET_VERSION: '2.2.401'
8+
DOTNET_VERSION: '2.2.300'
99

1010
jobs:
1111
- job: Tests

azure_functions_worker/protos/_src/README.md

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -26,30 +26,19 @@ From within the Azure Functions language worker repo:
2626
1. Define remote branch for cleaner git commands
2727
- `git remote add proto-file https://github.com/azure/azure-functions-language-worker-protobuf.git`
2828
- `git fetch proto-file`
29-
2. Pull a specific release tag
30-
- `git fetch proto-file refs/tags/<tag-name>`
31-
- Example: `git fetch proto-file refs/tags/v1.1.0-protofile`
32-
3. Merge updates
33-
- Merge with an explicit path to subtree: `git merge -X subtree=<path in language worker repo> --squash <tag-name> --allow-unrelated-histories --strategy-option theirs`
34-
- Example: `git merge -X subtree=src/WebJobs.Script.Grpc/azure-functions-language-worker-protobuf --squash v1.1.0-protofile --allow-unrelated-histories --strategy-option theirs`
35-
4. Finalize with commit
36-
- `git commit -m "Updated subtree from https://github.com/azure/azure-functions-language-worker-protobuf. Tag: <tag-name>. Commit: <commit hash>"`
29+
2. Merge updates
30+
- `git merge -s subtree proto-file/<version branch> --squash --allow-unrelated-histories`
31+
- You can also merge with an explicit path to subtree: `git merge -X subtree=<path in language worker repo> --squash proto-file/<version branch> --allow-unrelated-histories`
32+
3. Finalize with commit
33+
- `git commit -m "Updated subtree from https://github.com/azure/azure-functions-language-worker-protobuf. Branch: <version branch>. Commit: <latest protobuf commit hash>"`
3734
- `git push`
38-
39-
## Releasing a Language Worker Protobuf version
40-
41-
1. Draft a release in the GitHub UI
42-
- Be sure to inculde details of the release
43-
2. Create a release version, following semantic versioning guidelines ([semver.org](https://semver.org/))
44-
3. Tag the version with the pattern: `v<M>.<m>.<p>-protofile` (example: `v1.1.0-protofile`)
45-
3. Merge `dev` to `master`
46-
35+
4736
## Consuming FunctionRPC.proto
4837
*Note: Update versionNumber before running following commands*
4938

5039
## CSharp
5140
```
52-
set NUGET_PATH="%UserProfile%\.nuget\packages"
41+
set NUGET_PATH=%UserProfile%\.nuget\packages
5342
set GRPC_TOOLS_PATH=%NUGET_PATH%\grpc.tools\<versionNumber>\tools\windows_x86
5443
set PROTO_PATH=.\azure-functions-language-worker-protobuf\src\proto
5544
set PROTO=.\azure-functions-language-worker-protobuf\src\proto\FunctionRpc.proto

azure_functions_worker/protos/_src/src/proto/FunctionRpc.proto

Lines changed: 1 addition & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ option go_package ="github.com/Azure/azure-functions-go-worker/internal/rpc";
1010
package AzureFunctionsRpcMessages;
1111

1212
import "google/protobuf/duration.proto";
13-
import "identity/ClaimsIdentityRpc.proto";
14-
import "shared/NullableTypes.proto";
1513

1614
// Interface exported by the server.
1715
service FunctionRpc {
@@ -203,9 +201,6 @@ message FunctionLoadRequest {
203201

204202
// Metadata for the request
205203
RpcFunctionMetadata metadata = 2;
206-
207-
// A flag indicating if managed dependency is enabled or not
208-
bool managed_dependency_enabled = 3;
209204
}
210205

211206
// Worker tells host result of reload
@@ -216,9 +211,6 @@ message FunctionLoadResponse {
216211
// Result of load operation
217212
StatusResult result = 2;
218213
// TODO: return type expected?
219-
220-
// Result of load operation
221-
bool is_dependency_downloaded = 3;
222214
}
223215

224216
// Information on how a Function should be loaded and its bindings
@@ -237,9 +229,6 @@ message RpcFunctionMetadata {
237229

238230
// Bindings info
239231
map<string, BindingInfo> bindings = 6;
240-
241-
// Is set to true for proxy
242-
bool is_proxy = 7;
243232
}
244233

245234
// Host requests worker to invoke a Function
@@ -289,35 +278,11 @@ message TypedData {
289278
bytes bytes = 3;
290279
bytes stream = 4;
291280
RpcHttp http = 5;
292-
sint64 int = 6;
281+
sint64 int = 6;
293282
double double = 7;
294-
CollectionBytes collection_bytes = 8;
295-
CollectionString collection_string = 9;
296-
CollectionDouble collection_double = 10;
297-
CollectionSInt64 collection_sint64 = 11;
298283
}
299284
}
300285

301-
// Used to encapsulate collection string
302-
message CollectionString {
303-
repeated string string = 1;
304-
}
305-
306-
// Used to encapsulate collection bytes
307-
message CollectionBytes {
308-
repeated bytes bytes = 1;
309-
}
310-
311-
// Used to encapsulate collection double
312-
message CollectionDouble {
313-
repeated double double = 1;
314-
}
315-
316-
// Used to encapsulate collection sint64
317-
message CollectionSInt64 {
318-
repeated sint64 sint64 = 1;
319-
}
320-
321286
// Used to describe a given binding on invocation
322287
message ParameterBinding {
323288
// Name for the binding
@@ -403,44 +368,6 @@ message RpcException {
403368
string message = 2;
404369
}
405370

406-
// Http cookie type. Note that only name and value are used for Http requests
407-
message RpcHttpCookie {
408-
// Enum that lets servers require that a cookie shouoldn't be sent with cross-site requests
409-
enum SameSite {
410-
None = 0;
411-
Lax = 1;
412-
Strict = 2;
413-
}
414-
415-
// Cookie name
416-
string name = 1;
417-
418-
// Cookie value
419-
string value = 2;
420-
421-
// Specifies allowed hosts to receive the cookie
422-
NullableString domain = 3;
423-
424-
// Specifies URL path that must exist in the requested URL
425-
NullableString path = 4;
426-
427-
// Sets the cookie to expire at a specific date instead of when the client closes.
428-
// It is generally recommended that you use "Max-Age" over "Expires".
429-
NullableTimestamp expires = 5;
430-
431-
// Sets the cookie to only be sent with an encrypted request
432-
NullableBool secure = 6;
433-
434-
// Sets the cookie to be inaccessible to JavaScript's Document.cookie API
435-
NullableBool http_only = 7;
436-
437-
// Allows servers to assert that a cookie ought not to be sent along with cross-site requests
438-
SameSite same_site = 8;
439-
440-
// Number of seconds until the cookie expires. A zero or negative number will expire the cookie immediately.
441-
NullableDouble max_age = 9;
442-
}
443-
444371
// TODO - solidify this or remove it
445372
message RpcHttp {
446373
string method = 1;
@@ -452,6 +379,4 @@ message RpcHttp {
452379
map<string,string> query = 15;
453380
bool enable_content_negotiation= 16;
454381
TypedData rawBody = 17;
455-
repeated RpcClaimsIdentity identities = 18;
456-
repeated RpcHttpCookie cookies = 19;
457382
}

azure_functions_worker/protos/_src/src/proto/identity/ClaimsIdentityRpc.proto

Lines changed: 0 additions & 26 deletions
This file was deleted.

azure_functions_worker/protos/_src/src/proto/shared/NullableTypes.proto

Lines changed: 0 additions & 30 deletions
This file was deleted.

setup.py

Lines changed: 21 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,16 @@
88
import tempfile
99
import urllib.request
1010
import zipfile
11-
import re
12-
from distutils import dir_util
1311
from distutils.command import build
1412

1513
from setuptools import setup
1614
from setuptools.command import develop
1715

1816

1917
# TODO: change this to something more stable when available.
20-
WEBHOST_URL = ('https://ci.appveyor.com/api/buildjobs/sfelyng3x6p5sus0'
18+
WEBHOST_URL = ('https://ci.appveyor.com/api/buildjobs/1em48j4cd3odl4s9'
2119
'/artifacts'
22-
'/Functions.Binaries.2.0.12642.no-runtime.zip')
20+
'/Functions.Binaries.2.0.12521-prerelease.no-runtime.zip')
2321

2422
# Extensions necessary for non-core bindings.
2523
AZURE_EXTENSIONS = [
@@ -75,74 +73,36 @@ def _gen_grpc(self):
7573

7674
proto_root_dir = root / 'azure_functions_worker' / 'protos'
7775
proto_src_dir = proto_root_dir / '_src' / 'src' / 'proto'
78-
build_dir = root / 'build'
79-
staging_root_dir = build_dir / 'protos'
76+
staging_root_dir = root / 'build' / 'protos'
8077
staging_dir = (staging_root_dir
8178
/ 'azure_functions_worker' / 'protos')
82-
built_protos_dir = build_dir / 'built_protos'
79+
build_dir = staging_dir / 'azure_functions_worker' / 'protos'
8380

84-
if os.path.exists(staging_root_dir):
85-
shutil.rmtree(staging_root_dir)
81+
if os.path.exists(build_dir):
82+
shutil.rmtree(build_dir)
8683

87-
if os.path.exists(built_protos_dir):
88-
shutil.rmtree(built_protos_dir)
84+
shutil.copytree(proto_src_dir, build_dir)
8985

90-
shutil.copytree(proto_src_dir, staging_dir)
86+
subprocess.run([
87+
sys.executable, '-m', 'grpc_tools.protoc',
88+
'-I', os.sep.join(('azure_functions_worker', 'protos')),
89+
'--python_out', str(staging_root_dir),
90+
'--grpc_python_out', str(staging_root_dir),
91+
os.sep.join(('azure_functions_worker', 'protos',
92+
'azure_functions_worker', 'protos',
93+
'FunctionRpc.proto')),
94+
], check=True, stdout=sys.stdout, stderr=sys.stderr,
95+
cwd=staging_root_dir)
9196

92-
os.makedirs(built_protos_dir)
97+
compiled = glob.glob(str(staging_dir / '*.py'))
9398

94-
protos = [
95-
os.sep.join(('shared', 'NullableTypes.proto')),
96-
os.sep.join(('identity', 'ClaimsIdentityRpc.proto')),
97-
'FunctionRpc.proto'
98-
]
99-
100-
for proto in protos:
101-
subprocess.run([
102-
sys.executable, '-m', 'grpc_tools.protoc',
103-
'-I', os.sep.join(('azure_functions_worker', 'protos')),
104-
'--python_out', str(built_protos_dir),
105-
'--grpc_python_out', str(built_protos_dir),
106-
os.sep.join(('azure_functions_worker', 'protos', proto)),
107-
], check=True, stdout=sys.stdout, stderr=sys.stderr,
108-
cwd=staging_root_dir)
109-
110-
compiled_files = glob.glob(
111-
str(built_protos_dir / '**' / '*.py'),
112-
recursive=True)
113-
114-
if not compiled_files:
99+
if not compiled:
115100
print('grpc_tools.protoc produced no Python files',
116101
file=sys.stderr)
117102
sys.exit(1)
118103

119-
# Needed to support absolute imports in files. See
120-
# https://github.com/protocolbuffers/protobuf/issues/1491
121-
self.make_absolute_imports(compiled_files)
122-
123-
dir_util.copy_tree(built_protos_dir, str(proto_root_dir))
124-
125-
def make_absolute_imports(self, compiled_files):
126-
for compiled in compiled_files:
127-
with open(compiled, 'r+') as f:
128-
content = f.read()
129-
f.seek(0)
130-
# Convert lines of the form:
131-
# import xxx_pb2 as xxx__pb2 to
132-
# from azure_functions_worker.protos import xxx_pb2 as..
133-
p1 = re.sub(
134-
r'\nimport (.*?_pb2)',
135-
r'\nfrom azure_functions_worker.protos import \g<1>',
136-
content)
137-
# Convert lines of the form:
138-
# from identity import xxx_pb2 as.. to
139-
# from azure_functions_worker.protos.identity import xxx_pb2..
140-
p2 = re.sub(
141-
r'from ([a-z]*) (import.*_pb2)',
142-
r'from azure_functions_worker.protos.\g<1> \g<2>',
143-
p1)
144-
f.write(p2)
145-
f.truncate()
104+
for f in compiled:
105+
shutil.copy(f, proto_root_dir)
146106

147107

148108
class build(build.build, BuildGRPC):

0 commit comments

Comments
 (0)