forked from updatecli/updatecli
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Updatecli integration with Udash (updatecli#1344)
* Add updatecli login for authenticating on an API backend Signed-off-by: Olblak <[email protected]> * mitigate slowloris attack handle error Signed-off-by: Olblak <[email protected]> * fix logrus error-wrapping directive Signed-off-by: Olblak <[email protected]> * Add checkspelling allow word Signed-off-by: Olblak <[email protected]> * Update url used to publish report Signed-off-by: Olblak <[email protected]> * refactor publish command Signed-off-by: Olblak <[email protected]> * Rename target result field OldInformation to information Signed-off-by: Olblak <[email protected]> * Remove missing line Signed-off-by: Olblak <[email protected]> * show url after publishing Signed-off-by: Olblak <[email protected]> * sanitize audience name by removing http scheme Signed-off-by: Olblak <[email protected]> * Refactor auth package Signed-off-by: Olblak <[email protected]> * Remove pointer in pipeline report Signed-off-by: Olblak <[email protected]> * refactor report Signed-off-by: Olblak <[email protected]> * Add ID for each result Signed-off-by: Olblak <[email protected]> * go mod tidy Signed-off-by: Olblak <[email protected]> * Add allow text to spellcheck Signed-off-by: Olblak <[email protected]> * fix cross site scripting error Signed-off-by: Olblak <[email protected]> * Only run updatecli in experimental mode Signed-off-by: Olblak <[email protected]> * Set scm ID Add reportURL param Signed-off-by: Olblak <[email protected]> * Show report url in final report Signed-off-by: Olblak <[email protected]> * refactor auth package Signed-off-by: Olblak <[email protected]> * Improve report publishing UX The purpose of this commit is to reduce the need to specify front and back url by storing those two informations in the configuration file Then a report API can either be specified using a environment variable or relying on the default config Signed-off-by: Olblak <[email protected]> * handle error Signed-off-by: Olblak <[email protected]> * Specify correct return Signed-off-by: Olblak <[email protected]> * fix spelling warning Signed-off-by: Olblak <[email protected]> * Update pkg/core/result/target.go Co-authored-by: Damien Duportal <[email protected]> * Revert "Remove pointer in pipeline report" This reverts commit fc32d7f. * Show report url per pipeline Signed-off-by: Olblak <[email protected]> * Add dryRun information to target result Signed-off-by: Olblak <[email protected]> * Remove reports.Publish in favor of report.Publish Signed-off-by: Olblak <[email protected]> * rename OAUTH to Oauth Signed-off-by: Olblak <[email protected]> --------- Signed-off-by: Olblak <[email protected]> Co-authored-by: Damien Duportal <[email protected]>
- Loading branch information
Showing
35 changed files
with
900 additions
and
33 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,4 +10,13 @@ minoronly | |
majoronly | ||
nce | ||
WRONLY | ||
nirasan | ||
skratchdot | ||
pkce | ||
errmsg | ||
authdata | ||
APIURL | ||
oidc | ||
udash | ||
Udash | ||
CLIENTID |
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,53 @@ | ||
package cmd | ||
|
||
import ( | ||
"os" | ||
|
||
"github.com/sirupsen/logrus" | ||
|
||
"github.com/spf13/cobra" | ||
) | ||
|
||
var ( | ||
oAuthClientID string | ||
oAuthIssuer string | ||
oAuthAudience string | ||
endpointURL string | ||
|
||
loginCmd = &cobra.Command{ | ||
Use: "login url", | ||
Short: "[Experimental] login authenticates with the Updatecli service.", | ||
Example: "updatecli login app.updatecli.io", | ||
Run: func(cmd *cobra.Command, args []string) { | ||
|
||
// TODO: To be removed once not experimental anymore | ||
if !experimental { | ||
logrus.Warningf("The 'login' feature requires the flag experimental to work, such as:\n\t`updatecli login --experimental`") | ||
os.Exit(1) | ||
} | ||
|
||
switch len(args) { | ||
case 0: | ||
logrus.Errorf("missing URL to login to") | ||
os.Exit(1) | ||
case 1: | ||
endpointURL = args[0] | ||
default: | ||
logrus.Errorf("can only login to one URL at a time") | ||
os.Exit(1) | ||
} | ||
|
||
err := run("login") | ||
if err != nil { | ||
logrus.Errorf("command failed") | ||
os.Exit(1) | ||
} | ||
}, | ||
} | ||
) | ||
|
||
func init() { | ||
loginCmd.Flags().StringVar(&oAuthClientID, "oauth-clientId", "", "oauth-clientId defines the Oauth client ID") | ||
loginCmd.Flags().StringVar(&oAuthIssuer, "oauth-issuer", "", "oauth-issuer defines the Oauth authentication URL") | ||
loginCmd.Flags().StringVar(&oAuthAudience, "oauth-audience", "", "oauth-audience defines the Oauth audience URL") | ||
} |
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.