Merge pull request #2038 from crazy-max/localstate-group

build: support local state group
This commit is contained in:
CrazyMax 2023-09-30 06:01:14 +02:00 committed by GitHub
commit 6c77b76b7b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 482 additions and 179 deletions

View File

@ -18,7 +18,6 @@ import (
controllerapi "github.com/docker/buildx/controller/pb"
"github.com/docker/buildx/util/buildflags"
"github.com/docker/buildx/util/platformutil"
"github.com/docker/cli/cli/config"
hcl "github.com/hashicorp/hcl/v2"
"github.com/moby/buildkit/client/llb"

View File

@ -26,7 +26,6 @@ import (
"github.com/distribution/reference"
"github.com/docker/buildx/builder"
"github.com/docker/buildx/driver"
"github.com/docker/buildx/localstate"
"github.com/docker/buildx/util/desktop"
"github.com/docker/buildx/util/dockerutil"
"github.com/docker/buildx/util/imagetools"
@ -72,6 +71,7 @@ const (
type Options struct {
Inputs Inputs
Ref string
Allow []entitlements.Entitlement
Attests map[string]*string
BuildArgs map[string]string
@ -91,12 +91,11 @@ type Options struct {
Target string
Ulimits *opts.UlimitOpt
Session []session.Attachable
// Linked marks this target as exclusively linked (not requested by the user).
Linked bool
Session []session.Attachable
Linked bool // Linked marks this target as exclusively linked (not requested by the user).
PrintFunc *PrintFunc
SourcePolicy *spb.Policy
GroupRef string
}
type PrintFunc struct {
@ -424,6 +423,7 @@ func toSolveOpt(ctx context.Context, node builder.Node, multiDriver bool, opt Op
}
so := client.SolveOpt{
Ref: opt.Ref,
Frontend: "dockerfile.v0",
FrontendAttrs: map[string]string{},
LocalDirs: map[string]string{},
@ -433,6 +433,10 @@ func toSolveOpt(ctx context.Context, node builder.Node, multiDriver bool, opt Op
SourcePolicy: opt.SourcePolicy,
}
if so.Ref == "" {
so.Ref = identity.NewID()
}
if opt.CgroupParent != "" {
so.FrontendAttrs["cgroup-parent"] = opt.CgroupParent
}
@ -668,12 +672,6 @@ func toSolveOpt(ctx context.Context, node builder.Node, multiDriver bool, opt Op
so.FrontendAttrs["ulimit"] = ulimits
}
// remember local state like directory path that is not sent to buildkit
so.Ref = identity.NewID()
if err := saveLocalState(so, opt, node, configDir); err != nil {
return nil, nil, err
}
return &so, releaseF, nil
}
@ -751,6 +749,9 @@ func BuildWithResultHandler(ctx context.Context, nodes []builder.Node, opt map[s
if err != nil {
return nil, err
}
if err := saveLocalState(so, k, opt, node, configDir); err != nil {
return nil, err
}
for k, v := range gitattrs {
so.FrontendAttrs[k] = v
}
@ -1645,43 +1646,6 @@ func noPrintFunc(opt map[string]Options) bool {
return true
}
func saveLocalState(so client.SolveOpt, opt Options, node builder.Node, configDir string) error {
var err error
if so.Ref == "" {
return nil
}
lp := opt.Inputs.ContextPath
dp := opt.Inputs.DockerfilePath
if lp != "" || dp != "" {
if lp != "" {
lp, err = filepath.Abs(lp)
if err != nil {
return err
}
}
if dp != "" {
dp, err = filepath.Abs(dp)
if err != nil {
return err
}
}
ls, err := localstate.New(configDir)
if err != nil {
return err
}
if err := ls.SaveRef(node.Builder, node.Name, so.Ref, localstate.State{
LocalPath: lp,
DockerfilePath: dp,
}); err != nil {
return err
}
}
return nil
}
// ReadSourcePolicy reads a source policy from a file.
// The file path is taken from EXPERIMENTAL_BUILDKIT_SOURCE_POLICY env var.
// if the env var is not set, this `returns nil, nil`

43
build/localstate.go Normal file
View File

@ -0,0 +1,43 @@
package build
import (
"path/filepath"
"github.com/docker/buildx/builder"
"github.com/docker/buildx/localstate"
"github.com/moby/buildkit/client"
)
func saveLocalState(so *client.SolveOpt, target string, opts Options, node builder.Node, configDir string) error {
var err error
if so.Ref == "" {
return nil
}
lp := opts.Inputs.ContextPath
dp := opts.Inputs.DockerfilePath
if lp != "" || dp != "" {
if lp != "" {
lp, err = filepath.Abs(lp)
if err != nil {
return err
}
}
if dp != "" {
dp, err = filepath.Abs(dp)
if err != nil {
return err
}
}
l, err := localstate.New(configDir)
if err != nil {
return err
}
return l.SaveRef(node.Builder, node.Name, so.Ref, localstate.State{
Target: target,
LocalPath: lp,
DockerfilePath: dp,
GroupRef: opts.GroupRef,
})
}
return nil
}

View File

@ -11,6 +11,7 @@ import (
"github.com/docker/buildx/bake"
"github.com/docker/buildx/build"
"github.com/docker/buildx/builder"
"github.com/docker/buildx/localstate"
"github.com/docker/buildx/util/buildflags"
"github.com/docker/buildx/util/cobrautil/completion"
"github.com/docker/buildx/util/confutil"
@ -19,6 +20,7 @@ import (
"github.com/docker/buildx/util/progress"
"github.com/docker/buildx/util/tracing"
"github.com/docker/cli/cli/command"
"github.com/moby/buildkit/identity"
"github.com/moby/buildkit/util/appcontext"
"github.com/moby/buildkit/util/progress/progressui"
"github.com/pkg/errors"
@ -183,14 +185,16 @@ func runBake(dockerCli command.Cli, targets []string, in bakeOptions, cFlags com
return err
}
def := struct {
Group map[string]*bake.Group `json:"group,omitempty"`
Target map[string]*bake.Target `json:"target"`
}{
Group: grps,
Target: tgts,
}
if in.printOnly {
dt, err := json.MarshalIndent(struct {
Group map[string]*bake.Group `json:"group,omitempty"`
Target map[string]*bake.Target `json:"target"`
}{
grps,
tgts,
}, "", " ")
dt, err := json.MarshalIndent(def, "", " ")
if err != nil {
return err
}
@ -203,6 +207,28 @@ func runBake(dockerCli command.Cli, targets []string, in bakeOptions, cFlags com
return nil
}
// local state group
groupRef := identity.NewID()
var refs []string
for k, b := range bo {
b.Ref = identity.NewID()
b.GroupRef = groupRef
refs = append(refs, b.Ref)
bo[k] = b
}
dt, err := json.Marshal(def)
if err != nil {
return err
}
if err := saveLocalStateGroup(dockerCli, groupRef, localstate.StateGroup{
Definition: dt,
Targets: targets,
Inputs: overrides,
Refs: refs,
}); err != nil {
return err
}
resp, err := build.Build(ctx, nodes, bo, dockerutil.NewClient(dockerCli), confutil.ConfigDir(dockerCli), printer)
if err != nil {
return wrapBuildError(err, true)
@ -259,3 +285,11 @@ func bakeCmd(dockerCli command.Cli, rootOpts *rootOptions) *cobra.Command {
return cmd
}
func saveLocalStateGroup(dockerCli command.Cli, ref string, lsg localstate.StateGroup) error {
l, err := localstate.New(confutil.ConfigDir(dockerCli))
if err != nil {
return err
}
return l.SaveGroup(ref, lsg)
}

View File

@ -53,6 +53,7 @@ func RunBuild(ctx context.Context, dockerCli command.Cli, in controllerapi.Build
InStream: inStream,
NamedContexts: contexts,
},
Ref: in.Ref,
BuildArgs: in.BuildArgs,
CgroupParent: in.CgroupParent,
ExtraHosts: in.ExtraHosts,
@ -65,6 +66,7 @@ func RunBuild(ctx context.Context, dockerCli command.Cli, in controllerapi.Build
Tags: in.Tags,
Target: in.Target,
Ulimits: controllerUlimitOpt2DockerUlimit(in.Ulimits),
GroupRef: in.GroupRef,
}
platforms, err := platformutil.Parse(in.Platforms)

View File

@ -299,6 +299,8 @@ type BuildOptions struct {
ExportPush bool `protobuf:"varint,26,opt,name=ExportPush,proto3" json:"ExportPush,omitempty"`
ExportLoad bool `protobuf:"varint,27,opt,name=ExportLoad,proto3" json:"ExportLoad,omitempty"`
SourcePolicy *pb.Policy `protobuf:"bytes,28,opt,name=SourcePolicy,proto3" json:"SourcePolicy,omitempty"`
Ref string `protobuf:"bytes,29,opt,name=Ref,proto3" json:"Ref,omitempty"`
GroupRef string `protobuf:"bytes,30,opt,name=GroupRef,proto3" json:"GroupRef,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
@ -524,6 +526,20 @@ func (m *BuildOptions) GetSourcePolicy() *pb.Policy {
return nil
}
func (m *BuildOptions) GetRef() string {
if m != nil {
return m.Ref
}
return ""
}
func (m *BuildOptions) GetGroupRef() string {
if m != nil {
return m.GroupRef
}
return ""
}
type ExportEntry struct {
Type string `protobuf:"bytes,1,opt,name=Type,proto3" json:"Type,omitempty"`
Attrs map[string]string `protobuf:"bytes,2,rep,name=Attrs,proto3" json:"Attrs,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
@ -2054,126 +2070,127 @@ func init() {
func init() { proto.RegisterFile("controller.proto", fileDescriptor_ed7f10298fa1d90f) }
var fileDescriptor_ed7f10298fa1d90f = []byte{
// 1890 bytes of a gzipped FileDescriptorProto
// 1909 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x58, 0x5f, 0x6f, 0xdb, 0xc8,
0x11, 0x2f, 0x25, 0x59, 0x7f, 0x46, 0x96, 0xe3, 0x6c, 0x9d, 0x74, 0xc3, 0xa4, 0x17, 0x87, 0x49,
0xae, 0x42, 0x53, 0x48, 0x77, 0xbe, 0xa6, 0xbe, 0x5c, 0xee, 0x80, 0xda, 0xb2, 0x05, 0xfb, 0x90,
0xd8, 0xc6, 0xca, 0xc9, 0xa1, 0x2d, 0xd0, 0x80, 0x92, 0xd6, 0x32, 0x21, 0x8a, 0xab, 0x72, 0x57,
0xb6, 0xd5, 0xa7, 0x3e, 0xb4, 0x6f, 0x45, 0xbf, 0x47, 0xd1, 0x8f, 0xd0, 0x97, 0xf6, 0x1b, 0xf5,
0x23, 0x14, 0xfb, 0x87, 0x14, 0x69, 0x89, 0xb2, 0xdd, 0x3e, 0x69, 0x67, 0xf8, 0xfb, 0xcd, 0xec,
0x2c, 0x67, 0x67, 0x86, 0x82, 0xf5, 0x1e, 0x0b, 0x44, 0xc8, 0x7c, 0x9f, 0x86, 0x8d, 0x71, 0xc8,
0x04, 0x43, 0x1b, 0xdd, 0x89, 0xe7, 0xf7, 0xaf, 0x1a, 0x89, 0x07, 0x17, 0x5f, 0xda, 0x6f, 0x07,
0x9e, 0x38, 0x9f, 0x74, 0x1b, 0x3d, 0x36, 0x6a, 0x8e, 0x58, 0x77, 0xda, 0x54, 0xa8, 0xa1, 0x27,
0x9a, 0xee, 0xd8, 0x6b, 0x72, 0x1a, 0x5e, 0x78, 0x3d, 0xca, 0x9b, 0x86, 0x14, 0xfd, 0x6a, 0x93,
0xf6, 0xeb, 0x4c, 0x32, 0x67, 0x93, 0xb0, 0x47, 0xc7, 0xcc, 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, 0xba, 0x85, 0x5a, 0x50, 0x54, 0x6f, 0x23,
0x9a, 0x2d, 0x5f, 0xdd, 0x50, 0xe8, 0x1a, 0x1f, 0x15, 0xda, 0xf4, 0x0f, 0x4d, 0xb5, 0xbf, 0x87,
0x6a, 0x42, 0xbd, 0x20, 0x01, 0xb6, 0x92, 0x09, 0x90, 0x59, 0xf8, 0xb5, 0x93, 0x64, 0x7a, 0xec,
0x41, 0x51, 0x2b, 0x17, 0x1e, 0x2b, 0x82, 0xc2, 0x81, 0x1b, 0xea, 0xd4, 0xc8, 0x13, 0xb5, 0x96,
0xba, 0x0e, 0x3b, 0x13, 0xea, 0xf5, 0xe4, 0x89, 0x5a, 0x3b, 0xff, 0xb4, 0xa0, 0x66, 0x06, 0x45,
0x73, 0x82, 0x14, 0xd6, 0xf5, 0x0d, 0xa5, 0x61, 0xa4, 0x33, 0xf1, 0xbf, 0x59, 0x72, 0x94, 0x11,
0xb4, 0x71, 0x9d, 0xab, 0x4f, 0x63, 0xce, 0xa4, 0xdd, 0x82, 0xfb, 0x0b, 0xa1, 0x77, 0xba, 0x22,
0x2f, 0xe1, 0xde, 0x6c, 0x04, 0xce, 0xce, 0x93, 0x0d, 0x40, 0x49, 0x98, 0x19, 0x91, 0x9f, 0x42,
0x55, 0x7e, 0x52, 0x64, 0xd3, 0x1c, 0x58, 0xd5, 0x00, 0x73, 0x32, 0x08, 0x0a, 0x43, 0x3a, 0xd5,
0xd9, 0x50, 0x21, 0x6a, 0xed, 0xfc, 0xcd, 0x92, 0x5f, 0x06, 0xe3, 0x89, 0x78, 0x4f, 0x39, 0x77,
0x07, 0x32, 0x01, 0x0b, 0x87, 0x81, 0x27, 0x4c, 0xf6, 0x7d, 0x96, 0xf5, 0x85, 0x30, 0x9e, 0x08,
0x09, 0x33, 0xac, 0x83, 0x1f, 0x11, 0xc5, 0x42, 0xdb, 0x50, 0xd8, 0x73, 0x85, 0x6b, 0x72, 0x21,
0x63, 0x1e, 0x92, 0x88, 0x04, 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x41, 0xcc, 0x29, 0xfe, 0x00, 0x30, 0x1b, 0x35, 0x50, 0xc6, 0xff, 0x26, 0x73, 0x33,
0x8b, 0x5d, 0xbf, 0x19, 0x68, 0x1c, 0xbc, 0x97, 0x7d, 0xf6, 0x8c, 0xa1, 0xcc, 0x0e, 0x1b, 0x5f,
0x23, 0xdb, 0x59, 0x06, 0x31, 0xe6, 0xce, 0xa1, 0x96, 0xfa, 0x5f, 0x15, 0xfd, 0x2c, 0x3b, 0xc8,
0xeb, 0x7f, 0xd3, 0xda, 0xaf, 0x6e, 0x85, 0x35, 0x9e, 0x44, 0x72, 0x56, 0x33, 0x8f, 0x51, 0xe3,
0xa6, 0xb8, 0xd3, 0xff, 0x91, 0xda, 0xcd, 0x5b, 0xe3, 0xb5, 0xd7, 0xdd, 0xc2, 0x6f, 0x73, 0xe3,
0x6e, 0xb7, 0xa8, 0xfe, 0x6e, 0xfe, 0xf2, 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x12, 0x75, 0xc9,
0x38, 0x0c, 0x17, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.

View File

@ -77,6 +77,8 @@ message BuildOptions {
bool ExportPush = 26;
bool ExportLoad = 27;
moby.buildkit.v1.sourcepolicy.Policy SourcePolicy = 28;
string Ref = 29;
string GroupRef = 30;
}
message ExportEntry {

View File

@ -1,19 +1,43 @@
package localstate
import (
"context"
"encoding/json"
"fmt"
"os"
"path/filepath"
"sync"
"github.com/docker/docker/pkg/ioutils"
"github.com/pkg/errors"
"golang.org/x/sync/errgroup"
)
const refsDir = "refs"
const (
refsDir = "refs"
groupDir = "__group__"
)
type State struct {
LocalPath string
// Target is the name of the invoked target (default if empty)
Target string
// LocalPath is the absolute path to the context
LocalPath string
// DockerfilePath is the absolute path to the Dockerfile
DockerfilePath string
// GroupRef is the ref of the state group that this ref belongs to
GroupRef string `json:",omitempty"`
}
type StateGroup struct {
// Definition is the raw representation of the group (bake definition)
Definition []byte
// Targets are the targets invoked
Targets []string `json:",omitempty"`
// Inputs are the user inputs (bake overrides)
Inputs []string `json:",omitempty"`
// Refs are used to track all the refs that belong to the same group
Refs []string
}
type LocalState struct {
@ -62,11 +86,61 @@ func (ls *LocalState) SaveRef(builderName, nodeName, id string, st State) error
return ioutils.AtomicWriteFile(filepath.Join(refDir, id), dt, 0600)
}
func (ls *LocalState) ReadGroup(id string) (*StateGroup, error) {
dt, err := os.ReadFile(filepath.Join(ls.root, refsDir, groupDir, id))
if err != nil {
return nil, err
}
var stg StateGroup
if err := json.Unmarshal(dt, &stg); err != nil {
return nil, err
}
return &stg, nil
}
func (ls *LocalState) SaveGroup(id string, stg StateGroup) error {
refDir := filepath.Join(ls.root, refsDir, groupDir)
if err := os.MkdirAll(refDir, 0700); err != nil {
return err
}
dt, err := json.Marshal(stg)
if err != nil {
return err
}
return ioutils.AtomicWriteFile(filepath.Join(refDir, id), dt, 0600)
}
func (ls *LocalState) RemoveBuilder(builderName string) error {
if builderName == "" {
return errors.Errorf("builder name empty")
}
return os.RemoveAll(filepath.Join(ls.root, refsDir, builderName))
dir := filepath.Join(ls.root, refsDir, builderName)
if _, err := os.Lstat(dir); err != nil {
if !os.IsNotExist(err) {
return err
}
return nil
}
fis, err := os.ReadDir(dir)
if err != nil {
return err
}
eg, _ := errgroup.WithContext(context.TODO())
for _, fi := range fis {
func(fi os.DirEntry) {
eg.Go(func() error {
return ls.RemoveBuilderNode(builderName, fi.Name())
})
}(fi)
}
if err := eg.Wait(); err != nil {
return err
}
return os.RemoveAll(dir)
}
func (ls *LocalState) RemoveBuilderNode(builderName string, nodeName string) error {
@ -76,7 +150,76 @@ func (ls *LocalState) RemoveBuilderNode(builderName string, nodeName string) err
if nodeName == "" {
return errors.Errorf("node name empty")
}
return os.RemoveAll(filepath.Join(ls.root, refsDir, builderName, nodeName))
dir := filepath.Join(ls.root, refsDir, builderName, nodeName)
if _, err := os.Lstat(dir); err != nil {
if !os.IsNotExist(err) {
return err
}
return nil
}
fis, err := os.ReadDir(dir)
if err != nil {
return err
}
var murefs sync.Mutex
grefs := make(map[string][]string)
srefs := make(map[string][]string)
eg, _ := errgroup.WithContext(context.TODO())
for _, fi := range fis {
func(fi os.DirEntry) {
eg.Go(func() error {
st, err := ls.ReadRef(builderName, nodeName, fi.Name())
if err != nil {
return err
}
if st.GroupRef == "" {
return nil
}
murefs.Lock()
defer murefs.Unlock()
if _, ok := grefs[st.GroupRef]; !ok {
if grp, err := ls.ReadGroup(st.GroupRef); err == nil {
grefs[st.GroupRef] = grp.Refs
}
}
srefs[st.GroupRef] = append(srefs[st.GroupRef], fmt.Sprintf("%s/%s/%s", builderName, nodeName, fi.Name()))
return nil
})
}(fi)
}
if err := eg.Wait(); err != nil {
return err
}
for gid, refs := range grefs {
if s, ok := srefs[gid]; ok {
if len(s) != len(refs) {
continue
}
if err := ls.removeGroup(gid); err != nil {
return err
}
}
}
return os.RemoveAll(dir)
}
func (ls *LocalState) removeGroup(id string) error {
if id == "" {
return errors.Errorf("group ref empty")
}
f := filepath.Join(ls.root, refsDir, groupDir, id)
if _, err := os.Lstat(f); err != nil {
if !os.IsNotExist(err) {
return err
}
return nil
}
return os.Remove(f)
}
func (ls *LocalState) validate(builderName, nodeName, id string) error {

View File

@ -0,0 +1,99 @@
package localstate
import (
"path/filepath"
"testing"
"github.com/stretchr/testify/require"
)
func TestNew(t *testing.T) {
_ = newls(t)
}
func TestReadRef(t *testing.T) {
l := newls(t)
r, err := l.ReadRef(testBuilderName, testNodeName, testStateRefID)
require.NoError(t, err)
require.Equal(t, testStateRef, *r)
}
func TestReadGroup(t *testing.T) {
l := newls(t)
g, err := l.ReadGroup(testStateGroupID)
require.NoError(t, err)
require.Equal(t, testStateGroup, *g)
}
func TestRemoveBuilder(t *testing.T) {
l := newls(t)
require.NoError(t, l.RemoveBuilder(testBuilderName))
}
func TestRemoveBuilderNode(t *testing.T) {
l := newls(t)
require.NoError(t, l.RemoveBuilderNode(testBuilderName, testNodeName))
}
func newls(t *testing.T) *LocalState {
t.Helper()
tmpdir := t.TempDir()
l, err := New(tmpdir)
require.NoError(t, err)
require.DirExists(t, filepath.Join(tmpdir, refsDir))
require.Equal(t, tmpdir, l.root)
require.NoError(t, l.SaveRef(testBuilderName, testNodeName, testStateRefID, testStateRef))
require.NoError(t, l.SaveGroup(testStateGroupID, testStateGroup))
require.NoError(t, l.SaveRef(testBuilderName, testNodeName, testStateGroupRef1ID, testStateGroupRef1))
require.NoError(t, l.SaveRef(testBuilderName, testNodeName, testStateGroupRef2ID, testStateGroupRef2))
require.NoError(t, l.SaveRef(testBuilderName, testNodeName, testStateGroupRef3ID, testStateGroupRef3))
return l
}
var (
testBuilderName = "builder"
testNodeName = "builder0"
testStateRefID = "32n3ffqrxjw41ok5zxd2qhume"
testStateRef = State{
Target: "default",
LocalPath: "/home/foo/github.com/docker/docker-bake-action",
DockerfilePath: "/home/foo/github.com/docker/docker-bake-action/dev.Dockerfile",
}
testStateGroupID = "kvqs0sgly2rmitz84r25u9qd0"
testStateGroup = StateGroup{
Definition: []byte(`{"group":{"default":{"targets":["pre-checkin"]},"pre-checkin":{"targets":["vendor-update","format","build"]}},"target":{"build":{"context":".","dockerfile":"dev.Dockerfile","target":"build-update","platforms":["linux/amd64"],"output":["."]},"format":{"context":".","dockerfile":"dev.Dockerfile","target":"format-update","platforms":["linux/amd64"],"output":["."]},"vendor-update":{"context":".","dockerfile":"dev.Dockerfile","target":"vendor-update","platforms":["linux/amd64"],"output":["."]}}}`),
Targets: []string{"pre-checkin"},
Inputs: []string{"*.platform=linux/amd64"},
Refs: []string{"builder/builder0/hx2qf1w11qvz1x3k471c5i8xw", "builder/builder0/968zj0g03jmlx0s8qslnvh6rl", "builder/builder0/naf44f9i1710lf7y12lv5hb1z"},
}
testStateGroupRef1ID = "hx2qf1w11qvz1x3k471c5i8xw"
testStateGroupRef1 = State{
Target: "format",
LocalPath: "/home/foo/github.com/docker/docker-bake-action",
DockerfilePath: "/home/foo/github.com/docker/docker-bake-action/dev.Dockerfile",
GroupRef: "kvqs0sgly2rmitz84r25u9qd0",
}
testStateGroupRef2ID = "968zj0g03jmlx0s8qslnvh6rl"
testStateGroupRef2 = State{
Target: "build",
LocalPath: "/home/foo/github.com/docker/docker-bake-action",
DockerfilePath: "/home/foo/github.com/docker/docker-bake-action/dev.Dockerfile",
GroupRef: "kvqs0sgly2rmitz84r25u9qd0",
}
testStateGroupRef3ID = "naf44f9i1710lf7y12lv5hb1z"
testStateGroupRef3 = State{
Target: "vendor-update",
LocalPath: "/home/foo/github.com/docker/docker-bake-action",
DockerfilePath: "/home/foo/github.com/docker/docker-bake-action/dev.Dockerfile",
GroupRef: "kvqs0sgly2rmitz84r25u9qd0",
}
)