Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
70 changes: 54 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,26 @@ elastic-package help

## Development

Download and build the latest main of `elastic-package` binary:
Even though the project is "go-gettable", there is the [`Makefile`](./Makefile) present, which can be used to build,
install, format the source code among others. Some examples of the available targets are:

`make build` - build the tool source

`make clean` - delete elastic-package binary and build folder

`make format` - format the Go code

`make check` - one-liner, used by CI to verify if source code is ready to be pushed to the repository

`make install` - build the tool source and move binary to `$GOBIN`

`make gomod` - ensure go.mod and go.sum are up to date

`make update` - update README.md file

`make licenser` - add the Elastic license header in the source code
Comment on lines +44 to +58
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added a few more targets, and change make vendor target by the make gomod one.


To start developing, download and build the latest main of `elastic-package` binary:

```bash
git clone https://github.com/elastic/elastic-package.git
Expand All @@ -61,6 +80,40 @@ git rm --cached -r .
git reset --hard
```

### Testing with integrations repository

While working on a new branch, it is interesting to test these changes
with all the packages defined in the [integrations repository](https://github.com/elastic/integrations).
This allows to test a much wider scenarios than the test packages that are defined in this repository.

This test can be triggered automatically directly from your Pull Request by adding a comment `test integrations`. Example:
- Comment: https://github.com/elastic/elastic-package/pull/1335#issuecomment-1619721861
- Pull Request created in integrations repository: https://github.com/elastic/integrations/pull/6756

This comment triggers this [Buildkite pipeline](https://github.com/elastic/elastic-package/blob/6f084e21561105ac9773acab00c3439251f111a0/.buildkite/pipeline.test-with-integrations-repo.yml) ([Buildkite job](https://buildkite.com/elastic/elastic-package-test-with-integrations)).

This pipeline creates a new draft Pull Request in integration updating the required dependencies to test your own changes. As a new pull request is created, a CI
job will be triggered to test all the packages defined in this repository. A new comment with the link to this new Pull Request will be posted in your package-spec Pull Request.

**IMPORTANT**: Remember to close this PR in the integrations repository once you close the package-spec Pull Request.

Usually, this process would require the following manual steps:
1. Create your elastic-package pull request and push all your commits
2. Get the SHA of the latest changeset of your PR:
```bash
$ git show -s --pretty=format:%H
1131866bcff98c29e2c84bcc1c772fff4307aaca
```
3. Go to the integrations repository, and update go.mod and go.sum with that changeset:
```bash
cd /path/to/integrations/repostiory
go mod edit -replace github.com/elastic/elastic-package=github.com/<your_github_user>/elastic-package@1131866bcff98c29e2c84bcc1c772fff4307aaca
go mod tidy
```
4. Push these changes into a branch and create a Pull Request
- Creating this PR would automatically trigger a new Jenkins pipeline.


## Commands

`elastic-package` currently offers the commands listed below.
Expand Down Expand Up @@ -512,21 +565,6 @@ The following settings are available per profile:
Elasticsearch in stacks managed by elastic-package. It is recommended to use
an absolute path, out of the `.elastic-package` directory.

## Development
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This section was duplicated. Merged into the other Development section in line 39


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 install` - build the tool source and move binary to `$GOBIN`

`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

## Release process

This project uses [GoReleaser](https://goreleaser.com/) to release a new version of the application (semver). Release publishing
Expand Down
70 changes: 54 additions & 16 deletions tools/readme/readme.md.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,26 @@ elastic-package help

## Development

Download and build the latest main of `elastic-package` binary:
Even though the project is "go-gettable", there is the [`Makefile`](./Makefile) present, which can be used to build,
install, format the source code among others. Some examples of the available targets are:

`make build` - build the tool source

`make clean` - delete elastic-package binary and build folder

`make format` - format the Go code

`make check` - one-liner, used by CI to verify if source code is ready to be pushed to the repository

`make install` - build the tool source and move binary to `$GOBIN`

`make gomod` - ensure go.mod and go.sum are up to date

`make update` - update README.md file

`make licenser` - add the Elastic license header in the source code

To start developing, download and build the latest main of `elastic-package` binary:

```bash
git clone https://github.com/elastic/elastic-package.git
Expand All @@ -61,6 +80,40 @@ git rm --cached -r .
git reset --hard
```

### Testing with integrations repository

While working on a new branch, it is interesting to test these changes
with all the packages defined in the [integrations repository](https://github.com/elastic/integrations).
This allows to test a much wider scenarios than the test packages that are defined in this repository.

This test can be triggered automatically directly from your Pull Request by adding a comment `test integrations`. Example:
- Comment: https://github.com/elastic/elastic-package/pull/1335#issuecomment-1619721861
- Pull Request created in integrations repository: https://github.com/elastic/integrations/pull/6756

This comment triggers this [Buildkite pipeline](https://github.com/elastic/elastic-package/blob/6f084e21561105ac9773acab00c3439251f111a0/.buildkite/pipeline.test-with-integrations-repo.yml) ([Buildkite job](https://buildkite.com/elastic/elastic-package-test-with-integrations)).

This pipeline creates a new draft Pull Request in integration updating the required dependencies to test your own changes. As a new pull request is created, a CI
job will be triggered to test all the packages defined in this repository. A new comment with the link to this new Pull Request will be posted in your package-spec Pull Request.

**IMPORTANT**: Remember to close this PR in the integrations repository once you close the package-spec Pull Request.

Usually, this process would require the following manual steps:
1. Create your elastic-package pull request and push all your commits
2. Get the SHA of the latest changeset of your PR:
```bash
$ git show -s --pretty=format:%H
1131866bcff98c29e2c84bcc1c772fff4307aaca
```
3. Go to the integrations repository, and update go.mod and go.sum with that changeset:
```bash
cd /path/to/integrations/repostiory
go mod edit -replace github.com/elastic/elastic-package=github.com/<your_github_user>/elastic-package@1131866bcff98c29e2c84bcc1c772fff4307aaca
go mod tidy
```
4. Push these changes into a branch and create a Pull Request
- Creating this PR would automatically trigger a new Jenkins pipeline.


## Commands

`elastic-package` currently offers the commands listed below.
Expand Down Expand Up @@ -112,21 +165,6 @@ The following settings are available per profile:
Elasticsearch in stacks managed by elastic-package. It is recommended to use
an absolute path, out of the `.elastic-package` directory.

## Development

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 install` - build the tool source and move binary to `$GOBIN`

`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

## Release process

This project uses [GoReleaser](https://goreleaser.com/) to release a new version of the application (semver). Release publishing
Expand Down