Skip to content

Commit

Permalink
Remove legacy log sharing & associated code & tests (#4129)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikejholly authored May 28, 2024
1 parent 422f6f1 commit 74c20db
Show file tree
Hide file tree
Showing 15 changed files with 65 additions and 1,405 deletions.
112 changes: 0 additions & 112 deletions .github/workflows/ci-docker-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,34 +95,6 @@ jobs:
EXTRA_ARGS: "--auto-skip"
secrets: inherit

docker-tests-no-qemu-group1-no-logbus:
needs: build-earthly
if: ${{ !failure() }}
uses: ./.github/workflows/reusable-test.yml
with:
TEST_TARGET: "+test-no-qemu-group1"
BUILT_EARTHLY_PATH: "./build/linux/amd64/earthly"
RUNS_ON: "ubuntu-latest"
BINARY: "docker"
SUDO: ""
EXTRA_ARGS: "--logstream=false --logstream-upload=false --auto-skip"
SKIP_JOB: ${{ needs.build-earthly.result != 'success' }}
secrets: inherit

docker-tests-no-qemu-group2-no-logbus:
needs: build-earthly
if: ${{ !failure() }}
uses: ./.github/workflows/reusable-test.yml
with:
TEST_TARGET: "+test-no-qemu-group2"
BUILT_EARTHLY_PATH: "./build/linux/amd64/earthly"
RUNS_ON: "ubuntu-latest"
BINARY: "docker"
SUDO: ""
EXTRA_ARGS: "--logstream=false --logstream-upload=false --auto-skip"
SKIP_JOB: ${{ needs.build-earthly.result != 'success' }}
secrets: inherit

docker-tests-no-qemu-group3:
needs: build-earthly
if: ${{ !failure() }}
Expand All @@ -137,20 +109,6 @@ jobs:
EXTRA_ARGS: "--auto-skip"
secrets: inherit

docker-tests-no-qemu-group3-no-logbus:
needs: build-earthly
if: ${{ !failure() }}
uses: ./.github/workflows/reusable-test.yml
with:
TEST_TARGET: "+test-no-qemu-group3"
BUILT_EARTHLY_PATH: "./build/linux/amd64/earthly"
RUNS_ON: "ubuntu-latest"
BINARY: "docker"
SUDO: ""
EXTRA_ARGS: "--logstream=false --logstream-upload=false --auto-skip"
SKIP_JOB: ${{ needs.build-earthly.result != 'success' }}
secrets: inherit

docker-tests-no-qemu-group4:
needs: build-earthly
if: ${{ !failure() }}
Expand All @@ -165,20 +123,6 @@ jobs:
EXTRA_ARGS: "--auto-skip"
secrets: inherit

docker-tests-no-qemu-group4-no-logbus:
needs: build-earthly
if: ${{ !failure() }}
uses: ./.github/workflows/reusable-test.yml
with:
TEST_TARGET: "+test-no-qemu-group4"
BUILT_EARTHLY_PATH: "./build/linux/amd64/earthly"
RUNS_ON: "ubuntu-latest"
BINARY: "docker"
SUDO: ""
EXTRA_ARGS: "--logstream=false --logstream-upload=false --auto-skip"
SKIP_JOB: ${{ needs.build-earthly.result != 'success' }}
secrets: inherit

docker-tests-no-qemu-group5:
needs: build-earthly
if: ${{ !failure() }}
Expand All @@ -193,20 +137,6 @@ jobs:
EXTRA_ARGS: "--auto-skip"
secrets: inherit

docker-tests-no-qemu-group5-no-logbus:
needs: build-earthly
if: ${{ !failure() }}
uses: ./.github/workflows/reusable-test.yml
with:
TEST_TARGET: "+test-no-qemu-group5"
BUILT_EARTHLY_PATH: "./build/linux/amd64/earthly"
RUNS_ON: "ubuntu-latest"
BINARY: "docker"
SUDO: ""
EXTRA_ARGS: "--logstream=false --logstream-upload=false --auto-skip"
SKIP_JOB: ${{ needs.build-earthly.result != 'success' }}
secrets: inherit

docker-tests-no-qemu-group6:
needs: build-earthly
if: ${{ !failure() }}
Expand All @@ -221,20 +151,6 @@ jobs:
EXTRA_ARGS: "--auto-skip"
secrets: inherit

docker-tests-no-qemu-group6-no-logbus:
needs: build-earthly
if: ${{ !failure() }}
uses: ./.github/workflows/reusable-test.yml
with:
TEST_TARGET: "+test-no-qemu-group6"
BUILT_EARTHLY_PATH: "./build/linux/amd64/earthly"
RUNS_ON: "ubuntu-latest"
BINARY: "docker"
SUDO: ""
EXTRA_ARGS: "--logstream=false --logstream-upload=false --auto-skip"
SKIP_JOB: ${{ needs.build-earthly.result != 'success' }}
secrets: inherit

docker-tests-no-qemu-group7:
needs: build-earthly
if: ${{ !failure() }}
Expand All @@ -249,20 +165,6 @@ jobs:
EXTRA_ARGS: "--auto-skip"
secrets: inherit

docker-tests-no-qemu-group7-no-logbus:
needs: build-earthly
if: ${{ !failure() }}
uses: ./.github/workflows/reusable-test.yml
with:
TEST_TARGET: "+test-no-qemu-group7"
BUILT_EARTHLY_PATH: "./build/linux/amd64/earthly"
RUNS_ON: "ubuntu-latest"
BINARY: "docker"
SUDO: ""
EXTRA_ARGS: "--logstream=false --logstream-upload=false --auto-skip"
SKIP_JOB: ${{ needs.build-earthly.result != 'success' }}
secrets: inherit

docker-tests-no-qemu-group8:
needs: build-earthly
if: ${{ !failure() }}
Expand All @@ -277,20 +179,6 @@ jobs:
EXTRA_ARGS: "--auto-skip"
secrets: inherit

docker-tests-no-qemu-group8-no-logbus:
needs: build-earthly
if: ${{ !failure() }}
uses: ./.github/workflows/reusable-test.yml
with:
TEST_TARGET: "+test-no-qemu-group8"
BUILT_EARTHLY_PATH: "./build/linux/amd64/earthly"
RUNS_ON: "ubuntu-latest"
BINARY: "docker"
SUDO: ""
EXTRA_ARGS: "--logstream=false --logstream-upload=false --auto-skip"
SKIP_JOB: ${{ needs.build-earthly.result != 'success' }}
secrets: inherit

docker-tests-no-qemu-group9:
needs: build-earthly
if: ${{ !failure() }}
Expand Down
2 changes: 1 addition & 1 deletion Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ code:
END
COPY ./ast/parser+parser/*.go ./ast/parser/
COPY --dir analytics autocomplete billing buildcontext builder logbus cleanup cloud cmd config conslogging debugger \
dockertar docker2earthly domain features internal outmon slog states util variables regproxy ./
dockertar docker2earthly domain features internal slog states util variables regproxy ./
COPY --dir buildkitd/buildkitd.go buildkitd/settings.go buildkitd/certificates.go buildkitd/
COPY --dir earthfile2llb/*.go earthfile2llb/
COPY --dir ast/antlrhandler ast/spec ast/hint ast/command ast/commandflag ast/*.go ast/
Expand Down
8 changes: 2 additions & 6 deletions builder/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"github.com/earthly/earthly/earthfile2llb"
"github.com/earthly/earthly/logbus"
"github.com/earthly/earthly/logbus/solvermon"
"github.com/earthly/earthly/outmon"
"github.com/earthly/earthly/regproxy"
"github.com/earthly/earthly/states"
"github.com/earthly/earthly/util/containerutil"
Expand Down Expand Up @@ -61,7 +60,6 @@ const (
type Opt struct {
BkClient *client.Client
LogBusSolverMonitor *solvermon.SolverMonitor
UseLogstream bool
Console conslogging.ConsoleLogger
Verbose bool
Attachables []session.Attachable
Expand Down Expand Up @@ -140,9 +138,7 @@ type Builder struct {
func NewBuilder(ctx context.Context, opt Opt) (*Builder, error) {
b := &Builder{
s: &solver{
sm: outmon.NewSolverMonitor(opt.Console, opt.Verbose, opt.DisableNoOutputUpdates || opt.UseLogstream),
logbusSM: opt.LogBusSolverMonitor,
useLogstream: opt.UseLogstream,
bkClient: opt.BkClient,
cacheImports: opt.CacheImports,
cacheExport: opt.CacheExport,
Expand Down Expand Up @@ -284,8 +280,8 @@ func (b *Builder) convertAndBuild(ctx context.Context, target domain.Target, opt
ImageResolveMode: b.opt.ImageResolveMode,
CleanCollection: b.opt.CleanCollection,
PlatformResolver: opt.PlatformResolver.SubResolver(opt.PlatformResolver.Current()),
DockerImageSolverTar: newTarImageSolver(b.opt, b.s.sm),
MultiImageSolver: newMultiImageSolver(b.opt, b.s.sm),
DockerImageSolverTar: newTarImageSolver(b.opt, b.s.logbusSM),
MultiImageSolver: newMultiImageSolver(b.opt, b.s.logbusSM),
OverridingVars: b.opt.OverridingVars,
BuildContextProvider: b.opt.BuildContextProvider,
CacheImports: b.opt.CacheImports,
Expand Down
36 changes: 0 additions & 36 deletions builder/builder_error.go

This file was deleted.

29 changes: 10 additions & 19 deletions builder/image_solver.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"os"
"strings"

"github.com/earthly/earthly/outmon"
"github.com/earthly/earthly/logbus/solvermon"
"github.com/earthly/earthly/states"
"github.com/earthly/earthly/states/image"
"github.com/earthly/earthly/util/gatewaycrafter"
Expand All @@ -27,7 +27,7 @@ import (
"golang.org/x/sync/errgroup"
)

func newTarImageSolver(opt Opt, sm *outmon.SolverMonitor) *tarImageSolver {
func newTarImageSolver(opt Opt, sm *solvermon.SolverMonitor) *tarImageSolver {
return &tarImageSolver{
sm: sm,
bkClient: opt.BkClient,
Expand All @@ -39,7 +39,7 @@ func newTarImageSolver(opt Opt, sm *outmon.SolverMonitor) *tarImageSolver {

type tarImageSolver struct {
bkClient *client.Client
sm *outmon.SolverMonitor
sm *solvermon.SolverMonitor
attachables []session.Attachable
enttlmnts []entitlements.Entitlement
cacheImports *states.CacheImports
Expand Down Expand Up @@ -99,12 +99,9 @@ func (s *tarImageSolver) SolveImage(ctx context.Context, mts *states.MultiTarget
}
return nil
})
var vertexFailureOutput string
eg.Go(func() error {
var err error
if printOutput {
vertexFailureOutput, err = s.sm.MonitorProgress(ctx, ch, "", true, s.bkClient)
return err
return s.sm.MonitorProgress(ctx, ch)
}
// Silent case.
for {
Expand Down Expand Up @@ -148,22 +145,18 @@ func (s *tarImageSolver) SolveImage(ctx context.Context, mts *states.MultiTarget
// Close read pipe on cancels, otherwise the whole thing hangs.
pipeR.Close()
}()
err = eg.Wait()
if err != nil {
return NewBuildError(err, vertexFailureOutput)
}
return nil
return eg.Wait()
}

type multiImageSolver struct {
bkClient *client.Client
sm *outmon.SolverMonitor
sm *solvermon.SolverMonitor
attachables []session.Attachable
enttlmnts []entitlements.Entitlement
cacheImports *states.CacheImports
}

func newMultiImageSolver(opt Opt, sm *outmon.SolverMonitor) *multiImageSolver {
func newMultiImageSolver(opt Opt, sm *solvermon.SolverMonitor) *multiImageSolver {
return &multiImageSolver{
sm: sm,
bkClient: opt.BkClient,
Expand Down Expand Up @@ -328,20 +321,18 @@ func (m *multiImageSolver) SolveImages(ctx context.Context, imageDefs []*states.
AllowedEntitlements: m.enttlmnts,
}

var vertexFailureOutput string

go func() {
_, err := m.bkClient.Build(ctx, *solveOpt, "", buildFn, statusChan)
if err != nil {
errChan <- NewBuildError(err, vertexFailureOutput)
errChan <- err
}
doneChan <- struct{}{}
}()

go func() {
vertexFailureOutput, err := m.sm.MonitorProgress(ctx, statusChan, "", true, m.bkClient)
err := m.sm.MonitorProgress(ctx, statusChan)
if err != nil {
errChan <- NewBuildError(err, vertexFailureOutput)
errChan <- err
}
doneChan <- struct{}{}
}()
Expand Down
22 changes: 5 additions & 17 deletions builder/solver.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"github.com/earthly/earthly/domain"
"github.com/earthly/earthly/earthfile2llb"
"github.com/earthly/earthly/logbus/solvermon"
"github.com/earthly/earthly/outmon"
"github.com/earthly/earthly/states"
"github.com/earthly/earthly/util/flagutil"
"github.com/earthly/earthly/util/fsutilprogress"
Expand All @@ -33,9 +32,7 @@ type onArtifactFunc func(context.Context, string, domain.Artifact, string, strin
type onFinalArtifactFunc func(context.Context) (string, error)

type solver struct {
sm *outmon.SolverMonitor
logbusSM *solvermon.SolverMonitor
useLogstream bool
bkClient *client.Client
attachables []session.Attachable
enttlmnts []entitlements.Entitlement
Expand Down Expand Up @@ -71,24 +68,15 @@ func (s *solver) buildMainMulti(ctx context.Context, bf gwclient.BuildFunc, onIm
}
return nil
})
var vertexFailureOutput string
if s.useLogstream {
eg.Go(func() error {
return s.logbusSM.MonitorProgress(ctx, ch)
})
} else {
eg.Go(func() error {
var err error
vertexFailureOutput, err = s.sm.MonitorProgress(ctx, ch, phaseText, false, s.bkClient)
return err
})
}
eg.Go(func() error {
return s.logbusSM.MonitorProgress(ctx, ch)
})
err = eg.Wait()
if buildErr != nil {
return NewBuildError(buildErr, vertexFailureOutput)
return buildErr
}
if err != nil {
return NewBuildError(err, vertexFailureOutput)
return err
}
return nil
}
Expand Down
Loading

0 comments on commit 74c20db

Please sign in to comment.