diff --git a/dev-tools/deploy b/dev-tools/deploy index 819f543a8b60..fca9274cebae 100755 --- a/dev-tools/deploy +++ b/dev-tools/deploy @@ -7,14 +7,19 @@ from subprocess import check_call def main(): parser = argparse.ArgumentParser( description="Builds all the Beats artifacts") - parser.parse_args() + parser.add_argument("--no-snapshot", action="store_true", + help="Don't append -SNAPSHOT to the version.") + args = parser.parse_args() dir = os.path.dirname(os.path.realpath(__file__)) os.chdir(dir + "/packer") check_call("make deps", shell=True) check_call("make clean", shell=True) check_call("make images", shell=True) - check_call("make", shell=True) + if args.no_snapshot: + check_call("make SNAPSHOT=no", shell=True) + else: + check_call("make SNAPSHOT=yes", shell=True) if __name__ == "__main__": main() diff --git a/dev-tools/packer/Makefile b/dev-tools/packer/Makefile index 0abd062fb34e..5aa406ff3dc0 100644 --- a/dev-tools/packer/Makefile +++ b/dev-tools/packer/Makefile @@ -1,6 +1,4 @@ -DATE:=$(shell date +%y%m%d%H%M%S) -BUILDID?=$(DATE) - +BUILDID=$(shell git rev-parse HEAD) .PHONY: all all: packetbeat/deb packetbeat/rpm packetbeat/darwin packetbeat/win packetbeat/bin \ @@ -8,21 +6,31 @@ all: packetbeat/deb packetbeat/rpm packetbeat/darwin packetbeat/win packetbeat/b filebeat/deb filebeat/rpm filebeat/darwin filebeat/win filebeat/bin \ metricbeat/deb metricbeat/rpm metricbeat/darwin metricbeat/win metricbeat/bin \ winlogbeat/win \ - build/upload/build_id.txt latest + build/upload/build_id.txt .PHONY: packetbeat topbeat filebeat metricbeat winlogbeat packetbeat topbeat filebeat metricbeat winlogbeat: build/upload # cross compile on ubuntu - cd build && xgo -image=tudorg/beats-builder \ - -before-build=../xgo-scripts/before_build.sh \ - -pkg $@ \ - -source ../../.. \ + docker run --rm \ + -v $(abspath build):/build \ + -v $(abspath xgo-scripts):/scripts \ + -v $(abspath ../..):/source \ + -e PACK=$@ \ + -e BEFORE_BUILD=before_build.sh \ + -e SOURCE=/source \ + -e BUILDID=${BUILDID} \ + tudorg/beats-builder \ github.com/elastic/beats # linux builds on debian 6 - cd build && xgo -image=tudorg/beats-builder-deb6 \ - -before-build=../xgo-scripts/before_build.sh \ - -pkg $@ \ - -source ../../.. \ + docker run --rm \ + -v $(abspath build):/build \ + -v $(abspath xgo-scripts):/scripts \ + -v $(abspath ../..):/source \ + -e PACK=$@ \ + -e BEFORE_BUILD=before_build.sh \ + -e SOURCE=/source \ + -e BUILDID=${BUILDID} \ + tudorg/beats-builder-deb6 \ github.com/elastic/beats include ./scripts/Makefile diff --git a/dev-tools/packer/platforms/binary/build.sh b/dev-tools/packer/platforms/binary/build.sh index 37418c305d12..188aef8e54eb 100755 --- a/dev-tools/packer/platforms/binary/build.sh +++ b/dev-tools/packer/platforms/binary/build.sh @@ -12,8 +12,8 @@ cat beats/$BEAT.yml ${ARCHDIR}/archs/$ARCH.yml version.yml > build/settings-$run gotpl ${BASEDIR}/run.sh.j2 < build/settings-$runid.yml > build/run-$runid.sh chmod +x build/run-$runid.sh -docker run -v `pwd`/build:/build -e BUILDID=$BUILDID -e RUNID=$runid --name build-image tudorg/fpm /build/run-$runid.sh -docker cp build-image:/build/upload `pwd`/build/binary -docker rm -v build-image +docker run --rm -v `pwd`/build:/build \ + -e BUILDID=$BUILDID -e SNAPSHOT=$SNAPSHOT -e RUNID=$runid \ + tudorg/fpm /build/run-$runid.sh rm build/settings-$runid.yml build/run-$runid.sh diff --git a/dev-tools/packer/platforms/binary/run.sh.j2 b/dev-tools/packer/platforms/binary/run.sh.j2 index be56768b5cfd..c6de5cb9d04f 100644 --- a/dev-tools/packer/platforms/binary/run.sh.j2 +++ b/dev-tools/packer/platforms/binary/run.sh.j2 @@ -1,19 +1,25 @@ -#!/bin/sh +#!/bin/bash # this is executed in the docker fpm image set -e cd /build -mkdir /{{.beat_name}}-{{.version}}-{{.bin_arch}} -cp -r homedirs/{{.beat_name}}/* /{{.beat_name}}-{{.version}}-{{.bin_arch}}/ -cp {{.beat_name}}-linux-{{.arch}} /{{.beat_name}}-{{.version}}-{{.bin_arch}}/{{.beat_name}} -cp {{.beat_name}}-binary.yml /{{.beat_name}}-{{.version}}-{{.bin_arch}}/{{.beat_name}}.yml -cp {{.beat_name}}.template.json /{{.beat_name}}-{{.version}}-{{.bin_arch}}/ +# add SNAPSHOT if it was requested +VERSION={{.version}} +if [ "$SNAPSHOT" = "yes" ]; then + VERSION="${VERSION}-SNAPSHOT" +fi + +mkdir /{{.beat_name}}-${VERSION}-{{.bin_arch}} +cp -a homedirs/{{.beat_name}}/. /{{.beat_name}}-${VERSION}-{{.bin_arch}}/ +cp {{.beat_name}}-linux-{{.arch}} /{{.beat_name}}-${VERSION}-{{.bin_arch}}/{{.beat_name}} +cp {{.beat_name}}-binary.yml /{{.beat_name}}-${VERSION}-{{.bin_arch}}/{{.beat_name}}.yml +cp {{.beat_name}}.template.json /{{.beat_name}}-${VERSION}-{{.bin_arch}}/ mkdir -p upload/{{.beat_name}} -tar czvf upload/{{.beat_name}}/{{.beat_name}}-{{.version}}-{{.bin_arch}}.tar.gz /{{.beat_name}}-{{.version}}-{{.bin_arch}} -echo "Created upload/{{.beat_name}}/{{.beat_name}}-{{.version}}-{{.bin_arch}}.tar.gz" +tar czvf upload/{{.beat_name}}/{{.beat_name}}-${VERSION}-{{.bin_arch}}.tar.gz /{{.beat_name}}-${VERSION}-{{.bin_arch}} +echo "Created upload/{{.beat_name}}/{{.beat_name}}-${VERSION}-{{.bin_arch}}.tar.gz" cd upload/{{.beat_name}} -sha1sum {{.beat_name}}-{{.version}}-{{.bin_arch}}.tar.gz > {{.beat_name}}-{{.version}}-{{.bin_arch}}.tar.gz.sha1.txt -echo "Created upload/{{.beat_name}}/{{.beat_name}}-{{.version}}-{{.bin_arch}}.tar.gz.sha1.txt" +sha1sum {{.beat_name}}-${VERSION}-{{.bin_arch}}.tar.gz > {{.beat_name}}-${VERSION}-{{.bin_arch}}.tar.gz.sha1.txt +echo "Created upload/{{.beat_name}}/{{.beat_name}}-${VERSION}-{{.bin_arch}}.tar.gz.sha1.txt" diff --git a/dev-tools/packer/platforms/centos/build.sh b/dev-tools/packer/platforms/centos/build.sh index 5e4ada51d92b..a47f2d500c52 100755 --- a/dev-tools/packer/platforms/centos/build.sh +++ b/dev-tools/packer/platforms/centos/build.sh @@ -14,8 +14,8 @@ gotpl ${BASEDIR}/init.j2 < build/settings-$runid.yml > build/$runid.init gotpl ${BASEDIR}/systemd.j2 < build/settings-$runid.yml > build/$runid.service chmod +x build/run-$runid.sh -docker run -v `pwd`/build:/build -e BUILDID=$BUILDID -e RUNID=$runid --name build-image tudorg/fpm /build/run-$runid.sh -docker cp build-image:/build/upload `pwd`/build/binary -docker rm -v build-image +docker run --rm -v `pwd`/build:/build \ + -e BUILDID=$BUILDID -e SNAPSHOT=$SNAPSHOT -e RUNID=$runid \ + tudorg/fpm /build/run-$runid.sh rm build/settings-$runid.yml build/run-$runid.sh diff --git a/dev-tools/packer/platforms/centos/run.sh.j2 b/dev-tools/packer/platforms/centos/run.sh.j2 index 5b125b781cd6..cd0796efd042 100644 --- a/dev-tools/packer/platforms/centos/run.sh.j2 +++ b/dev-tools/packer/platforms/centos/run.sh.j2 @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # this is executed in the docker fpm image set -e @@ -10,9 +10,18 @@ cp ${RUNID}.init /tmp/{{.beat_name}}.init # create script to reload systemd config echo "#!/bin/bash\nsystemctl daemon-reload 2> /dev/null || true" > /tmp/systemd-daemon-reload.sh +# add SNAPSHOT if it was requested +VERSION="{{.version}}" +if [ "$SNAPSHOT" = "yes" ]; then + VERSION="${VERSION}-SNAPSHOT" +fi + +# replace - with ~ to allow the GA versions to be installed over alpahs/betas/snapshots +RPM_VERSION=`echo ${VERSION} | sed 's/-/~/'` + # create rpm fpm --force -s dir -t rpm \ - -n {{.beat_name}} -v {{.rpm_version}} \ + -n {{.beat_name}} -v ${RPM_VERSION} \ --architecture {{.rpm_arch}} \ --vendor "Elastic" \ --license "ASL 2.0" \ @@ -31,10 +40,10 @@ fpm --force -s dir -t rpm \ # rename so that the filename respects semver rules mkdir -p upload/{{.beat_name}} -mv {{.beat_name}}-{{.rpm_version}}-1.{{.rpm_arch}}.rpm upload/{{.beat_name}}/{{.beat_name}}-{{.version}}-{{.rpm_arch}}.rpm -echo "Created upload/{{.beat_name}}/{{.beat_name}}-{{.version}}-{{.rpm_arch}}.rpm" +mv {{.beat_name}}-${RPM_VERSION}-1.{{.rpm_arch}}.rpm upload/{{.beat_name}}/{{.beat_name}}-${VERSION}-{{.rpm_arch}}.rpm +echo "Created upload/{{.beat_name}}/{{.beat_name}}-${VERSION}-{{.rpm_arch}}.rpm" # create sha1 file cd upload/{{.beat_name}} -sha1sum {{.beat_name}}-{{.version}}-{{.rpm_arch}}.rpm > {{.beat_name}}-{{.version}}-{{.rpm_arch}}.rpm.sha1.txt -echo "Created upload/{{.beat_name}}/{{.beat_name}}-{{.version}}-{{.rpm_arch}}.rpm.sha1.txt" +sha1sum {{.beat_name}}-${VERSION}-{{.rpm_arch}}.rpm > {{.beat_name}}-${VERSION}-{{.rpm_arch}}.rpm.sha1.txt +echo "Created upload/{{.beat_name}}/{{.beat_name}}-${VERSION}-{{.rpm_arch}}.rpm.sha1.txt" diff --git a/dev-tools/packer/platforms/darwin/build.sh b/dev-tools/packer/platforms/darwin/build.sh index 6d162f6aa15b..9d6c820c3032 100755 --- a/dev-tools/packer/platforms/darwin/build.sh +++ b/dev-tools/packer/platforms/darwin/build.sh @@ -12,8 +12,8 @@ cat beats/$BEAT.yml ${ARCHDIR}/archs/$ARCH.yml version.yml > build/settings-$run gotpl ${BASEDIR}/run.sh.j2 < build/settings-$runid.yml > build/run-$runid.sh chmod +x build/run-$runid.sh -docker run -v `pwd`/build:/build -e BUILDID=$BUILDID -e RUNID=$runid --name build-image tudorg/fpm /build/run-$runid.sh -docker cp build-image:/build/upload `pwd`/build/binary -docker rm -v build-image +docker run --rm -v `pwd`/build:/build \ + -e BUILDID=$BUILDID -e SNAPSHOT=$SNAPSHOT -e RUNID=$runid \ + tudorg/fpm /build/run-$runid.sh rm build/settings-$runid.yml build/run-$runid.sh diff --git a/dev-tools/packer/platforms/darwin/run.sh.j2 b/dev-tools/packer/platforms/darwin/run.sh.j2 index b72104990e4c..9f9690c11b5a 100644 --- a/dev-tools/packer/platforms/darwin/run.sh.j2 +++ b/dev-tools/packer/platforms/darwin/run.sh.j2 @@ -1,19 +1,25 @@ -#!/bin/sh +#!/bin/bash # this is executed in the docker fpm image set -e cd /build -mkdir /{{.beat_name}}-{{.version}}-darwin -cp -r homedirs/{{.beat_name}}/* /{{.beat_name}}-{{.version}}-darwin/ -cp {{.beat_name}}-darwin-amd64 /{{.beat_name}}-{{.version}}-darwin/{{.beat_name}} -cp {{.beat_name}}-darwin.yml /{{.beat_name}}-{{.version}}-darwin/{{.beat_name}}.yml -cp {{.beat_name}}.template.json /{{.beat_name}}-{{.version}}-darwin/ +# add SNAPSHOT if it was requested +VERSION={{.version}} +if [ "$SNAPSHOT" = "yes" ]; then + VERSION="${VERSION}-SNAPSHOT" +fi + +mkdir /{{.beat_name}}-${VERSION}-darwin +cp -a homedirs/{{.beat_name}}/. /{{.beat_name}}-${VERSION}-darwin/ +cp {{.beat_name}}-darwin-amd64 /{{.beat_name}}-${VERSION}-darwin/{{.beat_name}} +cp {{.beat_name}}-darwin.yml /{{.beat_name}}-${VERSION}-darwin/{{.beat_name}}.yml +cp {{.beat_name}}.template.json /{{.beat_name}}-${VERSION}-darwin/ mkdir -p upload/{{.beat_name}} -tar czvf upload/{{.beat_name}}/{{.beat_name}}-{{.version}}-darwin.tgz /{{.beat_name}}-{{.version}}-darwin -echo "Created upload/{{.beat_name}}/{{.beat_name}}-{{.version}}-darwin.tgz" +tar czvf upload/{{.beat_name}}/{{.beat_name}}-${VERSION}-darwin.tgz /{{.beat_name}}-${VERSION}-darwin +echo "Created upload/{{.beat_name}}/{{.beat_name}}-${VERSION}-darwin.tgz" cd upload/{{.beat_name}} -sha1sum {{.beat_name}}-{{.version}}-darwin.tgz > {{.beat_name}}-{{.version}}-darwin.tgz.sha1.txt -echo "Created upload/{{.beat_name}}/{{.beat_name}}-{{.version}}-darwin.tgz.sha1.txt" +sha1sum {{.beat_name}}-${VERSION}-darwin.tgz > {{.beat_name}}-${VERSION}-darwin.tgz.sha1.txt +echo "Created upload/{{.beat_name}}/{{.beat_name}}-${VERSION}-darwin.tgz.sha1.txt" diff --git a/dev-tools/packer/platforms/debian/build.sh b/dev-tools/packer/platforms/debian/build.sh index ff68919308d3..61bd677733ab 100755 --- a/dev-tools/packer/platforms/debian/build.sh +++ b/dev-tools/packer/platforms/debian/build.sh @@ -14,8 +14,8 @@ gotpl ${BASEDIR}/init.j2 < build/settings-$runid.yml > build/$runid.init gotpl ${BASEDIR}/systemd.j2 < build/settings-$runid.yml > build/$runid.service chmod +x build/run-$runid.sh -docker run -v `pwd`/build:/build -e BUILDID=$BUILDID -e RUNID=$runid --name build-image tudorg/fpm /build/run-$runid.sh -docker cp build-image:/build/upload `pwd`/build/binary -docker rm -v build-image +docker run --rm -v `pwd`/build:/build \ + -e BUILDID=$BUILDID -e SNAPSHOT=$SNAPSHOT -e RUNID=$runid \ + tudorg/fpm /build/run-$runid.sh rm build/settings-$runid.yml build/run-$runid.sh diff --git a/dev-tools/packer/platforms/debian/run.sh.j2 b/dev-tools/packer/platforms/debian/run.sh.j2 index 447707be8a35..09f920e9e25a 100644 --- a/dev-tools/packer/platforms/debian/run.sh.j2 +++ b/dev-tools/packer/platforms/debian/run.sh.j2 @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # this is executed in the docker fpm image set -e @@ -10,9 +10,18 @@ cp ${RUNID}.init /tmp/{{.beat_name}}.init # create script to reload systemd config echo "#!/bin/bash\nsystemctl daemon-reload 2> /dev/null || true" > /tmp/systemd-daemon-reload.sh +# add SNAPSHOT if it was requested +VERSION="{{.version}}" +if [ "$SNAPSHOT" = "yes" ]; then + VERSION="${VERSION}-SNAPSHOT" +fi + +# replace - with ~ to allow the GA versions to be installed over alpahs/betas/snapshots +DEB_VERSION=`echo ${VERSION} | sed 's/-/~/'` + # create deb fpm --force -s dir -t deb \ - -n {{.beat_name}} -v {{.deb_version}} \ + -n {{.beat_name}} -v ${DEB_VERSION} \ --vendor "Elastic" \ --license "ASL 2.0" \ --architecture {{.deb_arch}} \ @@ -30,10 +39,10 @@ fpm --force -s dir -t deb \ # move and rename so that the filename respects semver rules mkdir -p upload/{{.beat_name}} -mv {{.beat_name}}_{{.deb_version}}_{{.deb_arch}}.deb upload/{{.beat_name}}/{{.beat_name}}_{{.version}}_{{.deb_arch}}.deb -echo "Created upload/{{.beat_name}}/{{.beat_name}}_{{.version}}_{{.deb_arch}}.deb" +mv {{.beat_name}}_${DEB_VERSION}_{{.deb_arch}}.deb upload/{{.beat_name}}/{{.beat_name}}_${VERSION}_{{.deb_arch}}.deb +echo "Created upload/{{.beat_name}}/{{.beat_name}}_${VERSION}_{{.deb_arch}}.deb" # create sha1 file cd upload/{{.beat_name}} -sha1sum {{.beat_name}}_{{.version}}_{{.deb_arch}}.deb > {{.beat_name}}_{{.version}}_{{.deb_arch}}.deb.sha1.txt -echo "Created upload//{{.beat_name}}/{{.beat_name}}_{{.version}}_{{.deb_arch}}.deb.sha1.txt" +sha1sum {{.beat_name}}_${VERSION}_{{.deb_arch}}.deb > {{.beat_name}}_${VERSION}_{{.deb_arch}}.deb.sha1.txt +echo "Created upload//{{.beat_name}}/{{.beat_name}}_${VERSION}_{{.deb_arch}}.deb.sha1.txt" diff --git a/dev-tools/packer/platforms/windows/build.sh b/dev-tools/packer/platforms/windows/build.sh index 22068e1ed3c9..88cde26cfd39 100755 --- a/dev-tools/packer/platforms/windows/build.sh +++ b/dev-tools/packer/platforms/windows/build.sh @@ -14,8 +14,8 @@ gotpl ${BASEDIR}/install-service.ps1.j2 < build/settings-$runid.yml > build/inst gotpl ${BASEDIR}/uninstall-service.ps1.j2 < build/settings-$runid.yml > build/uninstall-service-$BEAT.ps1 chmod +x build/run-$runid.sh -docker run -v `pwd`/build:/build -e BUILDID=$BUILDID -e RUNID=$runid --name build-image tudorg/fpm /build/run-$runid.sh -docker cp build-image:/build/upload `pwd`/build/binary -docker rm -v build-image +docker run --rm -v `pwd`/build:/build \ + -e BUILDID=$BUILDID -e SNAPSHOT=$SNAPSHOT -e RUNID=$runid \ + tudorg/fpm /build/run-$runid.sh rm build/settings-$runid.yml build/run-$runid.sh diff --git a/dev-tools/packer/platforms/windows/run.sh.j2 b/dev-tools/packer/platforms/windows/run.sh.j2 index 68720d96a468..82937fa06482 100644 --- a/dev-tools/packer/platforms/windows/run.sh.j2 +++ b/dev-tools/packer/platforms/windows/run.sh.j2 @@ -1,22 +1,28 @@ -#!/bin/sh +#!/bin/bash # this is executed in the docker fpm image set -e cd /build -mkdir /{{.beat_name}}-{{.version}}-windows -cp -r homedirs/{{.beat_name}}/* /{{.beat_name}}-{{.version}}-windows/ -cp {{.beat_name}}-windows-{{.arch}}.exe /{{.beat_name}}-{{.version}}-windows/{{.beat_name}}.exe +# add SNAPSHOT if it was requested +VERSION={{.version}} +if [ "$SNAPSHOT" = "yes" ]; then + VERSION="${VERSION}-SNAPSHOT" +fi + +mkdir /{{.beat_name}}-${VERSION}-windows +cp -a homedirs/{{.beat_name}}/. /{{.beat_name}}-${VERSION}-windows/ +cp {{.beat_name}}-windows-{{.arch}}.exe /{{.beat_name}}-${VERSION}-windows/{{.beat_name}}.exe unix2dos {{.beat_name}}-win.yml -cp {{.beat_name}}-win.yml /{{.beat_name}}-{{.version}}-windows/{{.beat_name}}.yml -cp {{.beat_name}}.template.json /{{.beat_name}}-{{.version}}-windows/ -cp install-service-{{.beat_name}}.ps1 /{{.beat_name}}-{{.version}}-windows/ -cp uninstall-service-{{.beat_name}}.ps1 /{{.beat_name}}-{{.version}}-windows/ +cp {{.beat_name}}-win.yml /{{.beat_name}}-${VERSION}-windows/{{.beat_name}}.yml +cp {{.beat_name}}.template.json /{{.beat_name}}-${VERSION}-windows/ +cp install-service-{{.beat_name}}.ps1 /{{.beat_name}}-${VERSION}-windows/ +cp uninstall-service-{{.beat_name}}.ps1 /{{.beat_name}}-${VERSION}-windows/ mkdir -p upload/{{.beat_name}} -zip -r upload/{{.beat_name}}/{{.beat_name}}-{{.version}}-windows-{{.win_arch}}.zip /{{.beat_name}}-{{.version}}-windows -echo "Created upload/{{.beat_name}}/{{.beat_name}}-{{.version}}-windows.zip" +zip -r upload/{{.beat_name}}/{{.beat_name}}-${VERSION}-windows-{{.win_arch}}.zip /{{.beat_name}}-${VERSION}-windows +echo "Created upload/{{.beat_name}}/{{.beat_name}}-${VERSION}-windows.zip" cd upload/{{.beat_name}} -sha1sum {{.beat_name}}-{{.version}}-windows-{{.win_arch}}.zip > {{.beat_name}}-{{.version}}-windows-{{.win_arch}}.zip.sha1.txt -echo "Created upload/{{.beat_name}}/{{.beat_name}}-{{.version}}-windows-{{.win_arch}}.zip.sha1.txt" +sha1sum {{.beat_name}}-${VERSION}-windows-{{.win_arch}}.zip > {{.beat_name}}-${VERSION}-windows-{{.win_arch}}.zip.sha1.txt +echo "Created upload/{{.beat_name}}/{{.beat_name}}-${VERSION}-windows-{{.win_arch}}.zip.sha1.txt" diff --git a/dev-tools/packer/scripts/Makefile b/dev-tools/packer/scripts/Makefile index ca332e126766..c14b48277c4e 100644 --- a/dev-tools/packer/scripts/Makefile +++ b/dev-tools/packer/scripts/Makefile @@ -1,32 +1,31 @@ -DATE:=$(shell date +%y%m%d%H%M%S) -BUILDID?=$(DATE) +BUILDID=$(shell git rev-parse HEAD) +SNAPSHOT?=yes makefile_abspath:=$(abspath $(lastword $(MAKEFILE_LIST))/..) packer_absdir=$(shell dirname ${makefile_abspath}) %/deb: % build/god-linux-386 build/god-linux-amd64 fpm-image - ARCH=386 BEAT=$(@D) BUILDID=$(BUILDID) $(packer_absdir)/platforms/debian/build.sh - ARCH=amd64 BEAT=$(@D) BUILDID=$(BUILDID) $(packer_absdir)/platforms/debian/build.sh + ARCH=386 BEAT=$(@D) BUILDID=$(BUILDID) SNAPSHOT=$(SNAPSHOT) $(packer_absdir)/platforms/debian/build.sh + ARCH=amd64 BEAT=$(@D) BUILDID=$(BUILDID) SNAPSHOT=$(SNAPSHOT) $(packer_absdir)/platforms/debian/build.sh %/rpm: % build/god-linux-386 build/god-linux-amd64 fpm-image - ARCH=386 BEAT=$(@D) BUILDID=$(BUILDID) $(packer_absdir)/platforms/centos/build.sh - ARCH=amd64 BEAT=$(@D) BUILDID=$(BUILDID) $(packer_absdir)/platforms/centos/build.sh + ARCH=386 BEAT=$(@D) BUILDID=$(BUILDID) SNAPSHOT=$(SNAPSHOT) $(packer_absdir)/platforms/centos/build.sh + ARCH=amd64 BEAT=$(@D) BUILDID=$(BUILDID) SNAPSHOT=$(SNAPSHOT) $(packer_absdir)/platforms/centos/build.sh %/darwin: % - ARCH=amd64 BEAT=$(@D) BUILDID=$(BUILDID) $(packer_absdir)/platforms/darwin/build.sh + ARCH=amd64 BEAT=$(@D) BUILDID=$(BUILDID) SNAPSHOT=$(SNAPSHOT) $(packer_absdir)/platforms/darwin/build.sh %/win: % - ARCH=386 BEAT=$(@D) BUILDID=$(BUILDID) $(packer_absdir)/platforms/windows/build.sh - ARCH=amd64 BEAT=$(@D) BUILDID=$(BUILDID) $(packer_absdir)/platforms/windows/build.sh + ARCH=386 BEAT=$(@D) BUILDID=$(BUILDID) SNAPSHOT=$(SNAPSHOT) $(packer_absdir)/platforms/windows/build.sh + ARCH=amd64 BEAT=$(@D) BUILDID=$(BUILDID) SNAPSHOT=$(SNAPSHOT) $(packer_absdir)/platforms/windows/build.sh %/bin: % - ARCH=386 BEAT=$(@D) BUILDID=$(BUILDID) $(packer_absdir)/platforms/binary/build.sh - ARCH=amd64 BEAT=$(@D) BUILDID=$(BUILDID) $(packer_absdir)/platforms/binary/build.sh + ARCH=386 BEAT=$(@D) BUILDID=$(BUILDID) SNAPSHOT=$(SNAPSHOT) $(packer_absdir)/platforms/binary/build.sh + ARCH=amd64 BEAT=$(@D) BUILDID=$(BUILDID) SNAPSHOT=$(SNAPSHOT) $(packer_absdir)/platforms/binary/build.sh .PHONY: deps deps: - go get -u github.com/tsg/xgo go get -u github.com/tsg/gotpl .PHONY: xgo-image @@ -117,9 +116,3 @@ clean-images: clean: rm -rf build/ || true $(call rm-image,build-image) - -# Creates a latest file for the most recent build -.PHONY: latest -latest: - BUILDID=${BUILDID} \ - $(packer_absdir)/xgo-scripts/latest.sh diff --git a/dev-tools/packer/version.yml b/dev-tools/packer/version.yml index 408e1677f84a..807afc7e3623 100644 --- a/dev-tools/packer/version.yml +++ b/dev-tools/packer/version.yml @@ -1,3 +1 @@ -version: "5.0.0-nightly${BUILDID}" -rpm_version: "5.0.0~nightly${BUILDID}" -deb_version: "5.0.0~nightly${BUILDID}" +version: "5.0.0" diff --git a/dev-tools/packer/xgo-scripts/before_build.sh b/dev-tools/packer/xgo-scripts/before_build.sh index 13889aa0c1bb..e996385315b9 100755 --- a/dev-tools/packer/xgo-scripts/before_build.sh +++ b/dev-tools/packer/xgo-scripts/before_build.sh @@ -3,7 +3,6 @@ set -e BEATS_PATH=/go/src/${1} - # BEATNAME is in the $PACK variable BEATNAME=$PACK @@ -17,17 +16,16 @@ else BEAT_PATH=$BEATS_PATH fi -echo $BEAT_PATH - cd $BEAT_PATH PREFIX=/build -echo $PREFIX - # Add data to the home directory mkdir -p $PREFIX/homedirs/$BEATNAME make install-home HOME_PREFIX=$PREFIX/homedirs/$BEATNAME +if [ -n "BUILDID" ]; then + echo "$BUILDID" > $PREFIX/homedirs/$BEATNAME/.build_hash.txt +fi # Copy template cp $BEATNAME.template.json $PREFIX/$BEATNAME.template.json diff --git a/dev-tools/packer/xgo-scripts/latest.sh b/dev-tools/packer/xgo-scripts/latest.sh deleted file mode 100755 index c1ea955d1fb8..000000000000 --- a/dev-tools/packer/xgo-scripts/latest.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash - -FILES=$(find `pwd`/build/binary/* -type f) -echo $BUILDID - -for currentfile in ${FILES}; do - latestfile=${currentfile/$BUILDID/latest} - cp -f $currentfile $latestfile - - # Replace buildid through latest in sha1 file - if [ `echo $latestfile | grep -c "sha1" ` -gt 0 ]; then - sed -i.bak -e s/$BUILDID/latest/g $latestfile - rm $latestfile.bak - fi -done diff --git a/dev-tools/set_version b/dev-tools/set_version index f8421dc3bc83..5e74d7794d17 100755 --- a/dev-tools/set_version +++ b/dev-tools/set_version @@ -9,8 +9,6 @@ const defaultBeatVersion = "{}" template_packer = ''' version: "{version}" -rpm_version: "{rpm_version}" -deb_version: "{deb_version}" ''' @@ -29,8 +27,6 @@ def main(): with open(dir + "/packer/version.yml", "w") as f: f.write(template_packer.format( version=version, - rpm_version=version.replace("-", "~"), - deb_version=version.replace("-", "~") )) if __name__ == "__main__":