elastic-package
is a command line tool, written in Go, used for developing Elastic packages. It can help you lint, format,
test, build, and promote your packages. Learn about each of these and other features in Commands below.
Currently, elastic-package
only supports packages of type Elastic Integrations.
Download and build the latest master of elastic-package
binary:
git clone https://github.com/elastic/elastic-package.git
make build
Alternatively, you may use go get
but you will not be able to use the elastic-package version
command.
go get github.com/elastic/elastic-package
Please make sure that you've correctly setup environment variables -
$GOPATH
and $PATH
, and elastic-package
is accessible from your $PATH
.
Change directory to the package under development. Note: an integration is a specific type of a package.
cd integrations
cd package/my-package
Run the help
command and see available commands:
elastic-package help
elastic-package
currently offers the commands listed below.
Some commands have a global context, meaning that they can be executed from anywhere and they will have the same result. Other commands have a package context; these must be executed from somewhere under a package's root folder and they will operate on the contents of that package.
For more details on a specific command, run elastic-package help <command>
.
Context: global
Use this command to get a listing of all commands available under elastic-package
and a brief
description of what each command does.
Context: package
Use this command to build a package. Built packages are stored in the build/
folder located at the root folder of the local Git repository checkout that contains your package folder.
Built packages are served up by the Elastic Package Registry running locally (see
elastic-package stack
). If you want a local package to be served up by the local
Elastic Package Registry, make sure to build that package first using
elastic-package build
.
Built packages can also be published to the package-storage
repository.
Context: package
Use this command to run the format
, lint
, and build
commands all at once, in that order.
Context: package
Use this command to clean resources used for building the package.
Context: package
Use this command to format the contents of a package.
Context: package
Use this command to install the package in Kibana.
Context: package
Use this command to validate the contents of a package using the package specification.
Context: package
Use this command to export assets relevant for the package, e.g. Kibana dashboards.
Context: global
Use this command to promote packages from one stage of the Package Registry to another.
The promote
command requires access to the GitHub API to open pull requests or check authorized account data.
The tool uses the GitHub token to authorize user's call to API. The token can be stored in the ~/.elastic/github.token
file or passed via the GITHUB_TOKEN
environment variable.
Here are the instructions on how to create your own personal access token (PAT): https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token
Make sure you have enabled the following scopes:
public_repo
— to open pull requests on GitHub repositories.read:user
anduser:email
— to read your user profile information from GitHub in order to populate pull requests appropriately.
Context: global
Use this command to spin up a Docker-based Elastic Stack consisting of Elasticsearch, Kibana, and the Package Registry. By default the latest released version of the stack is spun up but it is possible to specify a different version, including SNAPSHOT versions.
For details on how to connect the service with the Elastic stack, see the HOWTO guide.
Context: package
Use this command to run tests on a package. Currently, there are two types of tests available.
These tests ensure that all the Elasticsearch and Kibana assets defined by your package get loaded up as expected.
For details on how to run asset loading tests for a package, see the HOWTO guide.
These tests allow you to exercise any Ingest Node Pipelines defined by your packages.
For details on how to configure and run pipeline tests for a package, see the HOWTO guide.
These tests allow you to verify if all static resources of the package are valid, e.g. if all fields of the sample_event.json
are documented.
For details on how to run static tests for a package, see the HOWTO guide.
These tests allow you to test a package's ability to ingest data end-to-end.
For details on how to configure and run system tests for a package, see the HOWTO guide.
Context: package
Use this command to uninstall the package from Kibana.
Context: global
Use this command to print the version of elastic-package
that you have installed. This is
especially useful when reporting bugs.
Even though the project is "go-gettable", there is the Makefile
present, which can be used to build, format or vendor
source code:
make build
- build the tool source
make format
- format the Go code
make vendor
- vendor code of dependencies
make check
- one-liner, used by CI to verify if source code is ready to be pushed to the repository