diff --git a/Makefile b/Makefile index 43c9214..1f706ec 100644 --- a/Makefile +++ b/Makefile @@ -100,6 +100,7 @@ package-linux32: ## Create Linux i386 system package package-windows: ## Create Windows installer @mkdir -p dist/pkg makensis -DVERSION=$(COLLECTOR_VERSION) -DVERSION_SUFFIX=$(COLLECTOR_VERSION_SUFFIX) -DREVISION=$(COLLECTOR_REVISION) dist/recipe.nsi + dist/chocolatey/gensha.sh $(COLLECTOR_VERSION) $(COLLECTOR_REVISION) $(COLLECTOR_VERSION_SUFFIX) package-tar: ## Create tar archive for all platforms @mkdir -p dist/pkg diff --git a/dist/chocolatey/gensha.sh b/dist/chocolatey/gensha.sh new file mode 100755 index 0000000..fcbcd4a --- /dev/null +++ b/dist/chocolatey/gensha.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash +# gensha.sh - Generate sha256 file for Chocolatey package and update chocolateyinstall.ps1 with the correct version and checksum. + +COLLECTOR_VERSION=$1 +COLLECTOR_REVISION=$2 +COLLECTOR_VERSION_SUFFIX=$3 + +if [[ ${COLLECTOR_VERSION_SUFFIX} == "-SNAPSHOT" ]]; then + COLLECTOR_CHECKSUM=$(sha256sum dist/pkg/graylog_sidecar_installer_${COLLECTOR_VERSION}-${COLLECTOR_REVISION}.SNAPSHOT.exe | cut -d" " -f1) +else + COLLECTOR_CHECKSUM=$(sha256sum dist/pkg/graylog_sidecar_installer_${COLLECTOR_VERSION}-${COLLECTOR_REVISION}.exe | cut -d" " -f1) +fi + +sed -i "s/checksum = '.*'/checksum = '$COLLECTOR_CHECKSUM'/" dist/chocolatey/tools/chocolateyinstall.ps1 +sed -i "s/url = '.*'/url = 'https:\/\/downloads.graylog.org\/releases\/graylog-collector-sidecar\/${COLLECTOR_VERSION}\/graylog_sidecar_installer_${COLLECTOR_VERSION}-${COLLECTOR_REVISION}.exe'/" dist/chocolatey/tools/chocolateyinstall.ps1 + +find dist/pkg -name "graylog_sidecar_installer*.exe" -exec /bin/bash -c "sha256sum {} | cut -d' ' -f1 > {}.sha256.txt" \; diff --git a/dist/chocolatey/graylog-sidecar.nuspec b/dist/chocolatey/graylog-sidecar.nuspec new file mode 100644 index 0000000..a87bf69 --- /dev/null +++ b/dist/chocolatey/graylog-sidecar.nuspec @@ -0,0 +1,29 @@ + + + + graylog-sidecar + $version$ + https://github.com/Graylog2/collector-sidecar + Graylog Sidecar + Donald Morton + https://github.com/Graylog2/collector-sidecar + http://cdn.rawgit.com/collector-sidecar/master/images/graylog-icon.svg + https://github.com/Graylog2/collector-sidecar/blob/master/LICENSE + true + https://github.com/Graylog2/collector-sidecar + https://docs.graylog.org/en/latest/pages/sidecar.html + https://github.com/Graylog2/collector-sidecar/issues + graylog graylog-sidecar log + Manage log collectors through Graylog + The Graylog Sidecar is a supervisor process for 3rd party log collectors like NXLog and filebeat. The Sidecar program is able to fetch and validate configuration files from a Graylog server for various log collectors. You can think of it like a centralized configuration and process management system for your log collectors. + ## Install Arguments + To properly configure the sidecar, you'll need to pass in your **server url** and your **api token**. + + choco install graylog-sidecar --install-arguments="'-SERVERURL=http://10.0.2.2:9000/api -APITOKEN=yourapitoken'" + + + + + + + diff --git a/dist/chocolatey/tools/VERIFICATION.txt b/dist/chocolatey/tools/VERIFICATION.txt new file mode 100644 index 0000000..024f252 --- /dev/null +++ b/dist/chocolatey/tools/VERIFICATION.txt @@ -0,0 +1,11 @@ +VERIFICATION +Verification is intended to assist the Chocolatey moderators and community +in verifying that this package's contents are trustworthy. + +This package is published by Graylog, Inc. + +The sha256 checksum for any release can be found at the url below. Simply replace "VERSION" and "REVISION" with the appropriate parameters: +https://downloads.graylog.org/releases/graylog-collector-sidecar/VERSION/graylog_sidecar_installer_VERSION-REVISION.exe.sha256.txt + +Example: +https://downloads.graylog.org/releases/graylog-collector-sidecar/1.0.3/graylog_sidecar_installer_1.0.3-1.exe.sha256.txt diff --git a/dist/chocolatey/tools/chocolateyinstall.ps1 b/dist/chocolatey/tools/chocolateyinstall.ps1 new file mode 100644 index 0000000..ace624d --- /dev/null +++ b/dist/chocolatey/tools/chocolateyinstall.ps1 @@ -0,0 +1,20 @@ +$ErrorActionPreference = 'Stop'; +$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)" + +$packageArgs = @{ + packageName = $env:ChocolateyPackageName + unzipLocation = $toolsDir + fileType = 'EXE' + url = 'https://downloads.graylog.org/releases/graylog-collector-sidecar/1.0.2/graylog_sidecar_installer_1.0.2-1.exe' + softwareName = 'graylog-sidecar*' + + # Checksums are now required as of 0.10.0. + # To determine checksums, you can get that from the original site if provided. + # You can also use checksum.exe (choco install checksum) and use it + # e.g. checksum -t sha256 -f path\to\file + checksum = 'e6eac94e512599ffb5860d29782d619c8a78fd5fd3b39f8023049cace0f7868a' + checksumType = 'sha256' + silentArgs = '/S' +} + +Install-ChocolateyPackage @packageArgs diff --git a/images/graylog-icon.svg b/images/graylog-icon.svg new file mode 100644 index 0000000..39a00b2 --- /dev/null +++ b/images/graylog-icon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/jenkins.groovy b/jenkins.groovy index 0418046..61dca22 100644 --- a/jenkins.groovy +++ b/jenkins.groovy @@ -118,6 +118,8 @@ pipeline ''' s3Upload(workingDir:'dist/pkg', bucket:'graylog2-releases', path:"graylog2-releases/graylog-collector-sidecar/${TAG_NAME}", includePathPattern:'graylog*') + + sh "docker run --rm -v $PWD:$PWD -w $PWD/dist/chocolatey torch/jenkins-mono-choco:latest pack --version ${TAG_NAME}" } } post @@ -126,6 +128,7 @@ pipeline { script { + archiveArtifacts 'dist/pkg/*.nupkg' cleanWs() } } diff --git a/version.mk b/version.mk index 8dd415c..826bdc9 100644 --- a/version.mk +++ b/version.mk @@ -1,3 +1,3 @@ COLLECTOR_VERSION = 1.1.0 COLLECTOR_VERSION_SUFFIX = -SNAPSHOT -COLLECTOR_REVISION = 0 +COLLECTOR_REVISION = 1