Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add well-known CI configs to exclusion list #329

Merged
merged 1 commit into from
Mar 31, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions controllers/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,11 @@ import (
)

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

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

if ignore == nil {
for _, p := range strings.Split(excludeExt, ",") {
all := strings.Join([]string{excludeExt, excludeCI, excludeExtra}, ",")
for _, p := range strings.Split(all, ",") {
ps = append(ps, gitignore.ParsePattern(p, path))
}

Expand Down
2 changes: 2 additions & 0 deletions controllers/storage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,8 @@ func TestArchiveIgnore(t *testing.T) {
"video.wmv",
"bar.png",
"foo.zip",
".drone.yml",
".flux.yaml",
}

// this is the table of ignored files and their values. true means that it's
Expand Down
10 changes: 7 additions & 3 deletions docs/spec/v1beta1/buckets.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,13 @@ in a gzip compressed TAR archive (`<bucket checksum>.tar.gz`).

### Excluding files

Git files (`.git/`, `.gitignore`, `.gitmodules`, and `.gitattributes`) are
excluded from the archive by default, as well as some extensions (`.jpg, .jpeg,
.gif, .png, .wmv, .flv, .tar.gz, .zip`)
The following files and extensions are excluded from the archive by default:

- Git files (`.git/ ,.gitignore, .gitmodules, .gitattributes`)
- File extensions (`.jpg, .jpeg, .gif, .png, .wmv, .flv, .tar.gz, .zip`)
- CI configs (`.github/, .circleci/, .travis.yml, .gitlab-ci.yml, appveyor.yml, .drone.yml, cloudbuild.yaml, codeship-services.yml, codeship-steps.yml`)
- CLI configs (`.goreleaser.yml, .sops.yaml`)
- Flux v1 config (`.flux.yaml`)

Excluding additional files from the archive is possible by adding a
`.sourceignore` file in the root of the bucket. The `.sourceignore` file
Expand Down
10 changes: 7 additions & 3 deletions docs/spec/v1beta1/gitrepositories.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,13 @@ gzip compressed TAR archive (`<commit hash>.tar.gz`).

### Excluding files

Git files (`.git/`, `.gitignore`, `.gitmodules`, and `.gitattributes`) are
excluded from the archive by default, as well as some extensions (`.jpg, .jpeg,
.gif, .png, .wmv, .flv, .tar.gz, .zip`)
The following files and extensions are excluded from the archive by default:

- Git files (`.git/ ,.gitignore, .gitmodules, .gitattributes`)
- File extensions (`.jpg, .jpeg, .gif, .png, .wmv, .flv, .tar.gz, .zip`)
- CI configs (`.github/, .circleci/, .travis.yml, .gitlab-ci.yml, appveyor.yml, .drone.yml, cloudbuild.yaml, codeship-services.yml, codeship-steps.yml`)
- CLI configs (`.goreleaser.yml, .sops.yaml`)
- Flux v1 config (`.flux.yaml`)

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