Skip to content

Commit

Permalink
chore: update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
bkioshn committed Apr 16, 2024
1 parent 2db8b96 commit 1897d72
Show file tree
Hide file tree
Showing 16 changed files with 28 additions and 37 deletions.
6 changes: 3 additions & 3 deletions docs/src/appendix/earthly.md
Expand Up @@ -75,7 +75,7 @@ Like a `Dockerfile`, only a single `Earthfile` can exist per directory and it *m
#### Sample Structure

```Earthfile
VERSION --global-cache 0.7 # This defines the "schema version" that this Earthfile satisfies
VERSION 0.8 # This defines the "schema version" that this Earthfile satisfies
# A target, which is functionally equivalent to a `makefile` target.
deps:
Expand All @@ -95,7 +95,7 @@ The commands are in all uppercase letters and there's typically only one command

An `Earthfile` always starts by specifying a schema version which informs Earthly how it should go about parsing the file.
This allows the syntax and format of an Earthfile to evolve while maintaining backwards compatibility.
In our case, we target version `0.7` which is the latest version at the time of this writing.
In our case, we target version `0.8` which is the latest version at the time of this writing.

#### Targets

Expand All @@ -104,7 +104,7 @@ A target can be thought of as a grouping of image layers, similar to the way mul
Each target then specifies one or more commands that create the image layers associated with that target.

```Earthfile
VERSION --global-cache 0.7
VERSION 0.8
deps:
FROM golang:1.21-alpine3.19
Expand Down
2 changes: 1 addition & 1 deletion docs/src/guides/docs.md
Expand Up @@ -39,7 +39,7 @@ This folder already has an `Earthfile` in it, which contains all build process.
<!-- markdownlint-enable max-one-sentence-per-line -->

```Earthfile
VERSION --global-cache 0.7
VERSION 0.8
# Copy all the source we need to build the docs
src:
Expand Down
2 changes: 1 addition & 1 deletion docs/src/guides/languages/go.md
Expand Up @@ -46,7 +46,7 @@ You can choose to either delete the file and start from scratch, or read the gui
### Installing dependencies

```Earthfile
VERSION --global-cache 0.7
VERSION 0.8
deps:
# This target is used to install external Go dependencies.
Expand Down
2 changes: 1 addition & 1 deletion docs/src/guides/languages/postgresql.md
Expand Up @@ -49,7 +49,7 @@ You can choose to either delete the file and start from scratch, or read the gui
### Prepare base builder

```Earthfile
VERSION --global-cache 0.7
VERSION 0.8
builder:
FROM ./../../earthly/postgresql+postgres-base
Expand Down
2 changes: 1 addition & 1 deletion docs/src/guides/languages/python.md
Expand Up @@ -45,7 +45,7 @@ or read the guide and follow along in the file.
### Prepare base builder

```Earthfile
VERSION --global-cache 0.7
VERSION 0.8
builder:
FROM ./../../earthly/python+python-base
Expand Down
2 changes: 1 addition & 1 deletion docs/src/guides/languages/rust.md
Expand Up @@ -49,7 +49,7 @@ Also we will take a look how we are setup Rust projects and what configuration i
### Prepare base builder

```Earthfile
VERSION --global-cache 0.7
VERSION --try 0.8
# Set up our target toolchains, and copy our files.
builder:
Expand Down
4 changes: 2 additions & 2 deletions docs/src/guides/simulate.md
Expand Up @@ -95,7 +95,7 @@ The generateCmd struct is designed to be used with a command-line interface (CLI
* `Target`: A list of Earthly target patterns that the simulation will run.
If the flag is not set, the default pipeline will be run `check check-* build test test-*`
* `Version`: An Earthly version that need to be specify at the top of Earthfile.
The default version is 0.7
The default version is 0.8

### Default value

Expand All @@ -107,7 +107,7 @@ ci generate .
```

The ci will create an Earthfile in `generate/` folder of the current directory.
The version of the Earthly will be set to 0.7
The version of the Earthly will be set to 0.8
The targets will be listed under the `simulate` target.
eg. `BUILD ../test/+target`

Expand Down
14 changes: 3 additions & 11 deletions docs/src/style/index.md
Expand Up @@ -12,22 +12,14 @@ In most circumstances, the standards provided by this style guide should *not* b
If an exception must me made, the rationale should be included in the respective PR.
Any `Earthfile` which does not adhere to this style guide will be rejected if no further justification is made.

