Skip to content

Commit 362e536

Browse files
committed
Revert "fix: resolve builtin variables in PackageInternal (prep, env)"
This reverts commit 8e0f09e.
1 parent 8e0f09e commit 362e536

File tree

2 files changed

+0
-65
lines changed

2 files changed

+0
-65
lines changed

pkg/leeway/package.go

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -840,20 +840,6 @@ func (p *Package) resolveBuiltinVariables() error {
840840
}
841841
}
842842

843-
// Resolve builtin variables in PackageInternal (prep, env, etc.)
844-
pifc, err := yaml.Marshal(p.PackageInternal)
845-
if err != nil {
846-
return err
847-
}
848-
pifc = replaceBuildArguments(pifc, builtinArgs)
849-
var pi PackageInternal
850-
err = yaml.Unmarshal(pifc, &pi)
851-
if err != nil {
852-
return err
853-
}
854-
p.PackageInternal = pi
855-
856-
// Resolve builtin variables in Config
857843
type configOnlyHelper struct {
858844
Config PackageConfig `yaml:"config"`
859845
}

pkg/leeway/package_test.go

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -172,57 +172,6 @@ func TestResolveBuiltinVariables(t *testing.T) {
172172
}
173173
}
174174

175-
func TestResolveBuiltinVariablesInPackageInternal(t *testing.T) {
176-
tests := []struct {
177-
Name string
178-
Prep [][]string
179-
Env []string
180-
ExpectedPrep [][]string
181-
ExpectedEnv []string
182-
}{
183-
{
184-
Name: "prep with __pkg_version",
185-
Prep: [][]string{{"/bin/bash", "prepare.sh", "${__pkg_version}"}},
186-
ExpectedPrep: [][]string{{"/bin/bash", "prepare.sh", "this-version"}},
187-
},
188-
{
189-
Name: "env with __pkg_version",
190-
Env: []string{"VERSION=${__pkg_version}"},
191-
ExpectedEnv: []string{"VERSION=this-version"},
192-
},
193-
{
194-
Name: "prep and env with __pkg_version",
195-
Prep: [][]string{{"echo", "${__pkg_version}"}},
196-
Env: []string{"BUILD_VERSION=${__pkg_version}"},
197-
ExpectedPrep: [][]string{{"echo", "this-version"}},
198-
ExpectedEnv: []string{"BUILD_VERSION=this-version"},
199-
},
200-
}
201-
202-
for _, test := range tests {
203-
t.Run(test.Name, func(t *testing.T) {
204-
pkg := NewTestPackage("pkg")
205-
pkg.Type = GenericPackage
206-
pkg.Config = GenericPkgConfig{Commands: [][]string{{"echo", "hello"}}}
207-
pkg.PreparationCommands = test.Prep
208-
pkg.Environment = test.Env
209-
210-
err := pkg.resolveBuiltinVariables()
211-
if err != nil {
212-
t.Fatalf("unexpected error: %v", err)
213-
}
214-
215-
if test.ExpectedPrep != nil && !reflect.DeepEqual(pkg.PreparationCommands, test.ExpectedPrep) {
216-
t.Errorf("PreparationCommands mismatch. expected: %v, actual: %v", test.ExpectedPrep, pkg.PreparationCommands)
217-
}
218-
219-
if test.ExpectedEnv != nil && !reflect.DeepEqual(pkg.Environment, test.ExpectedEnv) {
220-
t.Errorf("Environment mismatch. expected: %v, actual: %v", test.ExpectedEnv, pkg.Environment)
221-
}
222-
})
223-
}
224-
}
225-
226175
func TestFindCycles(t *testing.T) {
227176
tests := []struct {
228177
Name string

0 commit comments

Comments
 (0)