forked from SumoLogic/sumologic-otel-collector-packaging
-
Notifications
You must be signed in to change notification settings - Fork 0
/
version.cmake
58 lines (48 loc) · 2.03 KB
/
version.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# OTC_VERSION represents the base version of otelcol-sumo. This value is used to
# fetch the otelcol-sumo binary from GitHub and as the version of the packages
# produced by this project.
# E.g. the A.B.C in A.B.C-sumo-X
if(NOT DEFINED ENV{OTC_VERSION})
message(FATAL_ERROR "OTC_VERSION environment variable must be set")
endif()
set(OTC_VERSION "$ENV{OTC_VERSION}")
if(NOT "${OTC_VERSION}" MATCHES "^[0-9]+\\.[0-9]+\\.[0-9]+$")
message(FATAL_ERROR
"OTC_VERSION contains an invalid version: ${OTC_VERSION}\n"
"Must be in the form X.Y.Z"
)
endif()
message(STATUS "OTC Version is set to: ${OTC_VERSION}")
# OTC_SUMO_VERSION represents the "sumo" version of otelcol-sumo. It is
# primarily used for fetching the otelcol-sumo binary from GitHub but it will
# also be used for the PACKAGE_RELEASE version (e.g. the X in A.B.C-X) if
# OTC_BUILD_NUMBER is not specified.
# E.g. the X in A.B.C-sumo-X
if(NOT DEFINED ENV{OTC_SUMO_VERSION})
message(FATAL_ERROR "OTC_SUMO_VERSION environment variable must be set")
endif()
set(OTC_SUMO_VERSION "$ENV{OTC_SUMO_VERSION}")
if(NOT "${OTC_SUMO_VERSION}" MATCHES "^[0-9]+$")
message(FATAL_ERROR
"OTC_SUMO_VERSION contains an invalid version: ${OTC_SUMO_VERSION}\n"
"Must be an unsigned integer"
)
endif()
message(STATUS "OTC Sumo Version is set to: ${OTC_SUMO_VERSION}")
# OTC_BUILD_NUMBER represents the PACKAGE_RELEASE version used for incremental
# changes to the packaging code. This should contain a unique, unsigned integer
# that increments with each build to allow upgrades from one package to another.
# A CI job number will typically be used for this value.
# E.g. the X in A.B.C-X or A.B.C.X
if(DEFINED ENV{OTC_BUILD_NUMBER})
set(BUILD_NUMBER "$ENV{OTC_BUILD_NUMBER}")
else()
set(BUILD_NUMBER "${OTC_SUMO_VERSION}")
endif()
if(NOT "${BUILD_NUMBER}" MATCHES "^[0-9]+$")
message(FATAL_ERROR
"OTC_BUILD_NUMBER contains an invalid version: ${BUILD_NUMBER}\n"
"Must be an unsigned integer"
)
endif()
message(STATUS "OTC Build Number is set to: ${BUILD_NUMBER}")