This repository has been archived by the owner on Mar 31, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 55
implement file ignore in the profile enable process #104
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package enable | ||
|
||
import ( | ||
"strings" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
const ( | ||
ignoreFileFixture = `a | ||
b/ | ||
#c | ||
#d | ||
e | ||
f | ||
../g | ||
h.. | ||
i # this is i | ||
j/# this is j | ||
` | ||
) | ||
|
||
func TestParseDotIgnoreFile(t *testing.T) { | ||
r := strings.NewReader(ignoreFileFixture) | ||
lines, err := parseDotIgnorefile("", r) | ||
assert.NoError(t, err, "parsing ignore file should not be error") | ||
assert.Equal(t, 8, len(lines), "ignore file entries should be 8") | ||
// Entry: 'b/' is resolved to 'b' by path.Join() | ||
assert.Equal(t, []string{"a", "b", "e", "f", "../g", "h..", "i", "j"}, lines) | ||
} | ||
|
||
func TestParseDotIgnoreFileWithPrefix(t *testing.T) { | ||
r := strings.NewReader(ignoreFileFixture) | ||
lines, err := parseDotIgnorefile("profiles", r) | ||
assert.NoError(t, err, "parsing ignore file should not be error") | ||
assert.Equal(t, 8, len(lines), "ignore file entries should be 8") | ||
// Note: | ||
// - 'profiles/b/' is resolved to 'profiles/b' | ||
// - 'profiles/../g' is resolved to 'g' | ||
assert.Equal(t, []string{ | ||
"profiles/a", "profiles/b", "profiles/e", | ||
"profiles/f", "g", "profiles/h..", | ||
"profiles/i", "profiles/j"}, lines) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It feels to me that
wksctl
inwksctlignore
refers to our tool in an overly specific way. It is not impossible that we have another tool (other thanwksctl
) in the future that deals with profiles, for example.Unless we're already committed to calling this
.wksctlignore
, I suggest renaming to.profileignore
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mflendrich basically yes, it is very specific to
wksctl
. Let me explain by referring to this example profile:https://github.com/chanwit/eks-quickstart-app-dev
In the above profile, there are two ignore files
.eksctlignore
and.wksctlignore
.Each of them contains a set of file needs to be removed by each tool.
This is by design to make a single profile repo works on both
eksctl
andwksctl
.Thinking of this as a situation that we have
.circleci
,.travis.yaml
and.drone.yaml
files on a git repo to allow each CI to independently process our repo (in its own way).