Skip to content

Commit 48ebd9f

Browse files
taiki45mattklein123
authored andcommitted
cli: show release version with --version (envoyproxy#2276)
The release version shows the last released version. Before: version: 92a31b6f67d06078653c75645126639578c266cc/Modified/DEBUG After: version: 1c61b12055ff3e4138daa91ccff8bc7cef7bc866/1.5.0/Modified/DEBUG Signed-off-by: Taiki Ono <[email protected]>
1 parent 081c222 commit 48ebd9f

File tree

8 files changed

+37
-3
lines changed

8 files changed

+37
-3
lines changed

BUILD

+2
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
licenses(["notice"]) # Apache 2
2+
3+
exports_files(["RAW_RELEASE_NOTES.md"])

bazel/repository_locations.bzl

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ REPOSITORY_LOCATIONS = dict(
6767
urls = ["https://github.com/google/protobuf/archive/v3.5.0.tar.gz"],
6868
),
6969
envoy_api = dict(
70-
commit = "48688e7874113027193ce7b8f9f29c60bea159ae",
70+
commit = "aa73175ddf5e229dd4d97a019e5312ba1263d252",
7171
remote = "https://github.com/envoyproxy/data-plane-api",
7272
),
7373
grpc_httpjson_transcoding = dict(

docs/publish.sh

+9
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,15 @@ pushd "${DOCS_BUILD_DIR}"
2121
git clone "${GIT_INFO[0]}"
2222
cd data-plane-api
2323
git checkout "${GIT_INFO[1]}"
24+
# Check the git tag matches the version number in the VERSION file.
25+
VERSION_NUMBER=$(cat VERSION)
26+
if [ "v${VERSION_NUMBER}" != "${CIRCLE_TAG}" ]; then
27+
echo "Given git tag does not match the VERSION file content:"
28+
echo "${CIRCLE_TAG} vs $(cat VERSION)"
29+
exit 1
30+
fi
31+
# Check the version_history.rst contains current release version.
32+
grep --fixed-strings "$VERSION_NUMBER" docs/root/intro/version_history.rst
2433
./docs/build.sh
2534
popd
2635
rsync -av "${DOCS_BUILD_DIR}"/data-plane-api/generated/* generated/

source/common/common/BUILD

+11-1
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,19 @@ envoy_cc_library(
123123
deps = ["//include/envoy/common:time_interface"],
124124
)
125125

126+
genrule(
127+
name = "generate_version_number",
128+
srcs = ["@envoy_api//:VERSION"],
129+
outs = ["version_number.h"],
130+
cmd = """echo "#define BUILD_VERSION_NUMBER \\"$$(cat $<)\\"" >$@""",
131+
)
132+
126133
envoy_cc_library(
127134
name = "version_includes",
128-
hdrs = ["version.h"],
135+
hdrs = [
136+
"version.h",
137+
":generate_version_number",
138+
],
129139
)
130140

131141
envoy_cc_library(

source/common/common/version.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const std::string& VersionInfo::revisionStatus() {
1818
}
1919

2020
std::string VersionInfo::version() {
21-
return fmt::format("{}/{}/{}", revision(), revisionStatus(),
21+
return fmt::format("{}/{}/{}/{}", revision(), BUILD_VERSION_NUMBER, revisionStatus(),
2222
#ifdef NDEBUG
2323
"RELEASE"
2424
#else

source/common/common/version.h

+3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22

33
#include <string>
44

5+
#include "common/common/version_number.h"
6+
57
namespace Envoy {
8+
69
/**
710
* Wraps compiled in code versioning.
811
*/

test/exe/BUILD

+6
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ sh_test(
1717
tags = ["no_asan"],
1818
)
1919

20+
sh_test(
21+
name = "version_out_test",
22+
srcs = ["version_out_test.sh"],
23+
data = ["//source/exe:envoy-static"],
24+
)
25+
2026
envoy_cc_test(
2127
name = "signals_test",
2228
srcs = ["signals_test.cc"],

test/exe/version_out_test.sh

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
set -e -o pipefail
3+
4+
source/exe/envoy-static --version | grep -E '[0-9]+\.[0-9]+\.[0-9]+'

0 commit comments

Comments
 (0)