Skip to content

Commit

Permalink
feat(build, docker): use buildkit by default (#6401)
Browse files Browse the repository at this point in the history
Signed-off-by: Yaroslav Pershin <62902094+iapershin@users.noreply.github.com>
  • Loading branch information
iapershin authored and alexey-igrychev committed Nov 15, 2024
1 parent 43d5668 commit 197e9cc
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -382,8 +382,8 @@ require (

replace (
github.com/deislabs/oras => github.com/werf/3p-oras v0.9.1-0.20240115121544-03962ecbd40a // upstream not maintained
github.com/docker/buildx => github.com/werf/3p-docker-buildx v0.13.0-rc2.0.20241111114615-d77c2e1444ad // upstream not maintained
github.com/helm/helm-2to3 => github.com/werf/3p-helm-2to3 v0.0.0-20230313155428-cf9dd655c0e3 // upstream not maintained, switch back to upstream when merged: https://github.com/helm/helm-2to3/pull/224
github.com/docker/buildx => github.com/werf/3p-docker-buildx v0.13.0-rc2.0.20241024135542-5227009077a4 // upstream not maintained
github.com/jaguilar/vt100 => github.com/tonistiigi/vt100 v0.0.0-20190402012908-ad4c4a574305 // upstream not maintained
helm.sh/helm/v3 => github.com/werf/3p-helm/v3 v3.0.0-20240405163812-3dc7244388e5 // helm 3
k8s.io/helm => github.com/werf/3p-helm v0.0.0-20210202111118-81e74d46da0f // helm 2
Expand Down
6 changes: 2 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -535,8 +535,6 @@ github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66D
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376/go.mod h1:an3vInlBmSxCcxctByoQdvwPiA7DTK7jaaFDBTtu0ic=
github.com/go-git/go-billy/v5 v5.5.0 h1:yEY4yhzCDuMGSv83oGxiBotRzhwhNr8VZyphhiu+mTU=
github.com/go-git/go-billy/v5 v5.5.0/go.mod h1:hmexnoNsr2SJU1Ju67OaNz5ASJY3+sHgFRpCtpDCKow=
github.com/go-git/go-git v4.7.0+incompatible h1:+W9rgGY4DOKKdX2x6HxSR7HNeTxqiKrOvKnuittYVdA=
github.com/go-git/go-git v4.7.0+incompatible/go.mod h1:6+421e08gnZWn30y26Vchf7efgYLe4dl5OQbBSUXShE=
github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20231010084843-55a94097c399 h1:eMje31YglSBqCdIqdhKBW8lokaMrL3uTkpGYlE2OOT4=
github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20231010084843-55a94097c399/go.mod h1:1OCfN199q1Jm3HZlxleg+Dw/mwps2Wbk9frAWm+4FII=
github.com/go-git/go-git/v5 v5.12.0 h1:7Md+ndsjrzZxbddRDZjF14qK+NN56sy6wkqaVrjZtys=
Expand Down Expand Up @@ -1523,8 +1521,8 @@ github.com/weppos/publicsuffix-go v0.13.1-0.20210123135404-5fd73613514e/go.mod h
github.com/weppos/publicsuffix-go v0.15.1-0.20210511084619-b1f36a2d6c0b/go.mod h1:HYux0V0Zi04bHNwOHy4cXJVz/TQjYonnF6aoYhj+3QE=
github.com/weppos/publicsuffix-go v0.30.2-0.20240219083929-48f3a5ae027a h1:s0Yp4S5jdEQFTJE1blGE5o+n7T0uI386YHXzocLKLR4=
github.com/weppos/publicsuffix-go v0.30.2-0.20240219083929-48f3a5ae027a/go.mod h1:v7j8MuFp1CIYgAd2n7xEUctTbsreRd1vPmOwyzmGFiE=
github.com/werf/3p-docker-buildx v0.13.0-rc2.0.20241024135542-5227009077a4 h1:J6qNuakRzaeXg5tLgUfowm2Kh2/S5XAzuEzpc3f1IuM=
github.com/werf/3p-docker-buildx v0.13.0-rc2.0.20241024135542-5227009077a4/go.mod h1:Q3gtkv8D3sdaa5LJXbzMooYR/A5vBiEB2yQ56wywohM=
github.com/werf/3p-docker-buildx v0.13.0-rc2.0.20241111114615-d77c2e1444ad h1:FBDNACfjjpDBwXhALF5LgvEiu08HpUurb/2G323SVsQ=
github.com/werf/3p-docker-buildx v0.13.0-rc2.0.20241111114615-d77c2e1444ad/go.mod h1:Q3gtkv8D3sdaa5LJXbzMooYR/A5vBiEB2yQ56wywohM=
github.com/werf/3p-helm v0.0.0-20210202111118-81e74d46da0f h1:3anHigsmgMJ7IlG8WCKNgiZpO3CaZFwq8l7W+6UT+pM=
github.com/werf/3p-helm v0.0.0-20210202111118-81e74d46da0f/go.mod h1:OMONwLWU9zEENgaVjWEX+M+xik2QakejzKHG1+6mnUo=
github.com/werf/3p-helm-2to3 v0.0.0-20230313155428-cf9dd655c0e3 h1:pdKLiuiUoOFswc0HV6GX1+JHgP14HqE035xl2DQJi8A=
Expand Down
10 changes: 8 additions & 2 deletions pkg/build/build_phase.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,14 @@ func (phase *BuildPhase) AfterImages(ctx context.Context) error {
commonTargetPlatforms = []string{phase.Conveyor.ContainerBackend.GetDefaultPlatform()}
}

for _, desc := range phase.Conveyor.imagesTree.GetImagesByName(false) {
name, images := desc.Unpair()
imagesPairs := phase.Conveyor.imagesTree.GetImagesByName(false)
if err := parallel.DoTasks(ctx, len(imagesPairs), parallel.DoTasksOptions{
MaxNumberOfWorkers: int(phase.Conveyor.ParallelTasksLimit),
LiveOutput: true,
}, func(ctx context.Context, taskId int) error {
pair := imagesPairs[taskId]

name, images := pair.Unpair()
platforms := util.MapFuncToSlice(images, func(img *image.Image) string { return img.TargetPlatform })

// TODO: this target platforms assertion could be removed in future versions and now exists only as a additional self-testing code
Expand Down
8 changes: 3 additions & 5 deletions pkg/docker/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,9 @@ func Init(ctx context.Context, opts InitOptions) error {
}
}

if v := os.Getenv("DOCKER_BUILDKIT"); v == "1" || v == "true" {
if err := os.Setenv("DOCKER_BUILDKIT", "0"); err != nil {
return fmt.Errorf("unable to set env var: %w", err)
}
useBuildx = true
useBuildx = true // use buildKit by default
if v := os.Getenv("DOCKER_BUILDKIT"); v == "0" || v == "false" {
useBuildx = false
}

return nil
Expand Down

0 comments on commit 197e9cc

Please sign in to comment.