-
Notifications
You must be signed in to change notification settings - Fork 20
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
Automate plugin installation #420
Merged
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
a5bbec0
Add url parameter for Plugin
hamedsalim1999 2d422ac
Move plugin install logic to utils
mostafa 093a3f9
Add url of the cache plugin
mostafa decddd0
Make plugin install work with CLI args and URLs in the gatewayd_plugi…
mostafa cac99a6
Fix linter errors
mostafa 4348cf7
Use cast to refactor casts
mostafa aeb6d85
Test using the latest version of the plugin
mostafa 28e0456
Check if the plugins are installed before updating or installing them
mostafa 9016f36
Fix linter errors
mostafa d141804
Add overwrite-config flag to prevent updating config for automatic in…
mostafa 9b311ce
Fix help for the plugin install command
mostafa 45a6ce6
Fix variable reuse and naming
mostafa 2561403
Add test for automated installation with no overwrite
mostafa 38d9ecd
Generate and use separate plugins config file for each test
mostafa 42d6a9a
Don't remove config files when running multiple goroutines
mostafa b47923a
Try to fix the race issue
mostafa 60f810f
Check if the plugins config file exists
mostafa 00423f8
Use an integration token to prevent GitHub API rate limits from block…
mostafa 3e06f08
Pull plugin once and use the archive to install the plugin
mostafa cf990c2
Ignore linter error
mostafa 842f360
Close reader
mostafa 45c6d95
Reset global variable
mostafa 618b231
Overwrite config
mostafa dfbfef0
Remove temp files
mostafa 8d7c730
Clarify install flags
mostafa 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,4 +31,5 @@ dist/ | |
libtensorflow* | ||
|
||
# Test generated files | ||
cmd/test_plugins.yaml.bak | ||
cmd/test_*.yaml.bak | ||
cmd/test_*.yaml |
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 |
---|---|---|
|
@@ -2,16 +2,12 @@ package cmd | |
|
||
import ( | ||
"bytes" | ||
"os" | ||
"path/filepath" | ||
|
||
"github.com/spf13/cobra" | ||
) | ||
|
||
var ( | ||
globalTestConfigFile = "./test_global.yaml" | ||
globalTLSTestConfigFile = "./testdata/gatewayd_tls.yaml" | ||
pluginTestConfigFile = "./test_plugins.yaml" | ||
) | ||
|
||
// executeCommandC executes a cobra command and returns the command, output, and error. | ||
// Taken from https://github.com/spf13/cobra/blob/0c72800b8dba637092b57a955ecee75949e79a73/command_test.go#L48. | ||
func executeCommandC(root *cobra.Command, args ...string) (string, error) { | ||
|
@@ -24,3 +20,18 @@ func executeCommandC(root *cobra.Command, args ...string) (string, error) { | |
|
||
return buf.String(), err | ||
} | ||
|
||
// mustPullPlugin pulls the gatewayd-plugin-cache plugin and returns the path to the archive. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is to prevent GitHub API rate limit to be reached by pulling the plugin once and reusing it (almost) everywhere. |
||
func mustPullPlugin() (string, error) { | ||
pluginURL := "github.com/gatewayd-io/gatewayd-plugin-cache@v0.2.10" | ||
fileName := "./gatewayd-plugin-cache-linux-amd64-v0.2.10.tar.gz" | ||
|
||
if _, err := os.Stat(fileName); os.IsNotExist(err) { | ||
_, err := executeCommandC(rootCmd, "plugin", "install", "--pull-only", pluginURL) | ||
if err != nil { | ||
return "", err | ||
} | ||
} | ||
|
||
return filepath.Abs(fileName) //nolint:wrapcheck | ||
} |
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
Oops, something went wrong.
Oops, something went wrong.
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.
This is to increase the rate limit of the GitHub API, so that consecutive CI runs don't hit the limit.