Skip to content

Latest commit

 

History

History
80 lines (63 loc) · 2.27 KB

README.md

File metadata and controls

80 lines (63 loc) · 2.27 KB

Migration

Go module for Estafette Builds and Releases migration from one SCM source to other

API

API specification for migration is defined in migration.openapi.yaml

Client

Follow below steps to use go client

  • Install migration client

    go get github.com/estafette/migration
  • Create clientID and secret in Estafette UI

  • Use client to queue migration task

    Example:

    package main
    
    import "github.com/estafette/migration"
    
    func main()  {
        client := migration.NewClient("https://api.estafette.io", "<Client-ID>", "<Client-Secret>")
        callbackURL := "https://your-callback-url"
        req := migration.Request{
            ID:          "existing-id", // optional if creating a new migration task
            FromSource:  "bitbucket.com",
            FromOwner:   "owner1",
            FromName:    "repo1",
            ToSource:    "github.com",
            ToOwner:     "owner1",
            ToName:      "repo1",
            CallbackURL: &callbackURL, // optional
            Restart:     migration.BuildLogsStage, // optional, default is LastStage (handled by the server)
        }
        task, err := client.Queue(req)
        if err != nil {
            panic(err)
        }
        fmt.Sprintf("Migration task %v queued", task.ID)
    }
  • Use client to get status of migration task

    Example:

    package main
    
    import "github.com/estafette/migration"
    
    func main()  {
        client := migration.NewClient("https://api.estafette.io", "<Client-ID>", "<Client-Secret>")
        callbackURL := "https://your-callback-url"
        req := migration.Request{
            ID:          "existing-id", // optional if creating a new migration task
            FromSource:  "bitbucket.com",
            FromOwner:   "owner1",
            FromName:    "repo1",
            ToSource:    "github.com",
            ToOwner:     "owner1",
            ToName:      "repo1",
            CallbackURL: &callbackURL, // optional
            Restart:     migration.BuildLogsStage, // optional, default is LastStage (handled by the server)
        }
        task, err := client.Queue(req)
        if err != nil {
            panic(err)
        }
        fmt.Sprintf("Migration task %v queued", task.ID)
    }