Announcing Earthly v0.7
Table of Contents
Today, we’re announcing the release of Earthly v0.7. The new version introduces changes that make Earthly work with Earthly CI, our new CI/CD platform (read more about it in Earthly CI: Launching a new era for CI), in addition to promoting several features from Experimental or Beta to GA – notably Podman support and the WAIT
command.
We do not take major or minor releases lightly at Earthly. We’ve never had a major release, and our last minor release was over a year ago, in December 2021 (read about it in Announcing Earthly v0.6). That’s because we know that the reliability and stability of your build and CI/CD processes are of the utmost importance. In every minor release of Earthly (and also eventually when we have a major release), all features promoted to GA have finalized APIs and have been through thorough testing. That’s why we are comfortable enabling all features promoted to GA by default.
Compatibility With Earthly CI
Earthly 0.7 is the first version compatible with Earthly CI. All Earthly CI pipelines are defined in Earthfiles using Earthly’s simple, familiar syntax and stored in the project’s repository.
Earthly 0.7 introduces the new keywords PIPELINE
and TRIGGER
to define Earthly CI pipelines. You can execute pipelines on your computer in the exact same way you execute build targets. So it’s super simple to iterate on and test CI pipelines on your computer before you push them to prod.
The following example defines a CI pipeline named build-pipeline
that executes the +my-service
target and is triggered whenever there is a pull request raised against the main
branch of the repository:
build-pipeline:
PIPELINE
TRIGGER pr main
BUILD +my-service
my-service:
BUILD +image
BUILD +unit-test
BUILD +integration-test
image:FROM alpine:3.17
COPY +src/my-service /bin
ENTRYPOINT ["/bin/my-service"]
ARG VERSION=latest
SAVE IMAGE --push acmecorp/my-service:$VERSION
unit-test:FROM +src
COPY main_test.go ./
RUN go test ./...
integration-test:FROM +src
COPY main_integration_test.go .
COPY docker-compose.yml ./
WITH DOCKER --compose docker-compose.ymlRUN go test --tags=integration ./...
END
src:COPY go.mod go.sum ./
RUN go mod download
COPY main.go ./
RUN go build -o my-service main.go
SAVE ARTIFACT my-service AS LOCAL my-service
For more information on using the PIPELINE
and TRIGGER
commands, see our docs.
Podman Support
Podman is an alternative to Docker. It is an open source tool for developing, managing, and running containers on Linux systems. Podman also works on Mac systems using podman machine
and Windows systems using WSLv2 and podman machine
. Podman is daemonless, which has some advantages over Docker’s approach.
Earthly has supported Podman for a while now, but, with Earthly 0.7, Podman support is being promoted out of beta status and is generally available. Earthly will automatically detect the container frontend, whether Docker or Podman, and use it automatically, both for running Buildkit locally and outputting built images locally.
For more information on using Podman with Earthly, see our docs.
WAIT
Command
Breaking Change: The behavior of --push
mode has changed in a backwards incompatible manner.
Pushing no longer requires everything else to succeed. Previously, --push
commands would only execute if all other commands had succeeded. This requirement is no longer enforced. This allows for more flexible push ordering using the new WAIT
command. To achieve the behavior of the previous --push
mode, you need to wrap any pre-required commands in a WAIT
/END
block.
Example: Push an Image Only if Tests Have Passed
test-and-push:
WAIT
BUILD +test
END
BUILD +my-image
my-image:
... SAVE IMAGE --push my-org/my-image:latest
Example: Push an Image and Deploy Using the Newly Pushed Image
Where ./deploy.sh
is a custom deployment script instructing a production environment to start using the image that was just pushed.
push-and-deploy:
...
WAIT
BUILD +my-image
ENDRUN --push ./deploy.sh my-org/my-image:latest
my-image:
... SAVE IMAGE --push my-org/my-image:latest
For more information on using the WAIT
command, see our docs.
VERSION
Is Now Mandatory
Breaking Change: The VERSION
command is now required for all Earthfiles, and an error will occur if it is missing.
If you are not ready to update your Earthfiles to use 0.7 (or 0.6), you can declare VERSION 0.5 to continue to use your Earthfiles.
All Features Promoted to GA in 0.7
Feature Flag | Description |
---|---|
–explicit-global | Base target args must have a –global flag in order to be considered global args |
–check-duplicate-images | Check for duplicate images during output |
–earthly-version-arg | Enables builtin ARGs: EARTHLY_VERSION and EARTHLY_BUILD_SHA |
–use-cache-command | Allow use of CACHE command in Earthfiles |
–use-host-command | Allow use of HOST command in Earthfiles |
–use-copy-link | Use the equivalent of COPY –link for all copy-like operations |
–new-platform | Enable new platform behavior |
–no-tar-build-output | Do not print output when creating a tarball to load into WITH DOCKER |
–use-no-manifest-list | Enable the SAVE IMAGE –no-manifest-list option |
–use-chmod | Allow setting the permissions of the copied files. |
–shell-out-anywhere | Allows shelling-out in any earthly command (including in the middle of ARG) |
–earthly-locally-arg | Enable the EARTHLY_LOCALLY arg |
–use-project-secrets | Enable project-based secret resolution |
–use-pipelines | Enable the PIPELINE and TRIGGER commands |
–earthly-git-author-args | Enable the EARTHLY_GIT_AUTHOR and EARTHLY_GIT_CO_AUTHORS args |
–wait-block | Enable the WAIT / END block commands |
For more information on the individual Earthfile feature flags see the Earthfile version-specific features page.
For more detailed information on Earthly 0.7, read the Earthly 0.7 release notes.
Thank You to the Earthly Community
Huge thank you to the Earthly community! From the 8.7K+ developers that have starred us on GitHub to our 800+ member community Slack (click to join), you all have played an instrumental role in the development of Earthly 0.7. Your code contributions, feature requests, and feedback made this release possible. We are so grateful to have such a dedicated and supportive community of developers from all over the world that believe in Earthly and want to make builds better.
Get Earthly Today
Make your CI/CD super simple. Get Earthly. Earthly is a versatile, approachable CI/CD framework that gives you repeatable builds that you write once and run anywhere; has a simple, instantly recognizable syntax – like Dockerfile and Makefile had a baby; and works with every language, framework, and build tool.
Earthly Cloud: Consistent, Fast Builds, Any CI
Consistent, repeatable builds across all environments. Advanced caching for faster builds. Easy integration with any CI. 6,000 build minutes per month included.