Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Packer customize package info #3188

Merged
merged 4 commits into from
Dec 14, 2016
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions dev-tools/packer/platforms/centos/run.sh.j2
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ RPM_VERSION=`echo ${VERSION} | sed 's/-/_/g'`
fpm --force -s dir -t rpm \
-n {{.beat_name}} -v ${RPM_VERSION} \
--architecture {{.rpm_arch}} \
--vendor "Elastic" \
--license "ASL 2.0" \
--vendor "{{.beat_vendor}}" \
--license "{{.beat_license}}" \
--description "{{.beat_description}}" \
--url {{.beat_url}} \
--rpm-init /tmp/{{.beat_name}}.init \
Expand Down
2 changes: 1 addition & 1 deletion dev-tools/packer/platforms/centos/systemd.j2
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[Unit]
Description={{.beat_name}}
Documentation=https://www.elastic.co/guide/en/beats/{{.beat_name}}/current/index.html
Documentation={{.beat_doc_url}}
Wants=network-online.target
After=network-online.target

Expand Down
4 changes: 2 additions & 2 deletions dev-tools/packer/platforms/debian/run.sh.j2
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ fi
# create deb
fpm --force -s dir -t deb \
-n {{.beat_name}} -v ${VERSION} \
--vendor "Elastic" \
--license "ASL 2.0" \
--vendor "{{.beat_vendor}}" \
--license "{{.beat_license}}" \
--architecture {{.deb_arch}} \
--description "{{.beat_description}}" \
--url {{.beat_url}} \
Expand Down
2 changes: 1 addition & 1 deletion dev-tools/packer/platforms/debian/systemd.j2
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[Unit]
Description={{.beat_name}}
Documentation=https://www.elastic.co/guide/en/beats/{{.beat_name}}/current/index.html
Documentation={{.beat_doc_url}}
Wants=network-online.target
After=network-online.target

Expand Down
2 changes: 1 addition & 1 deletion dev-tools/packer/xgo-scripts/before_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ go install github.com/tsg/gotpl
cat ${LIBBEAT_PATH}/docs/version.asciidoc >> ${PREFIX}/package.yml
# Make variable naming of doc-branch compatible with gotpl. Generate and copy README.md into homedir
sed -i -e 's/:doc-branch/doc_branch/g' ${PREFIX}/package.yml
/go/bin/gotpl ${LIBBEAT_PATH}/../dev-tools/packer/readme.md.j2 < ${PREFIX}/package.yml > ${PREFIX}/homedir/README.md
/go/bin/gotpl /templates/readme.md.j2 < ${PREFIX}/package.yml > ${PREFIX}/homedir/README.md

# Copy template
cp $BEATNAME.template.json $PREFIX/$BEATNAME.template.json
Expand Down
13 changes: 11 additions & 2 deletions libbeat/scripts/Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@

### VARIABLE SETUP ###

#¤¤ Application using libbeat may override the following variables in their Makefile
Copy link
Contributor

@ruflin ruflin Dec 13, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are char 2 and 3 on purpose?

Copy link
Contributor Author

@cyrilleverrier cyrilleverrier Dec 14, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was a typo error. Fixed by 5a13af4

BEATNAME?=libbeat
BEAT_DESCRIPTION?=Sends events to Elasticsearch or Logstash
BEAT_VENDOR?=Elastic
BEAT_LICENSE?=ASL 2.0
BEAT_DOC_URL?=https://www.elastic.co/guide/en/beats/${BEATNAME}/current/index.html
BEAT_DIR?=github.com/elastic/beats/${BEATNAME}
ES_BEATS?=..
GOPACKAGES?=${BEAT_DIR}/...
PACKER_TEMPLATES_DIR?=${ES_BEATS}/dev-tools/packer

# Makefile for a custom beat that includes this libbeat/scripts/Makefile:
# if glide is used to manage vendor dependencies,
Expand Down Expand Up @@ -337,6 +340,7 @@ prepare-package:
# cross compile on ubuntu
docker run --rm \
-v $(abspath ${ES_BEATS}/dev-tools/packer/xgo-scripts):/scripts \
-v $(abspath ${PACKER_TEMPLATES_DIR}):/templates \
-v $(abspath ../):/source \
-v $(BUILD_DIR):/build \
-e PUREGO="yes" \
Expand All @@ -355,6 +359,7 @@ prepare-package-cgo:
# cross compile on ubuntu
docker run --rm \
-v $(abspath ${ES_BEATS}/dev-tools/packer/xgo-scripts):/scripts \
-v $(abspath ${PACKER_TEMPLATES_DIR}):/templates \
-v $(abspath ../):/source \
-v $(BUILD_DIR):/build \
-e PACK=${BEATNAME} \
Expand All @@ -369,6 +374,7 @@ prepare-package-cgo:
docker run --rm \
-v ${BUILD_DIR}:/build \
-v $(abspath ${ES_BEATS}/dev-tools/packer/xgo-scripts):/scripts \
-v $(abspath ${PACKER_TEMPLATES_DIR}):/templates \
-v $(abspath ..):/source \
-e PACK=${BEATNAME} \
-e BEFORE_BUILD=before_build.sh \
Expand Down Expand Up @@ -396,6 +402,9 @@ package: package-setup
echo "beat_url: https://${BEAT_DIR}" >> ${BUILD_DIR}/package.yml
echo "beat_repo: ${BEAT_DIR}" >> ${BUILD_DIR}/package.yml
echo "beat_description: ${BEAT_DESCRIPTION}" >> ${BUILD_DIR}/package.yml
echo "beat_vendor: ${BEAT_VENDOR}" >> ${BUILD_DIR}/package.yml
echo "beat_license: ${BEAT_LICENSE}" >> ${BUILD_DIR}/package.yml
echo "beat_doc_url: ${BEAT_DOC_URL}" >> ${BUILD_DIR}/package.yml
cat ${ES_BEATS}/dev-tools/packer/version.yml >> ${BUILD_DIR}/package.yml

if [ $(CGO) = true ]; then \
Expand Down