mirror of
https://github.com/wahyd4/telegraf.git
synced 2026-08-21 18:46:07 +10:00
Merge branch 'master' into efficks_buildwindows
This commit is contained in:
+11
-15
@@ -96,7 +96,7 @@ supported_packages = {
|
||||
"freebsd": [ "tar" ]
|
||||
}
|
||||
|
||||
next_version = '1.5.0'
|
||||
next_version = '1.9.0'
|
||||
|
||||
################
|
||||
#### Telegraf Functions
|
||||
@@ -156,12 +156,8 @@ def go_get(branch, update=False, no_uncommitted=False):
|
||||
if local_changes() and no_uncommitted:
|
||||
logging.error("There are uncommitted changes in the current directory.")
|
||||
return False
|
||||
if not check_path_for("gdm"):
|
||||
logging.info("Downloading `gdm`...")
|
||||
get_command = "go get github.com/sparrc/gdm"
|
||||
run(get_command)
|
||||
logging.info("Retrieving dependencies with `gdm`...")
|
||||
run("{}/bin/gdm restore -v".format(os.environ.get("GOPATH",
|
||||
logging.info("Retrieving dependencies with `dep`...")
|
||||
run("{}/bin/dep ensure -v -vendor-only".format(os.environ.get("GOPATH",
|
||||
os.path.expanduser("~/go"))))
|
||||
return True
|
||||
|
||||
@@ -448,17 +444,17 @@ def build(version=None,
|
||||
if "static_" in arch:
|
||||
static = True
|
||||
arch = arch.replace("static_", "")
|
||||
env["CGO_ENABLED"] = "0"
|
||||
build_command += "CGO_ENABLED=0 "
|
||||
|
||||
# Handle variations in architecture output
|
||||
goarch = arch
|
||||
if arch == "i386" or arch == "i686":
|
||||
arch = "386"
|
||||
goarch = "386"
|
||||
elif "arm64" in arch:
|
||||
arch = "arm64"
|
||||
goarch = "arm64"
|
||||
elif "arm" in arch:
|
||||
arch = "arm"
|
||||
env["GOOS"] = platform
|
||||
env["GOARCH"] = arch
|
||||
goarch = "arm"
|
||||
build_command += "GOOS={} GOARCH={} ".format(platform, goarch)
|
||||
|
||||
if "arm" in arch:
|
||||
if arch == "armel":
|
||||
@@ -679,7 +675,7 @@ def package(build_output, pkg_name, version, nightly=False, iteration=1, static=
|
||||
package_build_root,
|
||||
current_location)
|
||||
if package_type == "rpm":
|
||||
fpm_command += "--depends coreutils --rpm-posttrans {}".format(POSTINST_SCRIPT)
|
||||
fpm_command += "--depends coreutils --depends shadow-utils --rpm-posttrans {}".format(POSTINST_SCRIPT)
|
||||
out = run(fpm_command, shell=True)
|
||||
matches = re.search(':path=>"(.*)"', out)
|
||||
outfile = None
|
||||
@@ -727,7 +723,7 @@ def main(args):
|
||||
orig_branch = get_current_branch()
|
||||
|
||||
if args.platform not in supported_builds and args.platform != 'all':
|
||||
logging.error("Invalid build platform: {}".format(target_platform))
|
||||
logging.error("Invalid build platform: {}".format(args.platform))
|
||||
return 1
|
||||
|
||||
build_output = {}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
FROM golang:1.10.3
|
||||
|
||||
RUN chmod -R 755 "$GOPATH"
|
||||
|
||||
RUN DEBIAN_FRONTEND=noninteractive \
|
||||
apt update && apt install -y --no-install-recommends \
|
||||
autoconf \
|
||||
git \
|
||||
libtool \
|
||||
locales \
|
||||
make \
|
||||
python-boto \
|
||||
rpm \
|
||||
ruby \
|
||||
ruby-dev \
|
||||
zip && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN ln -sf /usr/share/zoneinfo/Etc/UTC /etc/localtime
|
||||
RUN locale-gen C.UTF-8 || true
|
||||
ENV LANG=C.UTF-8
|
||||
|
||||
RUN gem install fpm
|
||||
|
||||
RUN go get -d github.com/golang/dep && \
|
||||
cd src/github.com/golang/dep && \
|
||||
git checkout -q v0.5.0 && \
|
||||
go install -ldflags="-X main.version=v0.5.0" ./cmd/dep
|
||||
@@ -0,0 +1,28 @@
|
||||
FROM golang:1.9.7
|
||||
|
||||
RUN chmod -R 755 "$GOPATH"
|
||||
|
||||
RUN DEBIAN_FRONTEND=noninteractive \
|
||||
apt update && apt install -y --no-install-recommends \
|
||||
autoconf \
|
||||
git \
|
||||
libtool \
|
||||
locales \
|
||||
make \
|
||||
python-boto \
|
||||
rpm \
|
||||
ruby \
|
||||
ruby-dev \
|
||||
zip && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN ln -sf /usr/share/zoneinfo/Etc/UTC /etc/localtime
|
||||
RUN locale-gen C.UTF-8 || true
|
||||
ENV LANG=C.UTF-8
|
||||
|
||||
RUN gem install fpm
|
||||
|
||||
RUN go get -d github.com/golang/dep && \
|
||||
cd src/github.com/golang/dep && \
|
||||
git checkout -q v0.5.0 && \
|
||||
go install -ldflags="-X main.version=v0.5.0" ./cmd/dep
|
||||
@@ -1,95 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# This is the Telegraf CircleCI test script. Using this script allows total control
|
||||
# the environment in which the build and test is run, and matches the official
|
||||
# build process for InfluxDB.
|
||||
|
||||
BUILD_DIR=$HOME/telegraf-build
|
||||
VERSION=`git describe --always --tags`
|
||||
|
||||
# Executes the given statement, and exits if the command returns a non-zero code.
|
||||
function exit_if_fail {
|
||||
command=$@
|
||||
echo "Executing '$command'"
|
||||
eval $command
|
||||
rc=$?
|
||||
if [ $rc -ne 0 ]; then
|
||||
echo "'$command' returned $rc."
|
||||
exit $rc
|
||||
fi
|
||||
}
|
||||
|
||||
# Check that go fmt has been run.
|
||||
function check_go_fmt {
|
||||
fmtcount=`git ls-files | grep '.go$' | grep -v Godep | xargs gofmt -l 2>&1 | wc -l`
|
||||
if [ $fmtcount -gt 0 ]; then
|
||||
echo "run 'go fmt ./...' to format your source code."
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Set up the build directory, and then GOPATH.
|
||||
exit_if_fail mkdir $BUILD_DIR
|
||||
export GOPATH=$BUILD_DIR
|
||||
# Turning off GOGC speeds up build times
|
||||
export GOGC=off
|
||||
export PATH=$GOPATH/bin:$PATH
|
||||
exit_if_fail mkdir -p $GOPATH/src/github.com/influxdata
|
||||
|
||||
# Dump some test config to the log.
|
||||
echo "Test configuration"
|
||||
echo "========================================"
|
||||
echo "\$HOME: $HOME"
|
||||
echo "\$GOPATH: $GOPATH"
|
||||
echo "\$CIRCLE_BRANCH: $CIRCLE_BRANCH"
|
||||
|
||||
# Move the checked-out source to a better location
|
||||
exit_if_fail mv $HOME/telegraf $GOPATH/src/github.com/influxdata
|
||||
exit_if_fail cd $GOPATH/src/github.com/influxdata/telegraf
|
||||
|
||||
# Verify that go fmt has been run
|
||||
check_go_fmt
|
||||
|
||||
# Build the code
|
||||
exit_if_fail make
|
||||
|
||||
# Run the tests
|
||||
exit_if_fail go vet ./...
|
||||
exit_if_fail make docker-run-circle
|
||||
# Sleep for OpenTSDB leadership election, aerospike cluster, etc.
|
||||
exit_if_fail sleep 60
|
||||
exit_if_fail go test -race ./...
|
||||
|
||||
# Simple Integration Tests
|
||||
# check that one test cpu & mem output work
|
||||
tmpdir=$(mktemp -d)
|
||||
./telegraf config > $tmpdir/config.toml
|
||||
exit_if_fail ./telegraf -config $tmpdir/config.toml \
|
||||
-test -input-filter cpu:mem
|
||||
|
||||
gzip telegraf -c > "$CIRCLE_ARTIFACTS/telegraf.gz"
|
||||
|
||||
if git describe --exact-match HEAD 2>&1 >/dev/null; then
|
||||
# install fpm (packaging dependency)
|
||||
exit_if_fail gem install fpm
|
||||
# install boto & rpm (packaging & AWS dependencies)
|
||||
exit_if_fail sudo apt-get install -y rpm python-boto
|
||||
unset GOGC
|
||||
tag=$(git describe --exact-match HEAD)
|
||||
echo $tag
|
||||
exit_if_fail ./scripts/build.py --release --package --platform=all --arch=all --upload --bucket=dl.influxdata.com/telegraf/releases
|
||||
mv build $CIRCLE_ARTIFACTS
|
||||
elif [ -n "${PACKAGE}" ]; then
|
||||
# install fpm (packaging dependency)
|
||||
exit_if_fail gem install fpm
|
||||
# install boto & rpm (packaging & AWS dependencies)
|
||||
exit_if_fail sudo apt-get install -y rpm python-boto
|
||||
unset GOGC
|
||||
if [ "$(git rev-parse --abbrev-ref HEAD)" = master ]
|
||||
then
|
||||
exit_if_fail ./scripts/build.py --nightly --package --platform=all --arch=all --upload --bucket=dl.influxdata.com/telegraf/nightlies
|
||||
else
|
||||
exit_if_fail ./scripts/build.py --package --platform=all --arch=all
|
||||
fi
|
||||
mv build $CIRCLE_ARTIFACTS
|
||||
fi
|
||||
@@ -34,7 +34,9 @@ fi
|
||||
DEFAULT=/etc/default/telegraf
|
||||
|
||||
if [ -r $DEFAULT ]; then
|
||||
set -o allexport
|
||||
source $DEFAULT
|
||||
set +o allexport
|
||||
fi
|
||||
|
||||
if [ -z "$STDOUT" ]; then
|
||||
|
||||
@@ -74,7 +74,7 @@ elif [[ -f /etc/debian_version ]]; then
|
||||
# Debian/Ubuntu logic
|
||||
if [[ "$(readlink /proc/1/exe)" == */systemd ]]; then
|
||||
install_systemd /lib/systemd/system/telegraf.service
|
||||
systemctl restart telegraf || echo "WARNING: systemd not running."
|
||||
deb-systemd-invoke restart telegraf.service || echo "WARNING: systemd not running."
|
||||
else
|
||||
# Assuming SysVinit
|
||||
install_init
|
||||
|
||||
@@ -1,66 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
mkdir certs certs_by_serial private &&
|
||||
chmod 700 private &&
|
||||
echo 01 > ./serial &&
|
||||
touch ./index.txt &&
|
||||
cat >./openssl.conf <<EOF
|
||||
[ ca ]
|
||||
default_ca = telegraf_ca
|
||||
|
||||
[ telegraf_ca ]
|
||||
certificate = ./certs/cacert.pem
|
||||
database = ./index.txt
|
||||
new_certs_dir = ./certs_by_serial
|
||||
private_key = ./private/cakey.pem
|
||||
serial = ./serial
|
||||
|
||||
default_crl_days = 3650
|
||||
default_days = 3650
|
||||
default_md = sha256
|
||||
|
||||
policy = telegraf_ca_policy
|
||||
x509_extensions = certificate_extensions
|
||||
|
||||
[ telegraf_ca_policy ]
|
||||
commonName = supplied
|
||||
|
||||
[ certificate_extensions ]
|
||||
basicConstraints = CA:false
|
||||
|
||||
[ req ]
|
||||
default_bits = 1024
|
||||
default_keyfile = ./private/cakey.pem
|
||||
default_md = sha256
|
||||
prompt = yes
|
||||
distinguished_name = root_ca_distinguished_name
|
||||
x509_extensions = root_ca_extensions
|
||||
|
||||
[ root_ca_distinguished_name ]
|
||||
commonName = hostname
|
||||
|
||||
[ root_ca_extensions ]
|
||||
basicConstraints = CA:true
|
||||
keyUsage = keyCertSign, cRLSign
|
||||
|
||||
[ client_ca_extensions ]
|
||||
basicConstraints = CA:false
|
||||
keyUsage = digitalSignature
|
||||
extendedKeyUsage = 1.3.6.1.5.5.7.3.2
|
||||
|
||||
[ server_ca_extensions ]
|
||||
basicConstraints = CA:false
|
||||
keyUsage = keyEncipherment
|
||||
extendedKeyUsage = 1.3.6.1.5.5.7.3.1
|
||||
EOF
|
||||
openssl req -x509 -config ./openssl.conf -days 3650 -newkey rsa:1024 -out ./certs/cacert.pem -keyout ./private/cakey.pem -subj "/CN=Telegraf CA/" -nodes &&
|
||||
|
||||
# Create server keypair
|
||||
openssl genrsa -out ./private/serverkey.pem 1024 &&
|
||||
openssl req -new -key ./private/serverkey.pem -out ./certs/servercsr.pem -outform PEM -subj "/CN=localhost/O=server/" &&
|
||||
openssl ca -config ./openssl.conf -in ./certs/servercsr.pem -out ./certs/servercert.pem -notext -batch -extensions server_ca_extensions &&
|
||||
|
||||
# Create client keypair
|
||||
openssl genrsa -out ./private/clientkey.pem 1024 &&
|
||||
openssl req -new -key ./private/clientkey.pem -out ./certs/clientcsr.pem -outform PEM -subj "/CN=telegraf/O=client/" &&
|
||||
openssl ca -config ./openssl.conf -in ./certs/clientcsr.pem -out ./certs/clientcert.pem -notext -batch -extensions client_ca_extensions
|
||||
Reference in New Issue
Block a user