Skip to content

Commit

Permalink
feature-flag EARTHLY_CI arg
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Couture-Beil <alex@earthly.dev>
  • Loading branch information
alexcb committed Nov 21, 2022
1 parent 0671d1d commit 8944e35
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Expand Up @@ -8,7 +8,7 @@ All notable changes to [Earthly](https://github.com/earthly/earthly) will be doc

- Added support for a custom `.netrc` file path using the standard `NETRC` environmental variable. [#2426](https://github.com/earthly/earthly/pull/2426)
- Ability to run multiple Earthly installations at a time via `EARTHLY_INSTALLATION_NAME` environment variable, or the `--installation-name` CLI flag. The installation name defaults to `earthly` if not specified. Different installations use different configurations, different buildkit Daemons, different cache volumes, and different ports.
- New `EARTHLY_CI` builtin arg, which is set to `true` when earthly is run with the `--ci` flag. [#2398](https://github.com/earthly/earthly/pull/2398)
- New `EARTHLY_CI` builtin arg, which is set to `true` when earthly is run with the `--ci` flag, this ARG must be enabled with the `VERSION --ci-arg` feature flag.. [#2398](https://github.com/earthly/earthly/pull/2398)

### Changed

Expand Down
1 change: 1 addition & 0 deletions features/features.go
Expand Up @@ -43,6 +43,7 @@ type Features struct {
WaitBlock bool `long:"wait-block" description:"enable WITH/END feature, also allows RUN --push mixed with non-push commands"`
UseProjectSecrets bool `long:"use-project-secrets" description:"enable project-based secret resolution"`
UsePipelines bool `long:"use-pipelines" description:"enable the PIPELINE and TRIGGER commands"`
EarthlyCIArg bool `long:"ci-arg" description:"include EARTHLY_CI arg"`

NoUseRegistryForWithDocker bool `long:"no-use-registry-for-with-docker" description:"disable use-registry-for-with-docker"`

Expand Down
2 changes: 1 addition & 1 deletion tests/ci-arg.earth
@@ -1,4 +1,4 @@
VERSION 0.6
VERSION --ci-arg 0.6
FROM alpine:3.15

ci-test:
Expand Down
5 changes: 4 additions & 1 deletion variables/builtin.go
Expand Up @@ -25,7 +25,6 @@ type DefaultArgs struct {
// BuiltinArgs returns a scope containing the builtin args.
func BuiltinArgs(target domain.Target, platr *platutil.Resolver, gitMeta *gitutil.GitMetadata, defaultArgs DefaultArgs, ftrs *features.Features, push bool, ci bool) *Scope {
ret := NewScope()
ret.AddInactive(arg.EarthlyCI, fmt.Sprintf("%t", ci))
ret.AddInactive(arg.EarthlyTarget, target.StringCanonical())
ret.AddInactive(arg.EarthlyTargetProject, target.ProjectCanonical())
targetNoTag := target
Expand All @@ -48,6 +47,10 @@ func BuiltinArgs(target domain.Target, platr *platutil.Resolver, gitMeta *gituti
ret.AddInactive(arg.EarthlyBuildSha, defaultArgs.EarthlyBuildSha)
}

if ftrs.EarthlyCIArg {
ret.AddInactive(arg.EarthlyCI, fmt.Sprintf("%t", ci))
}

if ftrs.EarthlyLocallyArg {
SetLocally(ret, false)
}
Expand Down

0 comments on commit 8944e35

Please sign in to comment.