Skip to content

Commit

Permalink
Remove PIPELINE, TRIGGER keywords & associated Pipelines code (#4185)
Browse files Browse the repository at this point in the history
Elements removed:
* `PIPELINE` & `TRIGGER` language definitions
* References in docs
* Mentions from help messages
* Feature flag
* Tests that used `PIPELINES`
  • Loading branch information
mikejholly authored Jun 4, 2024
1 parent 32eaa57 commit 7425fbf
Show file tree
Hide file tree
Showing 29 changed files with 1,405 additions and 2,071 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to [Earthly](https://github.com/earthly/earthly) will be doc

## Unreleased

### Removed

- Removed `PIPELINE` & `TRIGGER` keywords and associated code relating to formerly deprecated Earthly CI.

## v0.8.13 - 2024-05-28

### Fixed
Expand Down
2 changes: 0 additions & 2 deletions ast/command/mapping.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,13 @@ func init() {
LoadCmd: Load,
LocallyCmd: Locally,
OnBuildCmd: OnBuild,
PipelineCmd: Pipeline,
ProjectCmd: Project,
RunCmd: Run,
SaveArtifactCmd: SaveArtifact,
SaveImageCmd: SaveImage,
SetCmd: Set,
ShellCmd: Shell,
StopSignalCmd: StopSignal,
TriggerCmd: Trigger,
UserCmd: User,
VolumeCmd: Volume,
WorkdirCmd: Workdir,
Expand Down
2 changes: 0 additions & 2 deletions ast/command/names.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,13 @@ const (
Load = "LOAD"
Locally = "LOCALLY"
OnBuild = "ONBUILD"
Pipeline = "PIPELINE"
Project = "PROJECT"
Run = "RUN"
SaveArtifact = "SAVE ARTIFACT"
SaveImage = "SAVE IMAGE"
Set = "SET"
Shell = "SHELL"
StopSignal = "STOPSIGNAL"
Trigger = "TRIGGER"
User = "USER"
Volume = "VOLUME"
Workdir = "WORKDIR"
Expand Down
2 changes: 0 additions & 2 deletions ast/command/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,13 @@ const (
LoadCmd // "LOAD"
LocallyCmd // "LOCALLY"
OnBuildCmd // "ON BUILD"
PipelineCmd // "PIPELINE"
ProjectCmd // "PROJECT"
RunCmd // "RUN"
SaveArtifactCmd // "SAVE ARTIFACT"
SaveImageCmd // "SAVE IMAGE"
SetCmd // "SET"
ShellCmd // "SHELL"
StopSignalCmd // "STOP SIGNAL"
TriggerCmd // "TRIGGER"
UserCmd // "USER"
VolumeCmd // "VOLUME"
WorkdirCmd // "WORKDIR"
Expand Down
5 changes: 0 additions & 5 deletions ast/commandflag/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,6 @@ type SetOpts struct{}

type LetOpts struct{}

type PipelineOpts struct {
Push bool `long:"push" description:"Trigger a build in Cloud CI"`
NoPipelineCache bool `long:"no-pipeline-cache" description:"Disable pipeline caching"`
}

type CacheOpts struct {
Sharing string `long:"sharing" description:"The cache sharing mode: locked (default), shared, private"`
Mode string `long:"chmod" description:"Apply a mode to the cache folder" default:"0644"`
Expand Down
8 changes: 0 additions & 8 deletions ast/listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -379,14 +379,6 @@ func (l *listener) EnterProjectStmt(c *parser.ProjectStmtContext) {
l.command.Name = "PROJECT"
}

func (l *listener) EnterPipelineStmt(c *parser.PipelineStmtContext) {
l.command.Name = "PIPELINE"
}

func (l *listener) EnterTriggerStmt(c *parser.TriggerStmtContext) {
l.command.Name = "TRIGGER"
}

// With -----------------------------------------------------------------------

func (l *listener) EnterWithStmt(c *parser.WithStmtContext) {
Expand Down
4 changes: 0 additions & 4 deletions ast/parser/EarthLexer.g4
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ VERSION: 'VERSION' -> pushMode(COMMAND_ARGS);
CACHE: 'CACHE' -> pushMode(COMMAND_ARGS);
HOST: 'HOST' -> pushMode(COMMAND_ARGS);
PROJECT: 'PROJECT' -> pushMode(COMMAND_ARGS);
PIPELINE: 'PIPELINE' -> pushMode(COMMAND_ARGS);
TRIGGER: 'TRIGGER' -> pushMode(COMMAND_ARGS);

WITH: 'WITH';
DOCKER: 'DOCKER' -> pushMode(BLOCK), pushMode(COMMAND_ARGS);
Expand Down Expand Up @@ -107,8 +105,6 @@ FUNCTION_R: FUNCTION -> type(FUNCTION), pushMode(COMMAND_ARGS);
IMPORT_R: IMPORT -> type(IMPORT), pushMode(COMMAND_ARGS);
CACHE_R: CACHE -> type(CACHE), pushMode(COMMAND_ARGS);
HOST_R: HOST -> type(HOST), pushMode(COMMAND_ARGS);
PIPELINE_R: PIPELINE -> type(PIPELINE), pushMode(COMMAND_ARGS);
TRIGGER_R: TRIGGER -> type(TRIGGER), pushMode(COMMAND_ARGS);

WITH_R: WITH -> type(WITH);
DOCKER_R: DOCKER -> type(DOCKER), pushMode(BLOCK), pushMode(COMMAND_ARGS);
Expand Down
6 changes: 1 addition & 5 deletions ast/parser/EarthParser.g4
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,7 @@ commandStmt:
| importStmt
| cacheStmt
| hostStmt
| projectStmt
| pipelineStmt
| triggerStmt;
| projectStmt;

// version --------------------------------------------------------------------
version: VERSION stmtWords NL+;
Expand Down Expand Up @@ -172,8 +170,6 @@ importStmt: IMPORT stmtWords?;
cacheStmt: CACHE stmtWords?;
hostStmt: HOST stmtWords?;
projectStmt: PROJECT stmtWords?;
pipelineStmt: PIPELINE stmtWords?;
triggerStmt: TRIGGER stmtWords?;

// expr, stmtWord* ------------------------------------------------------------

Expand Down
1,246 changes: 613 additions & 633 deletions ast/parser/earth_lexer.go

Large diffs are not rendered by default.

1,813 changes: 741 additions & 1,072 deletions ast/parser/earth_parser.go

Large diffs are not rendered by default.

12 changes: 0 additions & 12 deletions ast/parser/earthparser_base_listener.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 0 additions & 12 deletions ast/parser/earthparser_listener.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 1 addition & 4 deletions cloud/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"github.com/earthly/cloud-api/billing"
"github.com/earthly/cloud-api/compute"
"github.com/earthly/cloud-api/logstream"
"github.com/earthly/cloud-api/pipelines"
"github.com/earthly/cloud-api/secrets"

"github.com/google/uuid"
Expand Down Expand Up @@ -63,7 +62,6 @@ type Client struct {
authDir string
disableSSHKeyGuessing bool
jum *protojson.UnmarshalOptions
pipelines pipelines.PipelinesClient
compute compute.ComputeClient
logstream logstreamClient
logstreamBackoff time.Duration
Expand Down Expand Up @@ -155,10 +153,9 @@ func NewClient(httpAddr, grpcAddr string, useInsecure bool, agentSockPath, authC
dialOpts = append(dialOpts, grpc.WithTransportCredentials(transportCreds))
conn, err := grpc.DialContext(ctx, grpcAddr, dialOpts...)
if err != nil {
return nil, errors.Wrap(err, "failed dialing pipelines grpc")
return nil, errors.Wrap(err, "failed dialing gRPC endpoint")
}

c.pipelines = pipelines.NewPipelinesClient(conn)
c.compute = compute.NewComputeClient(conn)
c.analytics = analytics.NewAnalyticsClient(conn)
c.askv = askv.NewAskvClient(conn)
Expand Down
6 changes: 3 additions & 3 deletions cmd/earthly/subcmd/project_cmds.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ Within Earthly projects users can be invited and granted different access levels
},
{
Name: "rm",
Usage: "Remove an existing project and all of its associated pipelines and secrets",
Description: "Remove an existing project and all of its associated pipelines and secrets.",
Usage: "Remove an existing project and all of its associated resources",
Description: "Remove an existing project and all of its associated resources.",
UsageText: "earthly project [--org <organization-name>] rm <project-name>",
Action: a.actionRemove,
Flags: []cli.Flag{
Expand Down Expand Up @@ -174,7 +174,7 @@ func (a *Project) actionRemove(cliCtx *cli.Context) error {

if !a.forceRemoveProject {
answer, err := common.PromptInput(cliCtx.Context,
"WARNING: you are about to permanently delete this project and all of its associated pipelines, build history and secrets.\n"+
"WARNING: you are about to permanently delete this project and all of its associated build history and secrets.\n"+
"Would you like to continue?\n"+
"Type 'y' or 'yes': ")
if err != nil {
Expand Down
1 change: 0 additions & 1 deletion docs/cloud/managing-permissions.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ Earthly orgs may contain the following shared resources:
Earthly projects, in turn, may contain the following resources:

* Secrets
* Pipelines
* Build history, including build logs

## Earthly org access levels
Expand Down
2 changes: 1 addition & 1 deletion docs/cloud/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ This command will prompt you to set a password, and to optionally register a pub

### Creating or joining an Earthly org

An Earthly org allows you to share projects, secrets, satellites and pipelines with colleagues. To view the orgs you belong to, run:
An Earthly org allows you to share projects, secrets, and satellites with colleagues. To view the orgs you belong to, run:

```bash
earthly org ls
Expand Down
90 changes: 5 additions & 85 deletions docs/earthfile/earthfile.md
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ build:
The `--aws` flag has experimental status. To use this feature, it must be enabled via `VERSION --run-with-aws 0.8`.
{% endhint %}

Makes AWS credentials available to the executed command via the host's environment variables or ~/.aws directory.
Makes AWS credentials available to the executed command via the host's environment variables or ~/.aws directory.

##### `--oidc <oidc-spec>` (experimental)

Expand Down Expand Up @@ -392,16 +392,16 @@ Click [here](../cloud/oidc.md#openid-connect-oidc-authentication) for more infor
The `--raw-output` flag has experimental status. To use this feature, it must be enabled via `VERSION --raw-output `.
{% endhint %}

Outputs line without target name.
Outputs line without target name.

###### Examples:

Given this target:
```Dockerfile
raw:
raw:
RUN --raw-output echo "::group::"
RUN echo "should have prefix"
RUN --raw-output echo "::endgroup::"
RUN --raw-output echo "::endgroup::"
```

The following is output:
Expand Down Expand Up @@ -1063,7 +1063,7 @@ All features are described in [the version-specific features reference](./featur

#### Description

The command `PROJECT` marks the current Earthfile as being part of the project belonging to the [Earthly organization](https://docs.earthly.dev/earthly-cloud/overview) `<org-name>` and the project `<project-name>`. The project is used by Earthly to retrieve [cloud-based secrets](../cloud/cloud-secrets.md) belonging to the project, as well as to associate any Earthly CI pipelines, and any build logs to the project when logged in.
The command `PROJECT` marks the current Earthfile as being part of the project belonging to the [Earthly organization](https://docs.earthly.dev/earthly-cloud/overview) `<org-name>` and the project `<project-name>`. The project is used by Earthly to retrieve [cloud-based secrets](../cloud/cloud-secrets.md) and build logs belonging to the project.

The `PROJECT` command can only be used in the `base` recipe and it applies to the entire Earthfile. The `PROJECT` command can never contain any `ARG`s that need expanding.

Expand Down Expand Up @@ -1922,86 +1922,6 @@ Sets the time interval between health checks during the start period. Defaults t

The `HOST` command creates a hostname entry (under `/etc/hosts`) that causes `<hostname>` to resolve to the specified `<ip>` address.

## PIPELINE (**deprecated**)

{% hint style='info' %}
##### Note
The `PIPELINE` command is in beta status and is only useful for Earthly CI.
{% endhint %}

#### Synopsis

* `PIPELINE [--push]`

#### Description

The `PIPELINE` command is used to declare that the current target is an Earthly CI pipeline. The `PIPELINE` command must be the first command in the target.

To use a `PIPELINE`, you must also declare a `PROJECT` in the Earthfile. This `PROJECT` must match the name of the CI's project that references the git repository

A pipeline is a target that is executed by Earthly CI when a certain trigger is activated. Triggers can be declared via the `TRIGGER` command. Pipeline targets allow only the commands `TRIGGER`, `ARG` and `BUILD`. Other commands may be used indirectly in other targets that can be then referenced by `BUILD`.

Pipeline targets are always executed with no outputs, in strict mode.

{% hint style='info' %}
##### Note
Pipelines and their definitions, including their triggers must be merged into the primary branch (which, unless overridden, is the default branch on GitHub) in order for the triggers to take effect.
{% endhint %}

#### Example

The following example shows a simple pipeline called `my-pipeline`, which is triggered on either a push to the `main` branch, or a pull request against the `main` branch. The pipeline executes the target `my-build`, which simply prints `Hello world`.

```Earthfile
VERSION 0.8
PROJECT my-org/my-project
FROM alpine:3.18
my-pipeline:
PIPELINE
TRIGGER push main
TRIGGER pr main
BUILD +my-build
my-build:
RUN echo Hello world
```

#### Options

##### `--push`

Indicates that the targets referenced by this pipeline will be called in push-mode. `SAVE IMAGE --push` commands will trigger pushes to the remote registry, and `RUN --push` commands will execute.

## TRIGGER (**deprecated**)

{% hint style='info' %}
##### Note
The `TRIGGER` command is in beta status and is only useful for Earthly CI.
{% endhint %}

#### Synopsis

* `TRIGGER manual` (manual form)
* `TRIGGER pr <pr-branch>` (PR form)
* `TRIGGER push <push-branch>` (push form)

#### Description

The `TRIGGER` command is only allowed in the context of a pipeline target (declared via `PIPELINE`), and is used to configure the way in which the pipeline is triggered. Multiple triggers are allowed for a single pipeline.

In the *manual form*, the pipeline is triggered manually via the Earthly CI UI or via `earthly` on the command-line.

In the *PR form*, the pipeline is triggered when a pull request is opened against the branch `<pr-branch>`.

In the *push form*, the pipeline is triggered when a push is made to the branch `<push-branch>`.

{% hint style='info' %}
##### Note
Pipelines and their definitions, including their triggers must be merged into the primary branch (which, unless overridden, is the default branch on GitHub) in order for the triggers to take effect.
{% endhint %}

## SHELL (not supported)

The classical [`SHELL` Dockerfile command](https://docs.docker.com/engine/reference/builder/#shell) is not yet supported. Use the *exec form* of `RUN`, `ENTRYPOINT` and `CMD` instead and prepend a different shell.
Expand Down
1 change: 0 additions & 1 deletion docs/earthfile/features.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ VERSION [<flags>...] <version-number>
| `--use-chmod` | 0.7 | Enable the `COPY --chmod` option |
| `--earthly-locally-arg` | 0.7 | Enable the `EARTHLY_LOCALLY` arg |
| `--use-project-secrets` | 0.7 | Enable project-based secret resolution |
| `--use-pipelines` | 0.7 | Enable the `PIPELINE` and `TRIGGER` commands |
| `--earthly-git-author-args` | 0.7 | Enable the `EARTHLY_GIT_AUTHOR` and `EARTHLY_GIT_CO_AUTHORS` args |
| `--wait-block` | 0.7 | Enable the `WAIT` / `END` block commands |
| `--no-network` | 0.8 | Allow the use of `RUN --network=none` commands |
Expand Down
Loading

0 comments on commit 7425fbf

Please sign in to comment.