You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor: replace environment variable string literals with constants
Define constants for all LEEWAY_* environment variables to prevent typos
and improve maintainability. This follows the existing pattern established
in the codebase.
Changes:
- Add EnvvarDockerExportToCache, EnvvarDefaultCacheLevel, EnvvarSegmentKey,
EnvvarTrace, EnvvarProvenanceKeypath, and EnvvarExperimental to cmd/root.go
- Add EnvvarDockerExportToCache and EnvvarWorkspaceRoot to pkg/leeway/build.go
- Add EnvvarSLSACacheVerification, EnvvarSLSASourceURI, and
EnvvarEnableInFlightChecksums to pkg/leeway/workspace.go
- Replace all string literal usages with constants across codebase
- Update test files to use constants with leeway. package prefix
Co-authored-by: Ona <no-reply@ona.com>
cmd.Flags().String("slsa-source-uri", "", "Expected source URI for SLSA verification (required when verification enabled)")
205
205
cmd.Flags().Bool("in-flight-checksums", false, "Enable checksumming of cache artifacts to prevent TOCTU attacks")
206
206
cmd.Flags().String("report", "", "Generate a HTML report after the build has finished. (e.g. --report myreport.html)")
207
-
cmd.Flags().String("report-segment", os.Getenv("LEEWAY_SEGMENT_KEY"), "Report build events to segment using the segment key (defaults to $LEEWAY_SEGMENT_KEY)")
207
+
cmd.Flags().String("report-segment", os.Getenv(EnvvarSegmentKey), "Report build events to segment using the segment key (defaults to $LEEWAY_SEGMENT_KEY)")
208
208
cmd.Flags().Bool("report-github", os.Getenv("GITHUB_OUTPUT") !="", "Report package build success/failure to GitHub Actions using the GITHUB_OUTPUT environment variable")
209
209
cmd.Flags().Bool("fixed-build-dir", true, "Use a fixed build directory for each package, instead of based on the package version, to better utilize caches based on absolute paths (defaults to true)")
210
210
cmd.Flags().Bool("docker-export-to-cache", false, "Export Docker images to cache instead of pushing directly (enables SLSA L3 compliance)")
0 commit comments