Skip to content

Commit

Permalink
Detect the edition based on the Jenkins job name, and add NOTICE.txt …
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
mbautin committed Dec 30, 2017
1 parent 1e361a3 commit 79ecad5
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 1 deletion.
15 changes: 15 additions & 0 deletions NOTICE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
YugaByte Database
Copyright 2016-present YugaByte, Inc.

This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).

Portions of this software were developed at
Cloudera, Inc (http://www.cloudera.com/).

This product includes software developed by the OpenSSL
Project for use in the OpenSSL Toolkit (http://www.openssl.org/)

This product includes cryptographic software written by Eric Young
(eay@cryptsoft.com). This product includes software written by Tim
Hudson (tjh@cryptsoft.com).
41 changes: 41 additions & 0 deletions build-support/common-build-env-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ assert_equals() {
fi
}

pretend_we_are_on_jenkins() {
if [[ -z ${JOB_NAME:-} ]]; then
JOB_NAME=some-jenkins-job-name
fi
BUILD_ID=12345
USER=jenkins
}

# -------------------------------------------------------------------------------------------------
# Testing detecting build type by Jenkins job name.
# -------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -131,6 +139,7 @@ test_set_cmake_build_type_and_compiler_type() {
assert_equals "$expected_compiler_type" "$YB_COMPILER_TYPE"
)
local exit_code=$?
set -e
assert_equals "$expected_exit_code" "$exit_code"
}

Expand Down Expand Up @@ -163,4 +172,36 @@ test_set_cmake_build_type_and_compiler_type release linux-gnu auto rele
test_set_cmake_build_type_and_compiler_type release linux-gnu clang release clang 0
test_set_cmake_build_type_and_compiler_type release linux-gnu gcc release gcc 0

# -------------------------------------------------------------------------------------------------
# Test detecting edition based on Jenkins job name
# -------------------------------------------------------------------------------------------------

test_detect_edition() {
expect_num_args 2 "$@"
local expected_edition=$1
local jenkins_job_name=$2
(
unset YB_EDITION
yb_edition_detected=false
pretend_we_are_on_jenkins
JOB_NAME="$jenkins_job_name"
detect_edition
assert_equals "$expected_edition" "$YB_EDITION"
)
}

test_detect_edition community foo-bar-community-baz
test_detect_edition community foo-bar-community
test_detect_edition enterprise foo-bar-enterprise-baz
test_detect_edition enterprise foo-bar-enterprise

# No edition specified in the Jenkins job name.
if [[ -d $YB_ENTERPRISE_ROOT ]]; then
test_detect_edition enterprise some-jenkins-job-name
else
test_detect_edition community some-jenkins-job-name
fi

# -------------------------------------------------------------------------------------------------

echo "${0##/*} succeeded"
8 changes: 7 additions & 1 deletion build-support/common-build-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1223,7 +1223,13 @@ detect_edition() {
# If we haven't detected edition based on BUILD_ROOT, let's do that based on existence of the
# enterprise source directory.
if [[ -z ${YB_EDITION:-} ]]; then
if [[ -d $YB_ENTERPRISE_ROOT ]]; then
if is_jenkins && [[ $JOB_NAME =~ -community(-|$) ]]; then
YB_EDITION=community
log "Detecting YB_EDITION: $YB_EDITION based on Jenkins job name: $JOB_NAME"
elif is_jenkins && [[ $JOB_NAME =~ -enterprise(-|$) ]]; then
YB_EDITION=enterprise
log "Detecting YB_EDITION: $YB_EDITION based on Jenkins job name: $JOB_NAME"
elif [[ -d $YB_ENTERPRISE_ROOT ]]; then
YB_EDITION=enterprise
log "Detected YB_EDITION: $YB_EDITION based on existence of '$YB_ENTERPRISE_ROOT'"
else
Expand Down

0 comments on commit 79ecad5

Please sign in to comment.