<!-- markdownlint-disable max-one-sentence-per-line -->
!!! Warning
UDC (User Defined Commands) will be renamed to FUNCTION in Earthly 0.8.
Earthly 0.7 still uses COMMAND for declaring functions, but
the keyword is deprecated and will be replaced by FUNCTION in
Earthly 0.8. Please refer to [link](https://docs.earthly.dev/docs/guides/functions) for more information.
<!-- markdownlint-enable max-one-sentence-per-line -->

## Organization

### Adhere to a consistent structure

The following structure should be used to provide a consistent structure to `Earthfile`s:

```Earthfile
VERSION --global-cache 0.7 # Should be the same across the repository
VERSION 0.8 # Should be the same across the repository
deps:
FROM <base image>
Expand Down Expand Up @@ -95,7 +87,7 @@ This target is made up of the commands that appear outside of an existing target
For example:

```Earthfile
VERSION --global-cache 0.7
VERSION 0.8
FROM ubuntu:latest # Apart of the base target
WORKDIR /work # Apart of the base target
```
Expand All @@ -112,7 +104,7 @@ As such, the base target should be avoided, and individual targets should be
clear about their intentions:

```Earthfile
VERSION --global-cache 0.7
VERSION 0.8
deps:
FROM ubuntu:latest
Expand Down
2 changes: 1 addition & 1 deletion earthly/docs/Earthfile
Expand Up @@ -118,7 +118,7 @@ PACKAGE:
# Start Nginx when the container is run
CMD ["nginx", "-g", "daemon off;"]

# These steps are done outside the UDC.
# These steps are done outside the FUNCTION.

# Copy the static pages into the container like this...
#COPY $docs /usr/share/nginx/html
Expand Down
6 changes: 3 additions & 3 deletions earthly/mdlint/Earthfile
Expand Up @@ -3,7 +3,7 @@ VERSION 0.8
# cspell: words markdownlint

MDLINT_LOCALLY:
# DO NOT RUN THIS UDC INSIDE CONTAINER BUILDS.
# DO NOT RUN THIS FUNCTION INSIDE CONTAINER BUILDS.
# IT IS NOT FOR CONTAINER BUILDS.
# See: https://github.com/earthly/earthly/issues/580

Expand Down Expand Up @@ -42,7 +42,7 @@ MDLINT_LOCALLY:

# Markdown check used in standard CI target check.
CHECK:
# DO NOT RUN THIS UDC INSIDE CONTAINER BUILDS.
# DO NOT RUN THIS FUNCTION INSIDE CONTAINER BUILDS.
# IT IS NOT FOR CONTAINER BUILDS.
# See: https://github.com/earthly/earthly/issues/580

Expand Down Expand Up @@ -75,7 +75,7 @@ CHECK:
"**/*.md" \
--config $cfg_file

# A Test and example invocation of the above UDC.
# A Test and example invocation of the above FUNCTION.
mdlint-test:
# Test Markdown lint checks.
# Run with `earthly -P +mdlint-test
Expand Down
2 changes: 1 addition & 1 deletion earthly/postgresql/Earthfile
Expand Up @@ -73,7 +73,7 @@ BUILDER:
COPY --dir $seed .
COPY --dir $refinery_toml .

# DOCS - UDC to build the docs, needs to be run INSIDE the BUILDER like so:
# DOCS - FUNCTION to build the docs, needs to be run INSIDE the BUILDER like so:
#
# 1. Create a ./docs/diagrams.json which has the options needed to run to generate the docs to /docs
# 2. Define the following targets in your earthfile
Expand Down
6 changes: 3 additions & 3 deletions earthly/python/Readme.md
Expand Up @@ -7,8 +7,8 @@ This repo defines common python targets and UDCs for use with python.

### POETRY_SETUP

This UDC sets up a python based container that uses poetry for dependency management.
Once the UDC has run, the Earthly target that invoked it will
This FUNCTION sets up a python based container that uses poetry for dependency management.
Once the FUNCTION has run, the Earthly target that invoked it will

#### Invocation

Expand All @@ -27,7 +27,7 @@ You may also pass optional arguments:

These arguments are optional and neither is required to be set.

The directory that contains the Earthfile that invokes this UDC MUST have:
The directory that contains the Earthfile that invokes this FUNCTION MUST have:

* `pyproject.toml` : Definitions of the project to be installed with Poetry.
* `poetry.lock` : Dependency lock file.
Expand Down
3 changes: 1 addition & 2 deletions earthly/rust/Earthfile
@@ -1,4 +1,3 @@
# Common Rust UDCs and Builders.
VERSION 0.8


Expand All @@ -20,7 +19,7 @@ rust-base:

# This is our base Host toolset, and rustup.
# The ACTUAL version of rust that will be used, and available targets
# is controlled by a `rust-toolchain.toml` file when the `SETUP` UDC is run.
# is controlled by a `rust-toolchain.toml` file when the `SETUP` FUNCTION is run.
# HOWEVER, It is enforced that the rust version in `rust-toolchain.toml` MUST match this version.

# WARNING:
Expand Down
2 changes: 1 addition & 1 deletion earthly/rust/Readme.md
Expand Up @@ -8,7 +8,7 @@ This repo defines common rust targets and UDCs for use with rust.

### RUST_SETUP

This UDC sets up a rust build environment.
This FUNCTION sets up a rust build environment.

Rust build environments are locked to the `rust-toolchain.toml` file in the repo.
This ensures that the version of the toolchain used is locked with the dependencies.
Expand Down
6 changes: 3 additions & 3 deletions examples/go/Earthfile
Expand Up @@ -13,7 +13,7 @@ deps:
# Any build dependencies should also be captured in this target.
RUN apk add --no-cache gcc musl-dev

# This UDC automatically copies the go.mod and go.sum files and runs
# This FUNCTION automatically copies the go.mod and go.sum files and runs
# `go mod download` to install the dependencies.
DO ../../earthly/go+DEPS --ginkgo="false"

Expand All @@ -27,10 +27,10 @@ check:
# This target checks the overall health of the source code.
FROM +src

# This UDC validates the code is formatted according to Go standards.
# This FUNCTION validates the code is formatted according to Go standards.
DO ../../earthly/go+FMT --src="go.mod go.sum cmd"

# This UDC runs golangci-lint to check for common errors.
# This FUNCTION runs golangci-lint to check for common errors.
DO ../../earthly/go+LINT --src="go.mod go.sum cmd"

build:
Expand Down
4 changes: 2 additions & 2 deletions utilities/scripts/Earthfile
Expand Up @@ -18,13 +18,13 @@ python-scripts:

SAVE ARTIFACT /python /python

# UDC to add our common bash scripts to a container image.
# FUNCTION to add our common bash scripts to a container image.
ADD_BASH_SCRIPTS:
FUNCTION

COPY --dir +bash-scripts/include /scripts/include

# UDC to add our common bash scripts to a container image.
# FUNCTION to add our common bash scripts to a container image.
ADD_PYTHON_SCRIPTS:
FUNCTION

Expand Down

0 comments on commit 1897d72

Please sign in to comment.