Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RSDK-8304 - send version metadata #251

Merged
merged 3 commits into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ jobs:
uses: andymckay/[email protected]
if: steps.release_exists.outputs.id != ''

- name: Bump Version Metadata
run: sed -i -e "s/sdkVersion = 'v[0-9]*\.[0-9]*\.[0-9]*'/sdkVersion = 'v${{ steps.which_version.outputs.version }}'" > lib/src/utils.dart

- name: "Generate release changelog"
uses: heinrichreimer/[email protected]
with:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/update_protos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ jobs:

- run: make setup

- name: Update Proto Tag
run: sed -i -e "s/apiTag = 'v[0-9]*\.[0-9]*\.[0-9]*'/apiTag = '${{ github.event.client_payload.tag }}'" > lib/src/utils.dart

- name: Generate buf
run: make buf
env:
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ endif

buf: buf.yaml buf.gen.yaml
rm -rf lib/src/gen
$(eval API_VERSION := $(shell grep 'const String apiTag' lib/src/utils.dart | awk -F "'" '{print $$2}'))
PATH=$(PATH_WITH_TOOLS) buf generate buf.build/viamrobotics/goutils
PATH=$(PATH_WITH_TOOLS) buf generate buf.build/viamrobotics/api
PATH=$(PATH_WITH_TOOLS) buf generate buf.build/viamrobotics/api:${API_VERSION}
PATH=$(PATH_WITH_TOOLS) buf generate buf.build/googleapis/googleapis
PATH=$(PATH_WITH_TOOLS) buf generate buf.build/protocolbuffers/wellknowntypes --path google/protobuf/any.proto
PATH=$(PATH_WITH_TOOLS) buf generate buf.build/protocolbuffers/wellknowntypes --path google/protobuf/duration.proto
Expand Down
1 change: 1 addition & 0 deletions lib/src/rpc/dial.dart
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,7 @@ class AuthenticatedChannel extends ViamGrpcOrGrpcWebChannel {
}

options = options.mergedWith(CallOptions(metadata: {'Authorization': 'Bearer $accessToken'}));
options = options.mergedWith(CallOptions(metadata: {'viam_client': getVersionMetadata()}));
return super.createCall(method, requests, options);
}
}
Expand Down
2 changes: 2 additions & 0 deletions lib/src/rpc/web_rtc/web_rtc_client.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:flutter_webrtc/flutter_webrtc.dart';
import 'package:grpc/grpc.dart';
import 'package:grpc/grpc_connection_interface.dart';
import 'package:viam_sdk/src/utils.dart';

import '../../robot/sessions_client.dart';
import 'web_rtc_client_connection.dart';
Expand Down Expand Up @@ -31,6 +32,7 @@ class WebRtcClientChannel extends ClientChannelBase {
if (!SessionsClient.unallowedMethods.contains(method.path)) {
options = options.mergedWith(CallOptions(metadata: {SessionsClient.sessionMetadataKey: _sessionId()}));
}
options = options.mergedWith(CallOptions(metadata: {'viam_client': getVersionMetadata()}));
return super.createCall(method, requests, options);
}
}
6 changes: 6 additions & 0 deletions lib/src/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,9 @@ extension MapStructUtils on Map<String, dynamic> {
return Value()..structValue = toStruct();
}
}

String getVersionMetadata() {
const String sdkVersion = 'v0.0.18';
const String apiTag = 'v0.1.328';
return 'flutter;$sdkVersion;$apiTag';
}
Loading