diff options
Diffstat (limited to 'fluent-bit/lib/librdkafka-2.1.0/packaging/cp')
5 files changed, 193 insertions, 0 deletions
diff --git a/fluent-bit/lib/librdkafka-2.1.0/packaging/cp/README.md b/fluent-bit/lib/librdkafka-2.1.0/packaging/cp/README.md new file mode 100644 index 00000000..24a82f14 --- /dev/null +++ b/fluent-bit/lib/librdkafka-2.1.0/packaging/cp/README.md @@ -0,0 +1,14 @@ +# Confluent Platform package verification + +This small set of scripts verifies the librdkafka packages that +are part of the Confluent Platform. + +The base_url is the http S3 bucket path to the a PR job, or similar. + +## How to use + + $ ./verify-packages.sh 5.3 https://thes3bucketpath/X/Y + + +Requires docker and patience. + diff --git a/fluent-bit/lib/librdkafka-2.1.0/packaging/cp/check_features.c b/fluent-bit/lib/librdkafka-2.1.0/packaging/cp/check_features.c new file mode 100644 index 00000000..4229402f --- /dev/null +++ b/fluent-bit/lib/librdkafka-2.1.0/packaging/cp/check_features.c @@ -0,0 +1,64 @@ +#include <stdio.h> +#include <string.h> +#include <librdkafka/rdkafka.h> + +int main(int argc, char **argv) { + rd_kafka_conf_t *conf; + char buf[512]; + size_t sz = sizeof(buf); + rd_kafka_conf_res_t res; + static const char *expected_features = "ssl,sasl_gssapi,lz4,zstd"; + char errstr[512]; + int i; + int failures = 0; + + printf("librdkafka %s (0x%x, define: 0x%x)\n", rd_kafka_version_str(), + rd_kafka_version(), RD_KAFKA_VERSION); + + if (argc > 1 && !(argc & 1)) { + printf("Usage: %s [config.property config-value ..]\n", + argv[0]); + return 1; + } + + conf = rd_kafka_conf_new(); + res = rd_kafka_conf_get(conf, "builtin.features", buf, &sz); + + if (res != RD_KAFKA_CONF_OK) { + printf("ERROR: conf_get failed: %d\n", res); + return 1; + } + + printf("builtin.features: %s\n", buf); + + /* librdkafka allows checking for expected features + * by setting the corresponding feature flags in builtin.features, + * which will return an error if one or more flags are not enabled. */ + if (rd_kafka_conf_set(conf, "builtin.features", expected_features, + errstr, sizeof(errstr)) != RD_KAFKA_CONF_OK) { + printf( + "ERROR: expected at least features: %s\n" + "got error: %s\n", + expected_features, errstr); + failures++; + } + + printf("all expected features matched: %s\n", expected_features); + + /* Apply config from argv key value pairs */ + for (i = 1; i + 1 < argc; i += 2) { + printf("verifying config %s=%s\n", argv[i], argv[i + 1]); + if (rd_kafka_conf_set(conf, argv[i], argv[i + 1], errstr, + sizeof(errstr)) != RD_KAFKA_CONF_OK) { + printf("ERROR: failed to set %s=%s: %s\n", argv[i], + argv[i + 1], errstr); + failures++; + } + } + + rd_kafka_conf_destroy(conf); + + printf("%d failures\n", failures); + + return !!failures; +} diff --git a/fluent-bit/lib/librdkafka-2.1.0/packaging/cp/verify-deb.sh b/fluent-bit/lib/librdkafka-2.1.0/packaging/cp/verify-deb.sh new file mode 100755 index 00000000..1350d065 --- /dev/null +++ b/fluent-bit/lib/librdkafka-2.1.0/packaging/cp/verify-deb.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# + +set -e + +cpver=$1 +base_url=$2 + +if [[ -z $base_url ]]; then + echo "Usage: $0 <cp-base-ver> <base_url>" + exit 1 +fi + +apt-get update +apt-get install -y apt-transport-https wget + +wget -qO - ${base_url}/deb/${cpver}/archive.key | apt-key add - + + +cat >/etc/apt/sources.list.d/Confluent.list <<EOF +deb [arch=amd64] $base_url/deb/${cpver} stable main +EOF + +apt-get update +apt-get install -y librdkafka-dev gcc + +gcc /v/check_features.c -o /tmp/check_features -lrdkafka + +/tmp/check_features + +# Verify plugins +apt-get install -y confluent-librdkafka-plugins + +/tmp/check_features plugin.library.paths monitoring-interceptor diff --git a/fluent-bit/lib/librdkafka-2.1.0/packaging/cp/verify-packages.sh b/fluent-bit/lib/librdkafka-2.1.0/packaging/cp/verify-packages.sh new file mode 100755 index 00000000..ecddbd55 --- /dev/null +++ b/fluent-bit/lib/librdkafka-2.1.0/packaging/cp/verify-packages.sh @@ -0,0 +1,43 @@ +#!/bin/bash +# +# Verifies RPM and DEB packages from Confluent Platform +# + +cpver=$1 +base_url=$2 + +if [[ -z $base_url ]]; then + echo "Usage: $0 <CP-M.m-version> <base-url>" + echo "" + echo " <CP-M.m-version> is the Major.minor version of CP, e.g., 5.3" + echo " <base-url> is the release base bucket URL" + exit 1 +fi + +thisdir="$( cd "$(dirname "$0")" ; pwd -P )" + +echo "#### Verifying RPM packages ####" +docker run -v $thisdir:/v centos:7 /v/verify-rpm.sh $cpver $base_url +rpm_status=$? + +echo "#### Verifying Debian packages ####" +docker run -v $thisdir:/v ubuntu:16.04 /v/verify-deb.sh $cpver $base_url +deb_status=$? + + +if [[ $rpm_status == 0 ]]; then + echo "SUCCESS: RPM packages verified" +else + echo "ERROR: RPM package verification failed" +fi + +if [[ $deb_status == 0 ]]; then + echo "SUCCESS: Debian packages verified" +else + echo "ERROR: Debian package verification failed" +fi + +if [[ $deb_status != 0 || $rpm_status != 0 ]]; then + exit 1 +fi + diff --git a/fluent-bit/lib/librdkafka-2.1.0/packaging/cp/verify-rpm.sh b/fluent-bit/lib/librdkafka-2.1.0/packaging/cp/verify-rpm.sh new file mode 100755 index 00000000..d7b3b1a1 --- /dev/null +++ b/fluent-bit/lib/librdkafka-2.1.0/packaging/cp/verify-rpm.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# + +set -e + +cpver=$1 +base_url=$2 + +if [[ -z $base_url ]]; then + echo "Usage: $0 <cp-base-ver> <base_url>" + exit 1 +fi + +cat >/etc/yum.repos.d/Confluent.repo <<EOF +[Confluent.dist] +name=Confluent repository (dist) +baseurl=$base_url/rpm/${cpver}/7 +gpgcheck=0 +gpgkey=$base_url/rpm/${cpver}/archive.key +enabled=1 +[Confluent] +name=Confluent repository +baseurl=$base_url/rpm/${cpver} +gpgcheck=1 +gpgkey=$base_url/rpm/${cpver}/archive.key +enabled=1 +EOF + +yum install -y librdkafka-devel gcc + +gcc /v/check_features.c -o /tmp/check_features -lrdkafka + +/tmp/check_features + +# Verify plugins +yum install -y confluent-librdkafka-plugins + +/tmp/check_features plugin.library.paths monitoring-interceptor |