Skip to content

Commit 50e2dea

Browse files
authored
Merge 912b076 into 048616f
2 parents 048616f + 912b076 commit 50e2dea

File tree

8 files changed

+226
-6
lines changed

8 files changed

+226
-6
lines changed

.github/actions/build_ya/action.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,12 @@ runs:
6161
set -x
6262
extra_params=()
6363
64-
if [ ! -z "${{ inputs.build_target }}" ]; then
65-
extra_params+=(--target="${{ inputs.build_target }}")
66-
fi
64+
YA_MAKE_TARGET=""
65+
for TARGET in ${{ inputs.build_target }}; do
66+
if [ -e $TARGET ]; then
67+
YA_MAKE_TARGET="$YA_MAKE_TARGET $TARGET"
68+
fi
69+
done
6770
6871
if [ ! -z "${{ inputs.bazel_remote_uri }}" ]; then
6972
extra_params+=(--bazel-remote-store)
@@ -125,7 +128,7 @@ runs:
125128
# to be sure
126129
set -o pipefail
127130
128-
./ya make --cache-size 2TB --build "${build_type}" --force-build-depends -T --stat -DCONSISTENT_DEBUG \
131+
./ya make $YA_MAKE_TARGET --cache-size 2TB --build "${build_type}" --force-build-depends -T --stat -DCONSISTENT_DEBUG \
129132
--log-file "$TMP_DIR/ya_log.txt" --evlog-file "$TMP_DIR/ya_evlog.jsonl" \
130133
--link-threads "${{ inputs.link_threads }}" \
131134
"${extra_params[@]}" |& tee $TMP_DIR/ya_make.log && echo "status=true" >> $GITHUB_OUTPUT || (

.github/workflows/nightly_build.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
uses: ./.github/actions/build_and_test_ya
3535
with:
3636
build_preset: ${{ matrix.build_preset }}
37-
build_target: "ydb/apps/ydbd"
37+
build_target: "ydb/apps/ydbd ydb/tests/library/compatibility/configs/dump"
3838
increment: false
3939
run_tests: false
4040
put_build_results_to_cache: false
@@ -55,4 +55,7 @@ jobs:
5555
shell: bash
5656
run: |
5757
set -x
58-
s3cmd sync --follow-symlinks --acl-public --no-progress --stats --no-check-md5 "ydb/apps/ydbd/ydbd" "s3://ydb-builds/${{ github.ref_name }}/${{ matrix.build_preset }}/ydbd" -d
58+
s3cmd sync --follow-symlinks --acl-public --no-progress --stats --no-check-md5 "ydb/apps/ydbd/ydbd" "s3://ydb-builds/${{ github.ref_name }}/${{ matrix.build_preset }}/ydbd" -d
59+
if [ -e ydb/tests/library/compatibility/configs/dump/config-meta.json ]; then
60+
s3cmd sync --follow-symlinks --acl-public --no-progress --stats --no-check-md5 "ydb/tests/library/compatibility/configs/dump/config-meta.json" "s3://ydb-builds/${{ github.ref_name }}/${{ matrix.build_preset }}/config-meta.json" -d
61+
fi
Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
#include <ydb/core/protos/config.pb.h>
2+
#include <library/cpp/json/json_value.h>
3+
#include <library/cpp/json/json_writer.h>
4+
5+
#include <google/protobuf/descriptor.h>
6+
#include <google/protobuf/descriptor.pb.h>
7+
#include <google/protobuf/message.h>
8+
9+
using namespace google::protobuf;
10+
11+
void Proto2Json(const Message& proto, NJson::TJsonValue& json);
12+
13+
void PrintSingleFieldValue(const Message& proto,
14+
const FieldDescriptor& field,
15+
NJson::TJsonValue& json) {
16+
#define FIELD_TO_JSON(EProtoCppType, ProtoGet) \
17+
case FieldDescriptor::EProtoCppType: { \
18+
json = reflection->ProtoGet(proto, &field); \
19+
break; \
20+
}
21+
22+
const Reflection* reflection = proto.GetReflection();
23+
switch (field.cpp_type()) {
24+
FIELD_TO_JSON(CPPTYPE_INT32, GetInt32);
25+
FIELD_TO_JSON(CPPTYPE_INT64, GetInt64);
26+
FIELD_TO_JSON(CPPTYPE_UINT32, GetUInt32);
27+
FIELD_TO_JSON(CPPTYPE_UINT64, GetUInt64);
28+
FIELD_TO_JSON(CPPTYPE_DOUBLE, GetDouble);
29+
FIELD_TO_JSON(CPPTYPE_FLOAT, GetFloat);
30+
FIELD_TO_JSON(CPPTYPE_BOOL, GetBool);
31+
FIELD_TO_JSON(CPPTYPE_STRING, GetString);
32+
33+
case FieldDescriptor::CPPTYPE_MESSAGE: {
34+
json.SetType(NJson::JSON_MAP);
35+
Proto2Json(reflection->GetMessage(proto, &field), json);
36+
break;
37+
}
38+
39+
case FieldDescriptor::CPPTYPE_ENUM: {
40+
json = reflection->GetEnum(proto, &field)->name();
41+
break;
42+
}
43+
44+
default:
45+
ythrow yexception() << "Unknown protobuf field type: "
46+
<< static_cast<int>(field.cpp_type()) << ".";
47+
}
48+
#undef FIELD_TO_JSON
49+
}
50+
51+
void PrintRepeatedFieldValue(const Message& proto,
52+
const FieldDescriptor& field,
53+
NJson::TJsonValue& json, size_t index) {
54+
#define FIELD_TO_JSON(EProtoCppType, ProtoGet) \
55+
case FieldDescriptor::EProtoCppType: { \
56+
json = reflection->ProtoGet(proto, &field, index); \
57+
break; \
58+
}
59+
60+
const Reflection* reflection = proto.GetReflection();
61+
switch (field.cpp_type()) {
62+
FIELD_TO_JSON(CPPTYPE_INT32, GetRepeatedInt32);
63+
FIELD_TO_JSON(CPPTYPE_INT64, GetRepeatedInt64);
64+
FIELD_TO_JSON(CPPTYPE_UINT32, GetRepeatedUInt32);
65+
FIELD_TO_JSON(CPPTYPE_UINT64, GetRepeatedUInt64);
66+
FIELD_TO_JSON(CPPTYPE_DOUBLE, GetRepeatedDouble);
67+
FIELD_TO_JSON(CPPTYPE_FLOAT, GetRepeatedFloat);
68+
FIELD_TO_JSON(CPPTYPE_BOOL, GetRepeatedBool);
69+
FIELD_TO_JSON(CPPTYPE_STRING, GetRepeatedString);
70+
71+
case FieldDescriptor::CPPTYPE_MESSAGE: {
72+
json.SetType(NJson::JSON_MAP);
73+
Proto2Json(reflection->GetRepeatedMessage(proto, &field, index), json);
74+
break;
75+
}
76+
77+
case FieldDescriptor::CPPTYPE_ENUM: {
78+
json = reflection->GetRepeatedEnum(proto, &field, index)->name();
79+
break;
80+
}
81+
82+
default:
83+
ythrow yexception() << "Unknown protobuf field type: "
84+
<< static_cast<int>(field.cpp_type()) << ".";
85+
}
86+
#undef FIELD_TO_JSON
87+
}
88+
89+
void PrintSingleField(const Message& proto,
90+
const FieldDescriptor& field,
91+
NJson::TJsonValue& json, TStringBuf key) {
92+
Y_ABORT_UNLESS(!field.is_repeated(), "field is repeated.");
93+
json[key]["id"] = field.number();
94+
PrintSingleFieldValue(proto, field, json[key]["default-value"]);
95+
}
96+
97+
void PrintRepeatedField(const Message& proto,
98+
const FieldDescriptor& field,
99+
NJson::TJsonValue& json, TStringBuf key) {
100+
Y_ABORT_UNLESS(field.is_repeated(), "field isn't repeated.");
101+
const Reflection* reflection = proto.GetReflection();
102+
json[key]["id"] = field.number();
103+
auto& array = json[key].InsertValue("default-value", NJson::TJsonArray());
104+
for (size_t i = 0, endI = reflection->FieldSize(proto, &field); i < endI; ++i) {
105+
PrintRepeatedFieldValue(proto, field, array.AppendValue(NJson::JSON_UNDEFINED), i);
106+
}
107+
}
108+
109+
void PrintField(const Message& proto,
110+
const FieldDescriptor& field,
111+
NJson::TJsonValue& json, TStringBuf key) {
112+
if (field.is_repeated())
113+
PrintRepeatedField(proto, field, json, key);
114+
else
115+
PrintSingleField(proto, field, json, key);
116+
}
117+
118+
void Proto2Json(const Message& proto, NJson::TJsonValue& json) {
119+
const auto* descriptor = proto.GetDescriptor();
120+
Y_ASSERT(descriptor);
121+
122+
// Iterate over all non-extension fields
123+
for (int f = 0, endF = descriptor->field_count(); f < endF; ++f) {
124+
const FieldDescriptor* field = descriptor->field(f);
125+
Y_ASSERT(field);
126+
PrintField(proto, *field, json, field->name());
127+
}
128+
129+
// Check extensions via ListFields
130+
std::vector<const FieldDescriptor*> fields;
131+
auto* ref = proto.GetReflection();
132+
ref->ListFields(proto, &fields);
133+
134+
for (const auto* field : fields) {
135+
Y_ASSERT(field);
136+
if (field->is_extension()) {
137+
PrintField(proto, *field, json, field->full_name());
138+
}
139+
}
140+
141+
}
142+
143+
int main(int argc, const char** argv) {
144+
Y_UNUSED(argc);
145+
Y_UNUSED(argv);
146+
const auto defaultConf = NKikimrConfig::TAppConfig::default_instance();
147+
NJson::TJsonValue json;
148+
Proto2Json(defaultConf, json["proto"]);
149+
NJson::WriteJson(&Cout, &json, true, true);
150+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
PROGRAM(ydb-config-meta-dumper)
2+
3+
PEERDIR(
4+
ydb/core/protos
5+
library/cpp/json
6+
)
7+
8+
SRCS(main.cpp)
9+
10+
END()
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
RECURSE(dumper)
2+
3+
UNION()
4+
5+
RUN_PROGRAM(
6+
ydb/tests/library/compatibility/configs/dump/dumper
7+
STDOUT_NOAUTO config-meta.json
8+
)
9+
10+
END()
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
RECURSE(dump)
2+
3+
INCLUDE(${ARCADIA_ROOT}/ydb/tests/library/compatibility/versions.inc)
4+
5+
# UNION()
6+
#
7+
#
8+
# RUN_PROGRAM(
9+
# ydb/tests/library/compatibility/binaries/downloader download $YDB_COMPAT_INTER_REF/release/config-meta.json inter $YDB_COMPAT_INTER_REF
10+
# OUT_NOAUTO inter inter-name
11+
# )
12+
#
13+
# RUN_PROGRAM(
14+
# ydb/tests/library/compatibility/binaries/downloader download $YDB_COMPAT_INIT_REF/release/config-meta.json init $YDB_COMPAT_INIT_REF
15+
# OUT_NOAUTO init init-name
16+
# )
17+
#
18+
# IF(${YDB_COMPAT_TARGET_REF} != "current")
19+
# RUN_PROGRAM(
20+
# ydb/tests/library/compatibility/binaries/downloader download $YDB_COMPAT_TARGET_REF/release/config-meta.json target $YDB_COMPAT_TARGET_REF
21+
# OUT_NOAUTO target target-name
22+
# )
23+
# ELSE()
24+
# RUN_PROGRAM(
25+
# ydb/tests/library/compatibility/configs/dump/dumper
26+
# STDOUT_NOAUTO target
27+
# )
28+
# RUN(
29+
# echo current
30+
# STDOUT_NOAUTO target-name
31+
# )
32+
# ENDIF()
33+
#
34+
# END()
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
IF(NOT ${YDB_COMPAT_INIT_REF})
2+
SET(YDB_COMPAT_INIT_REF stable-24-4-4-hotfix)
3+
ENDIF()
4+
IF(NOT ${YDB_COMPAT_INTER_REF})
5+
SET(YDB_COMPAT_INTER_REF stable-25-1-3)
6+
ENDIF()
7+
IF(NOT ${YDB_COMPAT_TARGET_REF})
8+
SET(YDB_COMPAT_TARGET_REF current)
9+
ENDIF()
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
RECURSE(configs)

0 commit comments

Comments
 (0)