Skip to content

Commit df64bb0

Browse files
authored
Merge pull request #329 from fluxcd/exclude-ci
Add well-known CI configs to exclusion list
2 parents 00ca53c + 9a08c0c commit df64bb0

File tree

4 files changed

+23
-10
lines changed

4 files changed

+23
-10
lines changed

controllers/storage.go

+7-4
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,11 @@ import (
4242
)
4343

4444
const (
45-
excludeFile = ".sourceignore"
46-
excludeVCS = ".git/,.gitignore,.gitmodules,.gitattributes"
47-
excludeExt = "*.jpg,*.jpeg,*.gif,*.png,*.wmv,*.flv,*.tar.gz,*.zip"
45+
excludeFile = ".sourceignore"
46+
excludeVCS = ".git/,.gitignore,.gitmodules,.gitattributes"
47+
excludeExt = "*.jpg,*.jpeg,*.gif,*.png,*.wmv,*.flv,*.tar.gz,*.zip"
48+
excludeCI = ".github/,.circleci/,.travis.yml,.gitlab-ci.yml,appveyor.yml,.drone.yml,cloudbuild.yaml,codeship-services.yml,codeship-steps.yml"
49+
excludeExtra = "**/.goreleaser.yml,**/.sops.yaml,**/.flux.yaml"
4850
)
4951

5052
// Storage manages artifacts
@@ -425,7 +427,8 @@ func loadExcludePatterns(dir string, ignore *string) ([]gitignore.Pattern, error
425427
}
426428

427429
if ignore == nil {
428-
for _, p := range strings.Split(excludeExt, ",") {
430+
all := strings.Join([]string{excludeExt, excludeCI, excludeExtra}, ",")
431+
for _, p := range strings.Split(all, ",") {
429432
ps = append(ps, gitignore.ParsePattern(p, path))
430433
}
431434

controllers/storage_test.go

+2
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,8 @@ func TestArchiveIgnore(t *testing.T) {
206206
"video.wmv",
207207
"bar.png",
208208
"foo.zip",
209+
".drone.yml",
210+
".flux.yaml",
209211
}
210212

211213
// this is the table of ignored files and their values. true means that it's

docs/spec/v1beta1/buckets.md

+7-3
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,13 @@ in a gzip compressed TAR archive (`<bucket checksum>.tar.gz`).
114114

115115
### Excluding files
116116

117-
Git files (`.git/`, `.gitignore`, `.gitmodules`, and `.gitattributes`) are
118-
excluded from the archive by default, as well as some extensions (`.jpg, .jpeg,
119-
.gif, .png, .wmv, .flv, .tar.gz, .zip`)
117+
The following files and extensions are excluded from the archive by default:
118+
119+
- Git files (`.git/ ,.gitignore, .gitmodules, .gitattributes`)
120+
- File extensions (`.jpg, .jpeg, .gif, .png, .wmv, .flv, .tar.gz, .zip`)
121+
- CI configs (`.github/, .circleci/, .travis.yml, .gitlab-ci.yml, appveyor.yml, .drone.yml, cloudbuild.yaml, codeship-services.yml, codeship-steps.yml`)
122+
- CLI configs (`.goreleaser.yml, .sops.yaml`)
123+
- Flux v1 config (`.flux.yaml`)
120124

121125
Excluding additional files from the archive is possible by adding a
122126
`.sourceignore` file in the root of the bucket. The `.sourceignore` file

docs/spec/v1beta1/gitrepositories.md

+7-3
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,13 @@ gzip compressed TAR archive (`<commit hash>.tar.gz`).
149149

150150
### Excluding files
151151

152-
Git files (`.git/`, `.gitignore`, `.gitmodules`, and `.gitattributes`) are
153-
excluded from the archive by default, as well as some extensions (`.jpg, .jpeg,
154-
.gif, .png, .wmv, .flv, .tar.gz, .zip`)
152+
The following files and extensions are excluded from the archive by default:
153+
154+
- Git files (`.git/ ,.gitignore, .gitmodules, .gitattributes`)
155+
- File extensions (`.jpg, .jpeg, .gif, .png, .wmv, .flv, .tar.gz, .zip`)
156+
- CI configs (`.github/, .circleci/, .travis.yml, .gitlab-ci.yml, appveyor.yml, .drone.yml, cloudbuild.yaml, codeship-services.yml, codeship-steps.yml`)
157+
- CLI configs (`.goreleaser.yml, .sops.yaml`)
158+
- Flux v1 config (`.flux.yaml`)
155159

156160
Excluding additional files from the archive is possible by adding a
157161
`.sourceignore` file in the root of the repository. The `.sourceignore` file

0 commit comments

Comments
 (0)