Skip to content

Commit

Permalink
Support user groups migration (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
puthrayaharness authored Mar 16, 2023
1 parent 503fcd8 commit 8971cc8
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ To migrate triggers
harness-upgrade triggers
```

To migrate user groups
```shell
harness-upgrade user-groups
```

To create project
```shell
harness-upgrade project create
Expand Down
1 change: 1 addition & 0 deletions constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const (
Environment = "ENVIRONMENT"
ApplicationManifest = "MANIFEST"
Template = "TEMPLATE"
UserGroups = "USER_GROUP"
)

const (
Expand Down
7 changes: 7 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,13 @@ func main() {
return cliWrapper(GetAppSummary, context)
},
},
{
Name: "user-groups",
Usage: "Import user groups from First Gen to Next Gen",
Action: func(context *cli.Context) error {
return cliWrapper(migrateUserGroups, context)
},
},
{
Name: "account",
Usage: "Import secrets managers, secrets, connectors. This will not migrate services, environments, triggers, pipelines etc",
Expand Down
15 changes: 15 additions & 0 deletions usergroup.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package main

import (
log "github.com/sirupsen/logrus"
"github.com/urfave/cli/v2"
)

func migrateUserGroups(*cli.Context) error {
_ = PromptEnvDetails()
logMigrationDetails()
log.Info("Importing the user groups....")
CreateEntities(getReqBody(UserGroups, Filter{}))
log.Info("Imported the user groups.")
return nil
}

0 comments on commit 8971cc8

Please sign in to comment.