-
Notifications
You must be signed in to change notification settings - Fork 245
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added pipelines run status and trigger run
- Loading branch information
Showing
11 changed files
with
531 additions
and
4 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
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,42 @@ | ||
package pipelines | ||
|
||
import ( | ||
corecommon "github.com/jfrog/jfrog-cli-core/v2/docs/common" | ||
"github.com/jfrog/jfrog-cli/utils/cliutils" | ||
"github.com/urfave/cli" | ||
) | ||
|
||
func GetCommands() []cli.Command { | ||
return cliutils.GetSortedCommands(cli.CommandsByName{ | ||
{ | ||
Name: cliutils.Status, | ||
Flags: cliutils.GetCommandFlags(cliutils.Status), | ||
Aliases: []string{"s"}, | ||
Description: "gets status of latest run of pipeline", | ||
BashComplete: corecommon.CreateBashCompletionFunc(), | ||
Action: func(c *cli.Context) error { | ||
return fetchLatestPipelineRunStatus(c, c.String("branch")) | ||
}, | ||
}, | ||
{ | ||
Name: "trigger", | ||
Flags: cliutils.GetCommandFlags(cliutils.Trigger), | ||
Aliases: []string{"t"}, | ||
Description: "trigger a run for pipeline", | ||
BashComplete: corecommon.CreateBashCompletionFunc(), | ||
Action: func(c *cli.Context) error { | ||
return triggerNewRun(c) | ||
}, | ||
}, | ||
{ | ||
Name: "version", | ||
Flags: cliutils.GetCommandFlags("version"), | ||
Aliases: []string{"v"}, | ||
Description: "get pipeline version on server", | ||
BashComplete: corecommon.CreateBashCompletionFunc(), | ||
Action: func(c *cli.Context) error { | ||
return getVersion(c) | ||
}, | ||
}, | ||
}) | ||
} |
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,54 @@ | ||
package pipelines | ||
|
||
import ( | ||
utilsconfig "github.com/jfrog/jfrog-cli-core/v2/utils/config" | ||
clientConfig "github.com/jfrog/jfrog-client-go/config" | ||
"github.com/jfrog/jfrog-client-go/pipelines" | ||
clientlog "github.com/jfrog/jfrog-client-go/utils/log" | ||
) | ||
|
||
/* | ||
getServiceDetails returns server details based on serverID | ||
if serverID is empty returns default config otherwise error | ||
*/ | ||
func getServiceDetails(serverID string) (*utilsconfig.ServerDetails, error) { | ||
if serverID == "" { | ||
conf, err := utilsconfig.GetDefaultServerConf() | ||
if err != nil { | ||
clientlog.Error("unable to find server configuration exiting") | ||
return nil, err | ||
} | ||
serverID = conf.ServerId | ||
} | ||
serviceDetails, err := utilsconfig.GetSpecificConfig(serverID, false, false) | ||
if err != nil { | ||
clientlog.Error(err) | ||
return nil, err | ||
} | ||
return serviceDetails, err | ||
} | ||
|
||
/* | ||
getPipelinesManager creates pipelines manager from jfrog-go-client | ||
*/ | ||
func getPipelinesManager(serviceDetails *utilsconfig.ServerDetails) (*pipelines.PipelinesServicesManager, error) { | ||
pipelinesDetails := *serviceDetails | ||
pAuth, authErr := pipelinesDetails.CreatePipelinesAuthConfig() | ||
if authErr != nil { | ||
return nil, authErr | ||
} | ||
serviceConfig, err := clientConfig.NewConfigBuilder(). | ||
SetServiceDetails(pAuth). | ||
SetDryRun(false). | ||
Build() | ||
if err != nil { | ||
clientlog.Error(err) | ||
return nil, err | ||
} | ||
pipelinesMgr, err := pipelines.New(serviceConfig) | ||
if err != nil { | ||
clientlog.Error(err) | ||
return nil, err | ||
} | ||
return pipelinesMgr, nil | ||
} |
Oops, something went wrong.