You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by ru...@apache.org on 2020/04/23 20:04:56 UTC
[cassandra-sidecar] branch master updated: Gradle can now generate
Deb packages, RPMs and Docker containers
This is an automated email from the ASF dual-hosted git repository.
rustyrazorblade pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cassandra-sidecar.git
The following commit(s) were added to refs/heads/master by this push:
new 14770b6 Gradle can now generate Deb packages, RPMs and Docker containers
14770b6 is described below
commit 14770b6921f0dcc801a2428da65e41553d13ada4
Author: Jon Haddad <jo...@jonhaddad.com>
AuthorDate: Tue Apr 21 16:00:09 2020 -0700
Gradle can now generate Deb packages, RPMs and Docker containers
Patch by Jon Haddad; Reviewed by Jake Luciani and Dinesh Joshi for CASSANDRASC-14
---
.circleci/config.yml | 43 ++++++++++++++++++++++++++++++++++++++++++-
build.gradle | 40 ++++++++++++++++++++++++++++++++++++++--
gradle.properties | 1 +
3 files changed, 81 insertions(+), 3 deletions(-)
diff --git a/.circleci/config.yml b/.circleci/config.yml
index 690b4a6..760af9d 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -12,6 +12,12 @@ aliases:
working_directory: ~/repo
environment:
TERM: dumb
+ centos: ¢os
+ docker:
+ - image: centos:centos8
+ working_directory: ~/repo
+ environment:
+ TERM: dumb
# we might modify this in the future to accept a parameter for the java package to install
commands:
@@ -76,6 +82,35 @@ jobs:
- store_test_results:
path: ~/repo/build/test-results/
+ # ensures we can build and install deb packages
+ deb_build_install:
+ <<: *base_job
+ steps:
+ - checkout
+ - install_common
+ - install_java:
+ version: adoptopenjdk-11-hotspot
+ - run: ./gradlew buildDeb
+ - run: DEBIAN_FRONTEND=noninteractive sudo apt install -y ./build/distributions/cassandra-sidecar*.deb
+ - run: test -f /opt/cassandra-sidecar/bin/cassandra-sidecar
+
+ # ensures we can build and install rpm packages
+ rpm_build_install:
+ <<: *centos
+ steps:
+ - checkout
+ - run: yum install -y java-11-openjdk-devel # the image uses root by default, no need for sudo
+ - run: JAVA_HOME=/usr/lib/jvm/java-11-openjdk ./gradlew buildRpm
+ - run: yum install -y ./build/distributions/cassandra-sidecar*.rpm
+ - run: test -f /opt/cassandra-sidecar/bin/cassandra-sidecar
+
+ docker_build:
+ <<: *base_job
+ steps:
+ - checkout
+ - run: ./gradlew jibDockerBuild
+
+
workflows:
version: 2
@@ -85,4 +120,10 @@ workflows:
test_java_11:
jobs:
- - java11
\ No newline at end of file
+ - java11
+
+ test_packaging:
+ jobs:
+ - deb_build_install
+ - rpm_build_install
+ - docker_build
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
index 6aa46d5..7eea59e 100644
--- a/build.gradle
+++ b/build.gradle
@@ -15,10 +15,15 @@ plugins {
id 'jacoco'
id "com.github.spotbugs" version "3.0.0"
id 'org.hidetake.swagger.generator' version '2.16.0'
+
+ // https://github.com/nebula-plugins/gradle-ospackage-plugin/wiki
+ id "nebula.ospackage" version "8.3.0"
+ id 'nebula.ospackage-application' version "8.3.0"
+ id 'com.google.cloud.tools.jib' version '2.2.0'
}
group 'org.apache.cassandra'
-version '1.0-SNAPSHOT'
+version project.version
sourceCompatibility = 1.8
@@ -28,7 +33,7 @@ repositories {
// Take the application out once we're running via Cassandra
mainClassName = "org.apache.cassandra.sidecar.CassandraSidecarDaemon"
-applicationName = 'CassandraSidecarDaemon'
+applicationName = 'cassandra-sidecar'
// Config file location should be in file:/// format for local files,
def confFile = "file:" + File.separator + File.separator + "APP_HOME_TO_REPLACE/conf/sidecar.yaml"
@@ -177,6 +182,37 @@ tasks.withType(com.github.spotbugs.SpotBugsTask) {
reports.html.enabled = true
}
+/**
+ * General configuration for linux packages.
+ * Can be overridden in the buildRpm and buildDeb configuration
+ * We can put dependencies here, such as java, but unfortunately since java is distributed
+ * in an inconsistent manner depending on the version you want (8 vs 11) we can't include Java
+ * as a requirement without the install breaking if you want to use a different version
+ */
+ospackage {
+ packageName = "cassandra-sidecar"
+ version = project.version
+ // ospackage puts packages into /opt/[package] by default
+ // which is _technically_ the right spot for packages
+ link("/usr/local/bin/cassandra-sidecar", "/opt/cassandra-sidecar/bin/cassandra-sidecar")
+ license "Apache License 2.0"
+ description "Sidecar Management Tool for Apache Cassandra"
+ os = LINUX
+ user "root"
+}
+
+buildRpm {
+ group = "build"
+}
+
+buildDeb {
+ group = "build"
+}
+
+applicationDistribution.from("LICENSE.txt") {
+ into ""
+}
+
// copyDist gets called on every build
copyDist.dependsOn installDist, copyJolokia
check.dependsOn checkstyleMain, checkstyleTest, integrationTest, jacocoTestReport
diff --git a/gradle.properties b/gradle.properties
new file mode 100644
index 0000000..bd60cdf
--- /dev/null
+++ b/gradle.properties
@@ -0,0 +1 @@
+version=1.0-SNAPSHOT
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org