-
Notifications
You must be signed in to change notification settings - Fork 13
CFE-4089: Implemented updating modules added from a URL by branch #287
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
11f2e2f
Fixed typo
jakub-nt c434bd9
Added a new supported `cfbs.json` key: `"branch"`
jakub-nt 85f4182
Implemented branch support for updating modules added by URL
jakub-nt c3a0b95
Fixed a throw when a module is added by URL without a specified branch
jakub-nt b37ed44
Simplified Git repository cloning logic
jakub-nt ebdf0b7
Added error handling to prevent checking out non-existent references
jakub-nt 02338a1
Added tests for the functionality of updating by branch
jakub-nt 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -70,6 +70,7 @@ def attributes() -> tuple: | |
| return ( | ||
| "name", | ||
| "version", | ||
| "branch", | ||
| "commit", | ||
| "added_by", | ||
| "steps", | ||
|
|
||
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -21,6 +21,7 @@ | |
| "index", | ||
| "version", | ||
| "commit", | ||
| "branch", | ||
| "subdirectory", | ||
| "dependencies", | ||
| "added_by", | ||
|
|
||
This file contains hidden or 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 hidden or 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 hidden or 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,17 @@ | ||
| set -e | ||
| set -x | ||
| cd tests/ | ||
| mkdir -p ./tmp/ | ||
| cd ./tmp/ | ||
| touch cfbs.json && rm cfbs.json | ||
| rm -rf .git | ||
|
|
||
| cfbs --non-interactive init --masterfiles no | ||
| cfbs --non-interactive add https://github.com/cfengine/test-cfbs-static-repo/@update-test-branch test-library-parsed-local-users | ||
|
|
||
| # check that cfbs.json contains the right commit hash (ideally for testing, different than the default branch's commit hash): | ||
| grep '"commit": "2152eb5a39fbf9b051105b400639b436bd53ab87"' cfbs.json | ||
| # check that branch key is correctly set: | ||
| grep '"branch": "update-test-branch"' cfbs.json | ||
|
|
||
| cfbs update test-library-parsed-local-users | grep "Module 'test-library-parsed-local-users' already up to date" |
This file contains hidden or 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,16 @@ | ||
| set -e | ||
| set -x | ||
| cd tests/ | ||
| mkdir -p ./tmp/ | ||
| cd ./tmp/ | ||
| touch cfbs.json && rm cfbs.json | ||
| rm -rf .git | ||
|
|
||
| cfbs --non-interactive init --masterfiles no | ||
| cfbs --non-interactive add https://github.com/cfengine/test-cfbs-static-repo/@update-test-branch test-library-parsed-local-users | ||
|
|
||
| cp ../shell/046_update_from_url_branch/cfbs.json . | ||
|
|
||
| cfbs update test-library-parsed-local-users | grep "Updated module 'test-library-parsed-local-users' from url" | ||
| # check that the commit hash changed: | ||
| grep '"commit": "2152eb5a39fbf9b051105b400639b436bd53ab87"' cfbs.json |
This file contains hidden or 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,21 @@ | ||
| { | ||
| "name": "Example project", | ||
| "description": "Example description", | ||
| "type": "policy-set", | ||
| "git": true, | ||
| "build": [ | ||
| { | ||
| "name": "test-library-parsed-local-users", | ||
| "description": "Parse local users from /etc/passwd on the system with their attributes from /etc/shadow", | ||
| "url": "https://github.com/cfengine/test-cfbs-static-repo/", | ||
| "commit": "f702461f319e170db05bcb61f867b440b5cbd013", | ||
| "branch": "update-test-branch", | ||
| "subdirectory": "test_library_parsed_etc_passwd_shadow", | ||
| "added_by": "cfbs add", | ||
| "steps": [ | ||
| "copy ./test_library_parsed_etc_passwd_shadow.cf services/local-users/test_library_parsed_etc_passwd_shadow/", | ||
| "json cfbs/def.json def.json" | ||
| ] | ||
| } | ||
| ] | ||
| } |
This file contains hidden or 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.
Maybe it should say "Fixed exception..." in the commit message?
Uh oh!
There was an error while loading. Please reload this page.
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.
Neither "Fixed a throw" or "Fixed an exception" reads well to me, maybe just "Fixed a crash"?
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.
Not a big deal either way, I'll merge. For the record, here is my ranking of niceness: