Skip to content

Commit

Permalink
Script for faster development workflow (#4731)
Browse files Browse the repository at this point in the history
  • Loading branch information
jalvz authored Feb 19, 2021
1 parent 1bfaf7b commit ce812f6
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 5 deletions.
10 changes: 5 additions & 5 deletions NOTICE.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Elastic APM Server
Copyright 2014-2021 Elasticsearch BV

This product includes software developed by The Apache Software
This product includes software developed by The Apache Software
Foundation (http://www.apache.org/).

================================================================================
Expand Down Expand Up @@ -19976,13 +19976,13 @@ Contents of probable licence file $GOMODCACHE/howett.net/[email protected]
Copyright (c) 2013, Dustin L. Howett. All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
Expand All @@ -19996,7 +19996,7 @@ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

The views and conclusions contained in the software and documentation are those
of the authors and should not be interpreted as representing official policies,
of the authors and should not be interpreted as representing official policies,
either expressed or implied, of the FreeBSD Project.

--------------------------------------------------------------------------------
Expand Down
9 changes: 9 additions & 0 deletions magefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,15 @@ func Package() {
mg.SerialDeps(mage.Package, TestPackages)
}

func Version() error {
v, err := mage.BeatQualifiedVersion()
if err != nil {
return err
}
fmt.Print(v)
return nil
}

// TestPackages tests the generated packages (i.e. file modes, owners, groups).
func TestPackages() error {
return mage.TestPackages()
Expand Down
29 changes: 29 additions & 0 deletions script/run_agent.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash

# Builds an apm-server Linux binary and runs an Elastic Agent image bind-mounting apm-server in the correct directory
# It expects an Elastic Agent image to exist and apm-integration-testing running (Elasticsearch and Kibana)

set -xe

version=$(mage version)

apmdir=apm-server-$version-linux-x86_64
builddir=build/distributions/$apmdir
mkdir -p $builddir
cp -f LICENSE.txt NOTICE.txt README.md apm-server.yml $builddir
GOOS=linux go build -o $builddir/apm-server ./x-pack/apm-server

imageid=$(docker image ls docker.elastic.co/beats/elastic-agent:"$version" -q)
sha=$(docker inspect "$imageid" | grep org.label-schema.vcs-ref | awk -F ": \"" '{print $2}' | head -c 6)
dst="/usr/share/elastic-agent/data/elastic-agent-${sha}/install/${apmdir}"

docker run --name elastic-agent-local -it \
--env FLEET_ENROLL=1 \
--env FLEET_ENROLL_INSECURE=1 \
--env FLEET_SETUP=1 \
--env KIBANA_HOST="http://admin:changeme@kibana:5601" \
--env KIBANA_PASSWORD="changeme" \
--env KIBANA_USERNAME="admin" \
--network apm-integration-testing \
-v "$(pwd)/$builddir:$dst" \
-p 8200:8200 --rm "${imageid}"

0 comments on commit ce812f6

Please sign in to comment.