Skip to content

Commit 79ecad5

Browse files
committed
Detect the edition based on the Jenkins job name, and add NOTICE.txt back
Summary: - Detect the edition based on the Jenkins job name - Also add NOTICE.txt back, as required by the Apache license Test Plan: Jenkins: compile only Reviewers: bogdan, hector Reviewed By: bogdan, hector Subscribers: bogdan, ybase Differential Revision: https://phabricator.dev.yugabyte.com/D3780
1 parent 1e361a3 commit 79ecad5

File tree

3 files changed

+63
-1
lines changed

3 files changed

+63
-1
lines changed

NOTICE.txt

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
YugaByte Database
2+
Copyright 2016-present YugaByte, Inc.
3+
4+
This product includes software developed at
5+
The Apache Software Foundation (http://www.apache.org/).
6+
7+
Portions of this software were developed at
8+
Cloudera, Inc (http://www.cloudera.com/).
9+
10+
This product includes software developed by the OpenSSL
11+
Project for use in the OpenSSL Toolkit (http://www.openssl.org/)
12+
13+
This product includes cryptographic software written by Eric Young
14+
([email protected]). This product includes software written by Tim
15+

build-support/common-build-env-test.sh

+41
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@ assert_equals() {
2828
fi
2929
}
3030

31+
pretend_we_are_on_jenkins() {
32+
if [[ -z ${JOB_NAME:-} ]]; then
33+
JOB_NAME=some-jenkins-job-name
34+
fi
35+
BUILD_ID=12345
36+
USER=jenkins
37+
}
38+
3139
# -------------------------------------------------------------------------------------------------
3240
# Testing detecting build type by Jenkins job name.
3341
# -------------------------------------------------------------------------------------------------
@@ -131,6 +139,7 @@ test_set_cmake_build_type_and_compiler_type() {
131139
assert_equals "$expected_compiler_type" "$YB_COMPILER_TYPE"
132140
)
133141
local exit_code=$?
142+
set -e
134143
assert_equals "$expected_exit_code" "$exit_code"
135144
}
136145

@@ -163,4 +172,36 @@ test_set_cmake_build_type_and_compiler_type release linux-gnu auto rele
163172
test_set_cmake_build_type_and_compiler_type release linux-gnu clang release clang 0
164173
test_set_cmake_build_type_and_compiler_type release linux-gnu gcc release gcc 0
165174

175+
# -------------------------------------------------------------------------------------------------
176+
# Test detecting edition based on Jenkins job name
177+
# -------------------------------------------------------------------------------------------------
178+
179+
test_detect_edition() {
180+
expect_num_args 2 "$@"
181+
local expected_edition=$1
182+
local jenkins_job_name=$2
183+
(
184+
unset YB_EDITION
185+
yb_edition_detected=false
186+
pretend_we_are_on_jenkins
187+
JOB_NAME="$jenkins_job_name"
188+
detect_edition
189+
assert_equals "$expected_edition" "$YB_EDITION"
190+
)
191+
}
192+
193+
test_detect_edition community foo-bar-community-baz
194+
test_detect_edition community foo-bar-community
195+
test_detect_edition enterprise foo-bar-enterprise-baz
196+
test_detect_edition enterprise foo-bar-enterprise
197+
198+
# No edition specified in the Jenkins job name.
199+
if [[ -d $YB_ENTERPRISE_ROOT ]]; then
200+
test_detect_edition enterprise some-jenkins-job-name
201+
else
202+
test_detect_edition community some-jenkins-job-name
203+
fi
204+
205+
# -------------------------------------------------------------------------------------------------
206+
166207
echo "${0##/*} succeeded"

build-support/common-build-env.sh

+7-1
Original file line numberDiff line numberDiff line change
@@ -1223,7 +1223,13 @@ detect_edition() {
12231223
# If we haven't detected edition based on BUILD_ROOT, let's do that based on existence of the
12241224
# enterprise source directory.
12251225
if [[ -z ${YB_EDITION:-} ]]; then
1226-
if [[ -d $YB_ENTERPRISE_ROOT ]]; then
1226+
if is_jenkins && [[ $JOB_NAME =~ -community(-|$) ]]; then
1227+
YB_EDITION=community
1228+
log "Detecting YB_EDITION: $YB_EDITION based on Jenkins job name: $JOB_NAME"
1229+
elif is_jenkins && [[ $JOB_NAME =~ -enterprise(-|$) ]]; then
1230+
YB_EDITION=enterprise
1231+
log "Detecting YB_EDITION: $YB_EDITION based on Jenkins job name: $JOB_NAME"
1232+
elif [[ -d $YB_ENTERPRISE_ROOT ]]; then
12271233
YB_EDITION=enterprise
12281234
log "Detected YB_EDITION: $YB_EDITION based on existence of '$YB_ENTERPRISE_ROOT'"
12291235
else

0 commit comments

Comments
 (0)