Skip to content

Commit

Permalink
feat: add support for custom .gitignore paths
Browse files Browse the repository at this point in the history
Now you can add `ignoredPaths` list to `common.Build` spec.

Signed-off-by: Dmitriy Matrenichev <dmitry.matrenichev@siderolabs.com>
  • Loading branch information
DmitriyMV committed Nov 28, 2022
1 parent 3ac53a8 commit c41f376
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
3 changes: 2 additions & 1 deletion .gitignore
@@ -1,5 +1,6 @@
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
#
# Generated on 2020-08-11T14:39:25Z by kres ced23da-dirty.
# Generated on 2022-11-28T15:57:44Z by kres 3ac53a8-dirty.

_out
_out/example/
5 changes: 5 additions & 0 deletions .kres.yaml
Expand Up @@ -22,3 +22,8 @@ spec:
kind: service.CodeCov
spec:
targetThreshold: 10
---
kind: common.Build
spec:
ignoredPaths:
- "_out/example/"
10 changes: 7 additions & 3 deletions internal/project/common/build.go
Expand Up @@ -19,7 +19,8 @@ type Build struct {

meta *meta.Options

ArtifactsPath string `yaml:"artifactsPath"`
ArtifactsPath string `yaml:"artifactsPath"`
IgnoredPaths []string `yaml:"ignoredPaths"`
}

// NewBuild initializes Build.
Expand Down Expand Up @@ -66,8 +67,11 @@ func (build *Build) CompileMakefile(output *makefile.Output) error {

// CompileGitignore implements gitignore.Compiler.
func (build *Build) CompileGitignore(output *gitignore.Output) error {
output.
IgnorePath(build.ArtifactsPath)
output.IgnorePath(build.ArtifactsPath)

for _, ignoredPath := range build.IgnoredPaths {
output.IgnorePath(ignoredPath)
}

return nil
}
Expand Down

0 comments on commit c41f376

Please sign in to comment.