Skip to content

Commit fe48d62

Browse files
authored
fix: renames earthfile package to avoid filesystem errors (#168)
1 parent 0d9a3c4 commit fe48d62

File tree

7 files changed

+17
-17
lines changed

7 files changed

+17
-17
lines changed

cli/cmd/cmds/run.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package cmds
33
import (
44
"github.com/input-output-hk/catalyst-forge/cli/pkg/earthly"
55
"github.com/input-output-hk/catalyst-forge/cli/pkg/run"
6-
"github.com/input-output-hk/catalyst-forge/lib/tools/earthfile"
6+
te "github.com/input-output-hk/catalyst-forge/lib/tools/earthly"
77
)
88

99
type RunCmd struct {
@@ -15,7 +15,7 @@ type RunCmd struct {
1515
}
1616

1717
func (c *RunCmd) Run(ctx run.RunContext) error {
18-
ref, err := earthfile.ParseEarthfileRef(c.Path)
18+
ref, err := te.ParseEarthfileRef(c.Path)
1919
if err != nil {
2020
return err
2121
}

cli/pkg/scan/earthfile.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ import (
77
"path/filepath"
88
"strings"
99

10-
"github.com/input-output-hk/catalyst-forge/lib/tools/earthfile"
10+
"github.com/input-output-hk/catalyst-forge/lib/tools/earthly"
1111
w "github.com/input-output-hk/catalyst-forge/lib/tools/walker"
1212
)
1313

1414
// ScanEarthfiles scans the given root path for Earthfiles and returns a map
1515
// that maps the path of the Earthfile to the targets defined in the Earthfile.
16-
func ScanEarthfiles(rootPath string, walker w.Walker, logger *slog.Logger) (map[string]earthfile.Earthfile, error) {
17-
earthfiles := make(map[string]earthfile.Earthfile)
16+
func ScanEarthfiles(rootPath string, walker w.Walker, logger *slog.Logger) (map[string]earthly.Earthfile, error) {
17+
earthfiles := make(map[string]earthly.Earthfile)
1818

1919
err := walker.Walk(rootPath, func(path string, fileType w.FileType, openFile func() (w.FileSeeker, error)) error {
2020
if fileType != w.FileTypeFile {
@@ -30,7 +30,7 @@ func ScanEarthfiles(rootPath string, walker w.Walker, logger *slog.Logger) (map[
3030
defer file.Close()
3131

3232
logger.Info("parsing Earthfile", "path", path)
33-
earthfile, err := earthfile.ParseEarthfile(context.Background(), file)
33+
earthfile, err := earthly.ParseEarthfile(context.Background(), file)
3434
if err != nil {
3535
logger.Error("error parsing Earthfile", "path", path, "error", err)
3636
return fmt.Errorf("error parsing %s: %w", path, err)

foundry/operator/config/rbac/role.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ rules:
77
- apiGroups:
88
- foundry.projectcatalyst.io
99
resources:
10-
- releases
10+
- releasedeployments
1111
verbs:
1212
- create
1313
- delete
@@ -19,13 +19,13 @@ rules:
1919
- apiGroups:
2020
- foundry.projectcatalyst.io
2121
resources:
22-
- releases/finalizers
22+
- releasedeployments/finalizers
2323
verbs:
2424
- update
2525
- apiGroups:
2626
- foundry.projectcatalyst.io
2727
resources:
28-
- releases/status
28+
- releasedeployments/status
2929
verbs:
3030
- get
3131
- patch

lib/project/project/loader.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
"github.com/input-output-hk/catalyst-forge/lib/project/injector"
1414
"github.com/input-output-hk/catalyst-forge/lib/project/secrets"
1515
sb "github.com/input-output-hk/catalyst-forge/lib/schema/blueprint"
16-
"github.com/input-output-hk/catalyst-forge/lib/tools/earthfile"
16+
"github.com/input-output-hk/catalyst-forge/lib/tools/earthly"
1717
"github.com/input-output-hk/catalyst-forge/lib/tools/fs"
1818
"github.com/input-output-hk/catalyst-forge/lib/tools/fs/billy"
1919
"github.com/input-output-hk/catalyst-forge/lib/tools/git"
@@ -97,15 +97,15 @@ func (p *DefaultProjectLoader) Load(projectPath string) (Project, error) {
9797
return Project{}, fmt.Errorf("failed to check for Earthfile: %w", err)
9898
}
9999

100-
var ef *earthfile.Earthfile
100+
var ef *earthly.Earthfile
101101
if exists {
102102
p.logger.Info("Parsing Earthfile", "path", efPath)
103103
eff, err := p.fs.Open(efPath)
104104
if err != nil {
105105
p.logger.Error("Failed to read Earthfile", "error", err, "path", efPath)
106106
return Project{}, fmt.Errorf("failed to read Earthfile: %w", err)
107107
}
108-
efs, err := earthfile.ParseEarthfile(context.Background(), eff)
108+
efs, err := earthly.ParseEarthfile(context.Background(), eff)
109109
if err != nil {
110110
p.logger.Error("Failed to parse Earthfile", "error", err, "path", efPath)
111111
return Project{}, fmt.Errorf("failed to parse Earthfile: %w", err)

lib/project/project/project.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"github.com/input-output-hk/catalyst-forge/lib/project/blueprint"
1111
"github.com/input-output-hk/catalyst-forge/lib/project/secrets"
1212
sb "github.com/input-output-hk/catalyst-forge/lib/schema/blueprint"
13-
"github.com/input-output-hk/catalyst-forge/lib/tools/earthfile"
13+
"github.com/input-output-hk/catalyst-forge/lib/tools/earthly"
1414
"github.com/input-output-hk/catalyst-forge/lib/tools/git/repo"
1515
)
1616

@@ -20,7 +20,7 @@ type Project struct {
2020
Blueprint sb.Blueprint
2121

2222
// Earthfile is the project Earthfile.
23-
Earthfile *earthfile.Earthfile
23+
Earthfile *earthly.Earthfile
2424

2525
// Name is the project name.
2626
Name string
@@ -121,7 +121,7 @@ func (p *Project) Raw() blueprint.RawBlueprint {
121121
func NewProject(
122122
ctx *cue.Context,
123123
repo *repo.GitRepo,
124-
earthfile *earthfile.Earthfile,
124+
earthfile *earthly.Earthfile,
125125
name, path, repoRoot string,
126126
blueprint sb.Blueprint,
127127
tag *ProjectTag,

lib/tools/earthfile/earthfile.go renamed to lib/tools/earthly/earthfile.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package earthfile
1+
package earthly
22

33
import (
44
"context"

lib/tools/earthfile/earthfile_test.go renamed to lib/tools/earthly/earthfile_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package earthfile
1+
package earthly
22

33
import (
44
"context"

0 commit comments

Comments
 (0)