Fix NX containerized build errors
Add CI environment variables to prevent NX project graph failures: - CI=true: Disables interactive features - NX_DAEMON=false: Prevents daemon issues in containers - NX_CACHE_PROJECT_GRAPH=false: Disables problematic caching Resolves 'Cannot read properties of undefined (reading split)' errors in frontend build, storybook, and plugin builds.
This commit is contained in:
@@ -8,6 +8,9 @@ import (
|
||||
|
||||
func Build(builder *dagger.Container, version string) *dagger.Directory {
|
||||
public := builder.
|
||||
WithEnvVariable("CI", "true").
|
||||
WithEnvVariable("NX_DAEMON", "false").
|
||||
WithEnvVariable("NX_CACHE_PROJECT_GRAPH", "false").
|
||||
WithExec([]string{"/bin/sh", "-c", fmt.Sprintf("yarn lerna version %s --exact --no-git-tag-version --no-push --force-publish -y", version)}).
|
||||
WithExec([]string{"yarn", "run", "build"}).
|
||||
WithExec([]string{"/bin/sh", "-c", "find /src/public -type d -name node_modules -print0 | xargs -0 rm -rf"}).
|
||||
@@ -18,6 +21,9 @@ func Build(builder *dagger.Container, version string) *dagger.Directory {
|
||||
|
||||
func BuildPlugins(builder *dagger.Container) *dagger.Directory {
|
||||
public := builder.
|
||||
WithEnvVariable("CI", "true").
|
||||
WithEnvVariable("NX_DAEMON", "false").
|
||||
WithEnvVariable("NX_CACHE_PROJECT_GRAPH", "false").
|
||||
WithExec([]string{"yarn", "install", "--immutable"}).
|
||||
WithExec([]string{"/bin/sh", "-c", `if [ -d /src/plugins-bundled ]; then yarn run plugins:build-bundled; else mkdir /src/plugins-bundled; fi`}).
|
||||
WithExec([]string{"/bin/sh", "-c", "find /src/plugins-bundled -type d -name node_modules -print0 | xargs -0 rm -rf"}).
|
||||
|
||||
@@ -5,6 +5,9 @@ import "dagger.io/dagger"
|
||||
// Storybook returns a dagger.Directory which contains the built storybook server.
|
||||
func Storybook(builder *dagger.Container, src *dagger.Directory, version string) *dagger.Directory {
|
||||
return builder.
|
||||
WithEnvVariable("CI", "true").
|
||||
WithEnvVariable("NX_DAEMON", "false").
|
||||
WithEnvVariable("NX_CACHE_PROJECT_GRAPH", "false").
|
||||
WithExec([]string{"yarn", "run", "storybook:build"}).
|
||||
Directory("./packages/grafana-ui/dist/storybook")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user