File tree 6 files changed +33
-5
lines changed
6 files changed +33
-5
lines changed Original file line number Diff line number Diff line change 5
5
image : " family/platform-ingest-beats-ubuntu-2204"
6
6
7
7
steps :
8
+ # TODO: this will be removed/changed for 9.0 branch
9
+ - label : " :writing_hand: Conditionally set VERSION_QUALIFIER for main branch"
10
+ if : build.branch == "main"
11
+ env :
12
+ VERSION_QUALIFIER : " alpha1"
13
+ command : " echo 'Setting VERSION_QUALIFIER for branch main'"
14
+
8
15
- label : " :package: Package Cloudbeat - Snapshot"
9
16
if : build.branch == 'main' || build.branch =~ /^[0-9]+\.[0-9x]+\$/ || build.env("RUN_RELEASE") == "true"
10
17
env :
@@ -20,16 +27,19 @@ steps:
20
27
env :
21
28
WORKFLOW : " snapshot"
22
29
30
+ # Allow building staging from main when VERSION_QUALIFIER is set (allow prerelease testing)
31
+ # TODO remove || build.env('VERSION_QUALIFIER') != null
23
32
- label : " :package: Package Cloudbeat - Staging"
24
- if : build.branch =~ /^[0-9]+\.[0-9]+\$/ || build.env("RUN_RELEASE") == "true"
33
+ if : build.branch =~ /^[0-9]+\.[0-9]+\$/ || build.env("RUN_RELEASE") == "true" || build.env('VERSION_QUALIFIER') != null
25
34
env :
26
35
WORKFLOW : " staging"
27
36
key : " package-staging"
28
37
command : " ./.buildkite/scripts/package.sh"
29
38
artifact_paths : " build/distributions/*"
30
39
40
+ # TODO remove || build.env('VERSION_QUALIFIER') != null
31
41
- label : " :rocket: Publishing Staging DRA artifacts"
32
- if : build.branch =~ /^[0-9]+\.[0-9]+\$/ || build.env("RUN_RELEASE") == "true"
42
+ if : build.branch =~ /^[0-9]+\.[0-9]+\$/ || build.env("RUN_RELEASE") == "true" || build.env('VERSION_QUALIFIER') != null
33
43
depends_on : " package-staging"
34
44
command : " ./.buildkite/scripts/publish.sh"
35
45
env :
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ source ./bin/activate-hermit
8
8
CLOUDBEAT_VERSION=$( grep defaultBeatVersion version/version.go | cut -d' =' -f2 | tr -d ' " ' )
9
9
PYTHON_BIN=./build/ve/$( go env GOOS) /bin
10
10
PYTHON=$PYTHON_BIN /python
11
+ VERSION_QUALIFIER=" ${VERSION_QUALIFIER:- " " } "
11
12
12
13
if [ " $WORKFLOW " = " snapshot" ]; then
13
14
export SNAPSHOT=" true"
@@ -21,6 +22,9 @@ mage package
21
22
22
23
CSV_FILE=" build/dependencies-${CLOUDBEAT_VERSION} "
23
24
[ -n " ${SNAPSHOT+x} " ] && CSV_FILE+=" -SNAPSHOT"
25
+ if [[ -n " $VERSION_QUALIFIER " ]]; then
26
+ CSV_FILE+=" -${VERSION_QUALIFIER} "
27
+ fi
24
28
25
29
echo " Generating $CSV_FILE .csv"
26
30
$PYTHON ./.buildkite/scripts/generate_notice.py --csv " $CSV_FILE .csv"
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ elif [ -n "$(git ls-remote --heads origin $MAJOR.x)" ]; then
13
13
else
14
14
BRANCH=main
15
15
fi
16
+ VERSION_QUALIFIER=" ${VERSION_QUALIFIER:- " " } "
16
17
17
18
# Download artifacts from other stages
18
19
echo " Downloading artifacts..."
@@ -38,4 +39,5 @@ docker run --rm \
38
39
--commit " ${BUILDKITE_COMMIT} " \
39
40
--workflow " ${WORKFLOW} " \
40
41
--version " ${VERSION} " \
41
- --artifact-set main
42
+ --artifact-set main \
43
+ --qualifier " ${VERSION_QUALIFIER} "
Original file line number Diff line number Diff line change @@ -49,8 +49,9 @@ import (
49
49
)
50
50
51
51
const (
52
- snapshotEnv = "SNAPSHOT"
53
- agentDropPath = "AGENT_DROP_PATH"
52
+ snapshotEnv = "SNAPSHOT"
53
+ agentDropPath = "AGENT_DROP_PATH"
54
+ cloudbeatModulePath = "github.com/elastic/cloudbeat"
54
55
)
55
56
56
57
func init () {
@@ -80,6 +81,9 @@ func Build() error {
80
81
81
82
args := devtools .DefaultBuildArgs ()
82
83
args .CGO = false
84
+ if versionQualifier , versionQualified := os .LookupEnv ("VERSION_QUALIFIER" ); versionQualified {
85
+ args .Vars [cloudbeatModulePath + "/version.qualifier" ] = versionQualifier
86
+ }
83
87
return devtools .Build (args )
84
88
}
85
89
@@ -95,6 +99,9 @@ func Clean() error {
95
99
func GolangCrossBuild () error {
96
100
args := devtools .DefaultGolangCrossBuildArgs ()
97
101
args .CGO = false
102
+ if versionQualifier , versionQualified := os .LookupEnv ("VERSION_QUALIFIER" ); versionQualified {
103
+ args .Vars [cloudbeatModulePath + "/version.qualifier" ] = versionQualifier
104
+ }
98
105
return devtools .GolangCrossBuild (args )
99
106
}
100
107
Original file line number Diff line number Diff line change @@ -52,6 +52,9 @@ func cloudbeatCommitTime() string {
52
52
53
53
// CloudbeatSemanticVersion returns the current cloudbeat version.
54
54
func CloudbeatSemanticVersion () string {
55
+ if qualifier != "" {
56
+ return defaultBeatVersion + "-" + qualifier
57
+ }
55
58
return defaultBeatVersion
56
59
}
57
60
Original file line number Diff line number Diff line change @@ -20,6 +20,8 @@ package version
20
20
// name matches github.com/elastic/beats/v7/dev-tools/mage/settings.go parseBeatVersion
21
21
const defaultBeatVersion = "9.0.0"
22
22
23
+ var qualifier = ""
24
+
23
25
// Version represents version information for a package
24
26
type Version struct {
25
27
Version string `mapstructure:"version,omitempty"` // Version is the semantic version of the package
You can’t perform that action at this time.
0 commit comments