Skip to content

Latest commit

 

History

History
93 lines (63 loc) · 3.76 KB

CONTRIBUTING.md

File metadata and controls

93 lines (63 loc) · 3.76 KB

Contributing

Code of Conduct

Please refer to code-of-conduct.md for details.

Using Earthly prerelease

To build Earthly from source, you need the same requirements as Earthly. We recommend that you use the prerelease version of Earthly for development purposes. To launch the prerelease Earthly, simply use the ./earthly script provided in the root of the earthly repository. The prerelease Earthly tracks the version on main. You can use ./earthly --version to identify which Git hash was used to build it.

Building from source

To build Earthly from source for your target system, use

  • Linux and WSL
    ./earthly +for-linux
  • Mac
    ./earthly +for-darwin
  • Mac with M1 chip
    ./earthly +for-darwin-m1

This builds the earthly binary in ./build/<platform>/amd64/earthly and also the buildkitd image.

The buildkitd image is tagged with your current branch name and also the built binary defaults to using that built image. The built binary will always check on startup whether it has the latest buildkitd running for its configured image name and will restart buildkitd automatically to update. If during your development you end up making changes to just the buildkitd image, the binary will pick up the change on its next run.

For development purposes, you may use the built earthly binary to rebuild itself. It's usually faster than switching between the built binary and the prerelease binary because it avoids constant buildkitd restarts. After the first initial build, you'll end up using:

  • Linux and WSL
    ./build/linux/amd64/earthly +for-linux
  • Mac
    ./build/darwin/amd64/earthly +for-darwin

Running tests

To run most tests you can issue

./build/<platform>/amd64/earthly -P \
  --secret DOCKERHUB_USER=<my-docker-username> \
  --secret DOCKERHUB_TOKEN=<my-docker-token> \
  +test

To also build the examples, you can run

./build/<platform>/amd64/earthly -P  \
  --secret DOCKERHUB_USER=<my-docker-username> \
  --secret DOCKERHUB_TOKEN=<my-docker-token> \
  +test-all

The token should be the same token you use to login with Docker Hub. Other repositories are not supported. It is also possible to run tests without credentials. But running all of them, or running too frequently may incur rate limits. You could run a single test, without credentials like this:

./build/<platform>/amd64/earthly -P ./tests+env-test --DOCKERHUB_AUTH=false

If you don't want to specify these directly on the CLI, or don't want to type these each time, its possible to use an .env file instead. Here is a template to get you started:

DOCKERHUB_USER=<my-docker-username>
DOCKERHUB_TOKEN=<my-docker-token>

Gotchas

Auth

If you have issues with git-related features or with private docker registries, make sure you have configured auth correctly. See the auth page for more details.

You may need to adjust the docker login command in the earthly-integration-test-base: target by removing the Earthly repository and adjusting for your login credentials provider.

CLA

Individual

All contributions must indicate agreement to the Earthly Contributor License Agreement by logging into GitHub via the CLA assistant and signing the provided CLA. The CLA assistant will automatically notify the PRs that require CLA signing.

Entity

If you are an entity, please use the Earthly Contributor License Agreement form in addition to requiring your individual contributors to sign all contributions.