Skip to content

Commit

Permalink
chore: update remaining flags, docs, and remove most openshift refere…
Browse files Browse the repository at this point in the history
…nces (#357)
  • Loading branch information
shreddedbacon authored Jun 24, 2024
1 parent e1b98da commit 3dac0e2
Show file tree
Hide file tree
Showing 22 changed files with 111 additions and 71 deletions.
36 changes: 18 additions & 18 deletions cmd/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ use 'lagoon deploy latest' instead`,
if err != nil {
return err
}
returnData, err := cmd.Flags().GetBool("returnData")
returnData, err := cmd.Flags().GetBool("returndata")
if err != nil {
return err
}
Expand Down Expand Up @@ -107,7 +107,7 @@ var deployPromoteCmd = &cobra.Command{
if err != nil {
return err
}
returnData, err := cmd.Flags().GetBool("returnData")
returnData, err := cmd.Flags().GetBool("returndata")
if err != nil {
return err
}
Expand Down Expand Up @@ -161,7 +161,7 @@ This environment should already exist in lagoon. It is analogous with the 'Deplo
},
RunE: func(cmd *cobra.Command, args []string) error {

returnData, err := cmd.Flags().GetBool("returnData")
returnData, err := cmd.Flags().GetBool("returndata")
if err != nil {
return err
}
Expand Down Expand Up @@ -233,23 +233,23 @@ This pullrequest may not already exist as an environment in lagoon.`,
if err != nil {
return err
}
baseBranchName, err := cmd.Flags().GetString("baseBranchName")
baseBranchName, err := cmd.Flags().GetString("base-branch-name")
if err != nil {
return err
}
baseBranchRef, err := cmd.Flags().GetString("baseBranchRef")
baseBranchRef, err := cmd.Flags().GetString("base-branch-ref")
if err != nil {
return err
}
headBranchName, err := cmd.Flags().GetString("headBranchName")
headBranchName, err := cmd.Flags().GetString("head-branch-name")
if err != nil {
return err
}
headBranchRef, err := cmd.Flags().GetString("headBranchRef")
headBranchRef, err := cmd.Flags().GetString("head-branch-ref")
if err != nil {
return err
}
if err := requiredInputCheck("Project name", cmdProjectName, "Pullrequest title", prTitle, "Pullrequest number", strconv.Itoa(int(prNumber)), "baseBranchName", baseBranchName, "baseBranchRef", baseBranchRef, "headBranchName", headBranchName, "headBranchRef", headBranchRef); err != nil {
if err := requiredInputCheck("Project name", cmdProjectName, "Pullrequest title", prTitle, "Pullrequest number", strconv.Itoa(int(prNumber)), "Base branch name", baseBranchName, "Base branch ref", baseBranchRef, "Head branch name", headBranchName, "Head branch ref", headBranchRef); err != nil {
return err
}
buildVarStrings, err := cmd.Flags().GetStringArray("buildvar")
Expand All @@ -261,7 +261,7 @@ This pullrequest may not already exist as an environment in lagoon.`,
return err
}

returnData, err := cmd.Flags().GetBool("returnData")
returnData, err := cmd.Flags().GetBool("returndata")
if err != nil {
return err
}
Expand Down Expand Up @@ -304,25 +304,25 @@ func init() {
deployCmd.AddCommand(deployPullrequestCmd)

const returnDataUsageText = "Returns the build name instead of success text"
deployLatestCmd.Flags().Bool("returnData", false, returnDataUsageText)
deployLatestCmd.Flags().Bool("returndata", false, returnDataUsageText)
deployLatestCmd.Flags().StringArray("buildvar", []string{}, "Add one or more build variables to deployment (--buildvar KEY1=VALUE1 [--buildvar KEY2=VALUE2])")

deployBranchCmd.Flags().StringP("branch", "b", "", "Branch name to deploy")
deployBranchCmd.Flags().StringP("branchRef", "r", "", "Branch ref to deploy")
deployBranchCmd.Flags().Bool("returnData", false, returnDataUsageText)
deployBranchCmd.Flags().StringP("branch-ref", "r", "", "Branch ref to deploy")
deployBranchCmd.Flags().Bool("returndata", false, returnDataUsageText)
deployBranchCmd.Flags().StringArray("buildvar", []string{}, "Add one or more build variables to deployment (--buildvar KEY1=VALUE1 [--buildvar KEY2=VALUE2])")

deployPromoteCmd.Flags().StringP("destination", "d", "", "Destination environment name to create")
deployPromoteCmd.Flags().StringP("source", "s", "", "Source environment name to use as the base to deploy from")
deployPromoteCmd.Flags().Bool("returnData", false, returnDataUsageText)
deployPromoteCmd.Flags().Bool("returndata", false, returnDataUsageText)
deployPromoteCmd.Flags().StringArray("buildvar", []string{}, "Add one or more build variables to deployment (--buildvar KEY1=VALUE1 [--buildvar KEY2=VALUE2])")

deployPullrequestCmd.Flags().StringP("title", "t", "", "Pullrequest title")
deployPullrequestCmd.Flags().UintP("number", "n", 0, "Pullrequest number")
deployPullrequestCmd.Flags().StringP("baseBranchName", "N", "", "Pullrequest base branch name")
deployPullrequestCmd.Flags().StringP("baseBranchRef", "R", "", "Pullrequest base branch reference hash")
deployPullrequestCmd.Flags().StringP("headBranchName", "H", "", "Pullrequest head branch name")
deployPullrequestCmd.Flags().StringP("headBranchRef", "M", "", "Pullrequest head branch reference hash")
deployPullrequestCmd.Flags().Bool("returnData", false, returnDataUsageText)
deployPullrequestCmd.Flags().StringP("base-branch-name", "N", "", "Pullrequest base branch name")
deployPullrequestCmd.Flags().StringP("base-branch-ref", "R", "", "Pullrequest base branch reference hash")
deployPullrequestCmd.Flags().StringP("head-branch-name", "H", "", "Pullrequest head branch name")
deployPullrequestCmd.Flags().StringP("head-branch-ref", "M", "", "Pullrequest head branch reference hash")
deployPullrequestCmd.Flags().Bool("returndata", false, returnDataUsageText)
deployPullrequestCmd.Flags().StringArray("buildvar", []string{}, "Add one or more build variables to deployment (--buildvar KEY1=VALUE1 [--buildvar KEY2=VALUE2])")
}
6 changes: 3 additions & 3 deletions cmd/deploytarget.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ var addDeployTargetCmd = &cobra.Command{
Use: "deploytarget",
Aliases: []string{"dt"},
Short: "Add a DeployTarget to lagoon",
Long: "Add a DeployTarget (kubernetes or openshift) to lagoon, this requires admin level permissions",
Long: "Add a Deploytarget(Kubernetes) to lagoon, this requires admin level permissions",
PreRunE: func(_ *cobra.Command, _ []string) error {
return validateTokenE(cmdLagoon)
},
Expand Down Expand Up @@ -147,7 +147,7 @@ var updateDeployTargetCmd = &cobra.Command{
Use: "deploytarget",
Aliases: []string{"dt"},
Short: "Update a DeployTarget in lagoon",
Long: "Update a DeployTarget (kubernetes or openshift) in lagoon, this requires admin level permissions",
Long: "Update a Deploytarget(Kubernetes) in lagoon, this requires admin level permissions",
PreRunE: func(_ *cobra.Command, _ []string) error {
return validateTokenE(cmdLagoon)
},
Expand Down Expand Up @@ -279,7 +279,7 @@ var deleteDeployTargetCmd = &cobra.Command{
Use: "deploytarget",
Aliases: []string{"dt"},
Short: "Delete a DeployTarget from lagoon",
Long: "Delete a DeployTarget (kubernetes or openshift) from lagoon, this requires admin level permissions",
Long: "Delete a Deploytarget(Kubernetes) from lagoon, this requires admin level permissions",
PreRunE: func(_ *cobra.Command, _ []string) error {
return validateTokenE(cmdLagoon)
},
Expand Down
6 changes: 3 additions & 3 deletions cmd/environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ var updateEnvironmentCmd = &cobra.Command{
if err != nil {
return err
}
openShift, err := cmd.Flags().GetUint("deploytarget")
deploytarget, err := cmd.Flags().GetUint("deploytarget")
if err != nil {
return err
}
Expand Down Expand Up @@ -141,7 +141,7 @@ var updateEnvironmentCmd = &cobra.Command{
Route: nullStrCheck(route),
Routes: nullStrCheck(routes),
DeployTitle: nullStrCheck(deployTitle),
Openshift: nullUintCheck(openShift),
Openshift: nullUintCheck(deploytarget),
}
if environmentAutoIdleProvided {
environmentFlags.AutoIdle = &environmentAutoIdle
Expand Down Expand Up @@ -313,7 +313,7 @@ func init() {
updateEnvironmentCmd.Flags().String("route", "", "Update the route for the selected environment")
updateEnvironmentCmd.Flags().String("routes", "", "Update the routes for the selected environment")
updateEnvironmentCmd.Flags().UintVarP(&environmentAutoIdle, "auto-idle", "a", 1, "Auto idle setting of the environment")
updateEnvironmentCmd.Flags().UintP("deploytarget", "d", 0, "Reference to OpenShift Object this Environment should be deployed to")
updateEnvironmentCmd.Flags().UintP("deploytarget", "d", 0, "Reference to Deploytarget(Kubernetes) this Environment should be deployed to")
updateEnvironmentCmd.Flags().String("environment-type", "", "Update the environment type - production | development")
updateEnvironmentCmd.Flags().String("deploy-type", "", "Update the deploy type - branch | pullrequest | promote")
}
2 changes: 1 addition & 1 deletion cmd/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ var getEnvironmentCmd = &cobra.Command{
returnNonEmptyString(fmt.Sprintf("%v", environment.DeployHeadRef)),
})
dataMain := output.Table{
Header: []string{"ID", "EnvironmentName", "EnvironmentType", "DeployType", "Created", "OpenshiftProjectName", "Route", "Routes", "AutoIdle", "DeployTitle", "DeployBaseRef", "DeployHeadRef"},
Header: []string{"ID", "EnvironmentName", "EnvironmentType", "DeployType", "Created", "Namespace", "Route", "Routes", "AutoIdle", "DeployTitle", "DeployBaseRef", "DeployHeadRef"},
Data: data,
}
output.RenderOutput(dataMain, outputOptions)
Expand Down
10 changes: 5 additions & 5 deletions cmd/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ You can get it to continue anyway with --keep-going. To disable any prompts, use
if err != nil {
return err
}
openshiftID, err := cmd.Flags().GetUint("openshiftID")
deploytargetID, err := cmd.Flags().GetUint("deploytarget-id")
if err != nil {
return err
}
Expand Down Expand Up @@ -62,7 +62,7 @@ You can get it to continue anyway with --keep-going. To disable any prompts, use
return fmt.Errorf("couldn't open file: %w", err)
}

return lagoon.Import(context.TODO(), lc, file, keepGoing, openshiftID)
return lagoon.Import(context.TODO(), lc, file, keepGoing, deploytargetID)
},
}

Expand Down Expand Up @@ -136,9 +136,9 @@ func init() {
"path to the file to import")
importCmd.Flags().Bool("keep-going", false,
"on error, just log and continue instead of aborting")
importCmd.Flags().Uint("openshiftID", 0,
"ID of the openshift to target for import")
for _, flag := range []string{"import-file", "openshiftID"} {
importCmd.Flags().Uint("deploytarget-id", 0,
"ID of the deploytarget to target for import")
for _, flag := range []string{"import-file", "deploytarget-id"} {
if err := importCmd.MarkFlagRequired(flag); err != nil {
panic(err)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ var listDeployTargetsCmd = &cobra.Command{
Use: "deploytargets",
Aliases: []string{"deploytarget", "dt"},
Short: "List all DeployTargets in Lagoon",
Long: "List all DeployTargets (kubernetes or openshift) in lagoon, this requires admin level permissions",
Long: "List all Deploytargets(Kubernetes) in lagoon, this requires admin level permissions",
PreRunE: func(_ *cobra.Command, _ []string) error {
return validateTokenE(cmdLagoon)
},
Expand Down
26 changes: 13 additions & 13 deletions cmd/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ var addProjectCmd = &cobra.Command{
if err != nil {
return err
}
openshift, err := cmd.Flags().GetUint("openshift")
deploytarget, err := cmd.Flags().GetUint("deploytarget")
if err != nil {
return err
}
Expand All @@ -102,7 +102,7 @@ var addProjectCmd = &cobra.Command{
if err != nil {
return err
}
openshiftProjectPattern, err := cmd.Flags().GetString("openshift-project-pattern")
deploytargetProjectPattern, err := cmd.Flags().GetString("deploytarget-project-pattern")
if err != nil {
return err
}
Expand Down Expand Up @@ -139,7 +139,7 @@ var addProjectCmd = &cobra.Command{
return err
}

if err := requiredInputCheck("Project name", cmdProjectName, "git-url", gitUrl, "Production environment", productionEnvironment, "Openshift", strconv.Itoa(int(openshift))); err != nil {
if err := requiredInputCheck("Project name", cmdProjectName, "git-url", gitUrl, "Production environment", productionEnvironment, "Deploytarget", strconv.Itoa(int(deploytarget))); err != nil {
return err
}

Expand All @@ -160,8 +160,8 @@ var addProjectCmd = &cobra.Command{
StandbyProductionEnvironment: standbyProductionEnvironment,
Branches: branches,
PullRequests: pullrequests,
OpenshiftProjectPattern: openshiftProjectPattern,
Openshift: openshift,
OpenshiftProjectPattern: deploytargetProjectPattern,
Openshift: deploytarget,
DevelopmentEnvironmentsLimit: developmentEnvironmentsLimit,
StorageCalc: storageCalc,
AutoIdle: autoIdle,
Expand Down Expand Up @@ -232,7 +232,7 @@ var updateProjectCmd = &cobra.Command{
if err != nil {
return err
}
openshift, err := cmd.Flags().GetUint("openshift")
deploytarget, err := cmd.Flags().GetUint("deploytarget")
if err != nil {
return err
}
Expand All @@ -248,7 +248,7 @@ var updateProjectCmd = &cobra.Command{
if err != nil {
return err
}
openshiftProjectPattern, err := cmd.Flags().GetString("openshift-project-pattern")
deploytargetProjectPattern, err := cmd.Flags().GetString("deploytarget-project-pattern")
if err != nil {
return err
}
Expand Down Expand Up @@ -326,11 +326,11 @@ var updateProjectCmd = &cobra.Command{
projectPatch := schema.UpdateProjectPatchInput{
GitURL: nullStrCheck(gitUrl),
ProductionEnvironment: nullStrCheck(productionEnvironment),
Openshift: nullUintCheck(openshift),
Openshift: nullUintCheck(deploytarget),
StandbyProductionEnvironment: nullStrCheck(standbyProductionEnvironment),
Branches: nullStrCheck(branches),
Pullrequests: nullStrCheck(pullrequests),
OpenshiftProjectPattern: nullStrCheck(openshiftProjectPattern),
OpenshiftProjectPattern: nullStrCheck(deploytargetProjectPattern),
DevelopmentEnvironmentsLimit: nullUintCheck(developmentEnvironmentsLimit),
StorageCalc: nullUintCheck(storageCalc),
AutoIdle: nullUintCheck(autoIdle),
Expand Down Expand Up @@ -713,7 +713,7 @@ func init() {
updateProjectCmd.Flags().StringP("pullrequests", "m", "", "Which Pull Requests should be deployed")
updateProjectCmd.Flags().StringP("production-environment", "E", "", "Which environment(the name) should be marked as the production environment")
updateProjectCmd.Flags().String("standby-production-environment", "", "Which environment(the name) should be marked as the standby production environment")
updateProjectCmd.Flags().StringP("openshift-project-pattern", "o", "", "Pattern of OpenShift Project/Namespace that should be generated")
updateProjectCmd.Flags().StringP("deploytarget-project-pattern", "o", "", "Pattern of Deploytarget(Kubernetes) Project/Namespace that should be generated")
updateProjectCmd.Flags().StringP("build-image", "", "", "Build Image for the project. Set to 'null' to remove the build image")
updateProjectCmd.Flags().StringP("availability", "", "", "Availability of the project")

Expand All @@ -722,7 +722,7 @@ func init() {
updateProjectCmd.Flags().UintP("auto-idle", "a", 0, "Auto idle setting of the project")
updateProjectCmd.Flags().UintP("storage-calc", "C", 0, "Should storage for this environment be calculated")
updateProjectCmd.Flags().UintP("development-environments-limit", "L", 0, "How many environments can be deployed at one time")
updateProjectCmd.Flags().UintP("openshift", "S", 0, "Reference to OpenShift Object this Project should be deployed to")
updateProjectCmd.Flags().UintP("deploytarget", "S", 0, "Reference to Deploytarget(Kubernetes) this Project should be deployed to")
updateProjectCmd.Flags().UintP("deployments-disabled", "", 0, "Admin only flag for disabling deployments on a project, 1 to disable deployments, 0 to enable")

updateProjectCmd.Flags().UintP("facts-ui", "", 0, "Enables the Lagoon insights Facts tab in the UI. Set to 1 to enable, 0 to disable")
Expand All @@ -738,12 +738,12 @@ func init() {
addProjectCmd.Flags().StringP("pullrequests", "m", "", "Which Pull Requests should be deployed")
addProjectCmd.Flags().StringP("production-environment", "E", "", "Which environment(the name) should be marked as the production environment")
addProjectCmd.Flags().String("standby-production-environment", "", "Which environment(the name) should be marked as the standby production environment")
addProjectCmd.Flags().StringP("openshift-project-pattern", "o", "", "Pattern of OpenShift Project/Namespace that should be generated")
addProjectCmd.Flags().StringP("deploytarget-project-pattern", "", "", "Pattern of Deploytarget(Kubernetes) Project/Namespace that should be generated")

addProjectCmd.Flags().UintP("auto-idle", "a", 0, "Auto idle setting of the project")
addProjectCmd.Flags().UintP("storage-calc", "C", 0, "Should storage for this environment be calculated")
addProjectCmd.Flags().UintP("development-environments-limit", "L", 0, "How many environments can be deployed at one time")
addProjectCmd.Flags().UintP("openshift", "S", 0, "Reference to OpenShift Object this Project should be deployed to")
addProjectCmd.Flags().UintP("deploytarget", "S", 0, "Reference to Deploytarget(Kubernetes) target this Project should be deployed to")
addProjectCmd.Flags().StringP("build-image", "", "", "Build Image for the project")
addProjectCmd.Flags().Bool("owner", false, "Add the user as an owner of the project")
addProjectCmd.Flags().StringP("organization-name", "O", "", "Name of the Organization to add the project to")
Expand Down
1 change: 1 addition & 0 deletions docs/commands/lagoon.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ lagoon [flags]
* [lagoon kibana](lagoon_kibana.md) - Launch the kibana interface
* [lagoon list](lagoon_list.md) - List projects, environments, deployments, variables or notifications
* [lagoon login](lagoon_login.md) - Log into a Lagoon instance
* [lagoon logs](lagoon_logs.md) - Display logs for a service of an environment and project
* [lagoon raw](lagoon_raw.md) - Run a custom query or mutation
* [lagoon reset-password](lagoon_reset-password.md) - Send a password reset email
* [lagoon retrieve](lagoon_retrieve.md) - Trigger a retrieval operation on backups
Expand Down
2 changes: 1 addition & 1 deletion docs/commands/lagoon_add_deploytarget.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Add a DeployTarget to lagoon

### Synopsis

Add a DeployTarget (kubernetes or openshift) to lagoon, this requires admin level permissions
Add a Deploytarget(Kubernetes) to lagoon, this requires admin level permissions

```
lagoon add deploytarget [flags]
Expand Down
4 changes: 2 additions & 2 deletions docs/commands/lagoon_add_project.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ lagoon add project [flags]
-a, --auto-idle uint Auto idle setting of the project
-b, --branches string Which branches should be deployed
--build-image string Build Image for the project
-S, --deploytarget uint Reference to Deploytarget(Kubernetes) target this Project should be deployed to
--deploytarget-project-pattern string Pattern of Deploytarget(Kubernetes) Project/Namespace that should be generated
-L, --development-environments-limit uint How many environments can be deployed at one time
-g, --git-url string GitURL of the project
-h, --help help for project
-j, --json string JSON string to patch
-S, --openshift uint Reference to OpenShift Object this Project should be deployed to
-o, --openshift-project-pattern string Pattern of OpenShift Project/Namespace that should be generated
--organization-id uint ID of the Organization to add the project to
-O, --organization-name string Name of the Organization to add the project to
--owner Add the user as an owner of the project
Expand Down
2 changes: 1 addition & 1 deletion docs/commands/lagoon_delete_deploytarget.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Delete a DeployTarget from lagoon

### Synopsis

Delete a DeployTarget (kubernetes or openshift) from lagoon, this requires admin level permissions
Delete a Deploytarget(Kubernetes) from lagoon, this requires admin level permissions

```
lagoon delete deploytarget [flags]
Expand Down
4 changes: 2 additions & 2 deletions docs/commands/lagoon_deploy_branch.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ lagoon deploy branch [flags]

```
-b, --branch string Branch name to deploy
-r, --branchRef string Branch ref to deploy
-r, --branch-ref string Branch ref to deploy
--buildvar stringArray Add one or more build variables to deployment (--buildvar KEY1=VALUE1 [--buildvar KEY2=VALUE2])
-h, --help help for branch
--returnData Returns the build name instead of success text
--returndata Returns the build name instead of success text
```

### Options inherited from parent commands
Expand Down
Loading

0 comments on commit 3dac0e2

Please sign in to comment.