1
0
mirror of https://github.com/siderolabs/kres.git synced 2026-02-05 09:45:35 +01:00

fix: make JS frontend target attach to the build

Previously it was attached to the `base`, so it got into steps like
`golangci-lint` which don't care about it, but also it gets exported
back to the source tree via `make lint-golangci-lint-fmt`.

Re-attach it to the build step (where we actually need it).

Another solution is to make it part of `make generate` and keep it part
of the source tree.

Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
This commit is contained in:
Andrey Smirnov
2025-09-09 15:52:23 +04:00
parent 83a9eb6f70
commit ba566731c8
4 changed files with 40 additions and 10 deletions

View File

@@ -77,6 +77,23 @@ func (build *Build) CompileDockerfile(output *dockerfile.Output) error {
stage.Step(step.Copy("/", "/").From("embed-generate"))
}
// build chain of gen containers.
var matchingInputs []dag.Node
for _, parent := range build.Parents() {
for _, input := range dag.GatherMatchingInputs(parent, dag.Implements[dockerfile.Generator]()) {
if !slices.Contains(matchingInputs, input) {
matchingInputs = append(matchingInputs, input)
}
}
}
for _, input := range matchingInputs {
for _, path := range input.(dockerfile.Generator).GetArtifacts() { //nolint:forcetypeassert,errcheck
stage.Step(step.Copy(path, "./"+strings.Trim(path, "/")).From(input.Name()))
}
}
stage.
Step(step.WorkDir(filepath.Join("/src", build.sourcePath))).
Step(step.Arg("GO_BUILDFLAGS")).

View File

@@ -271,14 +271,6 @@ func (toolchain *Toolchain) CompileDockerfile(output *dockerfile.Output) error {
base.Step(step.Copy("./"+file, "./"+file))
}
// build chain of gen containers.
inputs := dag.GatherMatchingInputs(toolchain, dag.Implements[dockerfile.Generator]())
for _, input := range inputs {
for _, path := range input.(dockerfile.Generator).GetArtifacts() { //nolint:forcetypeassert,errcheck
base.Step(step.Copy(path, "./"+strings.Trim(path, "/")).From(input.Name()))
}
}
base.Step(step.Script(`go list -mod=readonly all >/dev/null`).MountCache(filepath.Join(toolchain.meta.GoPath, "pkg"), toolchain.meta.GitHubRepository))
return nil