mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-22 09:51:01 +00:00
Rename drone-go (#390)
This commit is contained in:
parent
bb37836600
commit
2f267e2a79
15 changed files with 36 additions and 36 deletions
|
@ -7,7 +7,7 @@ import (
|
|||
"strconv"
|
||||
|
||||
"github.com/woodpecker-ci/woodpecker/cli/internal"
|
||||
"github.com/woodpecker-ci/woodpecker/drone-go/drone"
|
||||
"github.com/woodpecker-ci/woodpecker/woodpecker-go/woodpecker"
|
||||
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
@ -32,12 +32,12 @@ var Command = cli.Command{
|
|||
cli.StringFlag{
|
||||
Name: "event",
|
||||
Usage: "event filter",
|
||||
Value: drone.EventPush,
|
||||
Value: woodpecker.EventPush,
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "status",
|
||||
Usage: "status filter",
|
||||
Value: drone.StatusSuccess,
|
||||
Value: woodpecker.StatusSuccess,
|
||||
},
|
||||
cli.StringSliceFlag{
|
||||
Name: "param, p",
|
||||
|
|
|
@ -11,11 +11,11 @@ import (
|
|||
"golang.org/x/net/proxy"
|
||||
"golang.org/x/oauth2"
|
||||
|
||||
"github.com/woodpecker-ci/woodpecker/drone-go/drone"
|
||||
"github.com/woodpecker-ci/woodpecker/woodpecker-go/woodpecker"
|
||||
)
|
||||
|
||||
// NewClient returns a new client from the CLI context.
|
||||
func NewClient(c *cli.Context) (drone.Client, error) {
|
||||
func NewClient(c *cli.Context) (woodpecker.Client, error) {
|
||||
var (
|
||||
skip = c.GlobalBool("skip-verify")
|
||||
socks = c.GlobalString("socks-proxy")
|
||||
|
@ -26,12 +26,12 @@ func NewClient(c *cli.Context) (drone.Client, error) {
|
|||
server = strings.TrimRight(server, "/")
|
||||
|
||||
// if no server url is provided we can default
|
||||
// to the hosted Drone service.
|
||||
// to the hosted Woodpecker service.
|
||||
if len(server) == 0 {
|
||||
return nil, fmt.Errorf("Error: you must provide the Drone server address.")
|
||||
return nil, fmt.Errorf("Error: you must provide the Woodpecker server address.")
|
||||
}
|
||||
if len(token) == 0 {
|
||||
return nil, fmt.Errorf("Error: you must provide your Drone access token.")
|
||||
return nil, fmt.Errorf("Error: you must provide your Woodpecker access token.")
|
||||
}
|
||||
|
||||
// attempt to find system CA certs
|
||||
|
@ -68,7 +68,7 @@ func NewClient(c *cli.Context) (drone.Client, error) {
|
|||
}
|
||||
}
|
||||
|
||||
return drone.NewClient(server, auther), nil
|
||||
return woodpecker.NewClient(server, auther), nil
|
||||
}
|
||||
|
||||
// ParseRepo parses the repository owner and name from a string.
|
||||
|
|
|
@ -5,7 +5,7 @@ import (
|
|||
"strings"
|
||||
|
||||
"github.com/woodpecker-ci/woodpecker/cli/internal"
|
||||
"github.com/woodpecker-ci/woodpecker/drone-go/drone"
|
||||
"github.com/woodpecker-ci/woodpecker/woodpecker-go/woodpecker"
|
||||
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
@ -54,7 +54,7 @@ func registryCreate(c *cli.Context) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
registry := &drone.Registry{
|
||||
registry := &woodpecker.Registry{
|
||||
Address: hostname,
|
||||
Username: username,
|
||||
Password: password,
|
||||
|
|
|
@ -5,7 +5,7 @@ import (
|
|||
"strings"
|
||||
|
||||
"github.com/woodpecker-ci/woodpecker/cli/internal"
|
||||
"github.com/woodpecker-ci/woodpecker/drone-go/drone"
|
||||
"github.com/woodpecker-ci/woodpecker/woodpecker-go/woodpecker"
|
||||
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
@ -54,7 +54,7 @@ func registryUpdate(c *cli.Context) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
registry := &drone.Registry{
|
||||
registry := &woodpecker.Registry{
|
||||
Address: hostname,
|
||||
Username: username,
|
||||
Password: password,
|
||||
|
|
|
@ -5,7 +5,7 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/woodpecker-ci/woodpecker/cli/internal"
|
||||
"github.com/woodpecker-ci/woodpecker/drone-go/drone"
|
||||
"github.com/woodpecker-ci/woodpecker/woodpecker-go/woodpecker"
|
||||
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
@ -34,7 +34,7 @@ var repoUpdateCmd = cli.Command{
|
|||
},
|
||||
cli.StringFlag{
|
||||
Name: "config",
|
||||
Usage: "repository configuration path (e.g. .drone.yml)",
|
||||
Usage: "repository configuration path (e.g. .woodpecker.yml)",
|
||||
},
|
||||
cli.IntFlag{
|
||||
Name: "build-counter",
|
||||
|
@ -69,7 +69,7 @@ func repoUpdate(c *cli.Context) error {
|
|||
unsafe = c.Bool("unsafe")
|
||||
)
|
||||
|
||||
patch := new(drone.RepoPatch)
|
||||
patch := new(woodpecker.RepoPatch)
|
||||
if c.IsSet("trusted") {
|
||||
patch.IsTrusted = &trusted
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ import (
|
|||
"strings"
|
||||
|
||||
"github.com/woodpecker-ci/woodpecker/cli/internal"
|
||||
"github.com/woodpecker-ci/woodpecker/drone-go/drone"
|
||||
"github.com/woodpecker-ci/woodpecker/woodpecker-go/woodpecker"
|
||||
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
@ -52,7 +52,7 @@ func secretCreate(c *cli.Context) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
secret := &drone.Secret{
|
||||
secret := &woodpecker.Secret{
|
||||
Name: c.String("name"),
|
||||
Value: c.String("value"),
|
||||
Images: c.StringSlice("image"),
|
||||
|
@ -74,7 +74,7 @@ func secretCreate(c *cli.Context) error {
|
|||
}
|
||||
|
||||
var defaultSecretEvents = []string{
|
||||
drone.EventPush,
|
||||
drone.EventTag,
|
||||
drone.EventDeploy,
|
||||
woodpecker.EventPush,
|
||||
woodpecker.EventTag,
|
||||
woodpecker.EventDeploy,
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ import (
|
|||
"strings"
|
||||
|
||||
"github.com/woodpecker-ci/woodpecker/cli/internal"
|
||||
"github.com/woodpecker-ci/woodpecker/drone-go/drone"
|
||||
"github.com/woodpecker-ci/woodpecker/woodpecker-go/woodpecker"
|
||||
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
@ -52,7 +52,7 @@ func secretUpdate(c *cli.Context) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
secret := &drone.Secret{
|
||||
secret := &woodpecker.Secret{
|
||||
Name: c.String("name"),
|
||||
Value: c.String("value"),
|
||||
Images: c.StringSlice("image"),
|
||||
|
|
|
@ -4,7 +4,7 @@ import (
|
|||
"fmt"
|
||||
|
||||
"github.com/urfave/cli"
|
||||
"github.com/woodpecker-ci/woodpecker/drone-go/drone"
|
||||
"github.com/woodpecker-ci/woodpecker/woodpecker-go/woodpecker"
|
||||
|
||||
"github.com/woodpecker-ci/woodpecker/cli/internal"
|
||||
)
|
||||
|
@ -24,7 +24,7 @@ func userAdd(c *cli.Context) error {
|
|||
return err
|
||||
}
|
||||
|
||||
user, err := client.UserPost(&drone.User{Login: login})
|
||||
user, err := client.UserPost(&woodpecker.User{Login: login})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
# drone-go
|
||||
# woodpecker-go
|
||||
|
||||
```Go
|
||||
import (
|
||||
"github.com/woodpecker-ci/woodpecker/drone-go/drone"
|
||||
"github.com/woodpecker-ci/woodpecker/woodpecker-go/woodpecker"
|
||||
"golang.org/x/oauth2"
|
||||
)
|
||||
|
||||
const (
|
||||
token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9"
|
||||
host = "http://drone.company.com"
|
||||
host = "http://woodpecker.company.tld"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
@ -21,15 +21,15 @@ func main() {
|
|||
},
|
||||
)
|
||||
|
||||
// create the drone client with authenticator
|
||||
client := drone.NewClient(host, auther)
|
||||
// create the woodpecker client with authenticator
|
||||
client := woodpecker.NewClient(host, auther)
|
||||
|
||||
// gets the current user
|
||||
user, err := client.Self()
|
||||
fmt.Println(user, err)
|
||||
|
||||
// gets the named repository information
|
||||
repo, err := client.Repo("drone", "drone-go")
|
||||
repo, err := client.Repo("woodpecker-ci", "woodpecker")
|
||||
fmt.Println(repo, err)
|
||||
}
|
||||
```
|
|
@ -1,4 +1,4 @@
|
|||
package drone
|
||||
package woodpecker
|
||||
|
||||
import (
|
||||
"bytes"
|
|
@ -1,4 +1,4 @@
|
|||
package drone
|
||||
package woodpecker
|
||||
|
||||
import (
|
||||
"fmt"
|
|
@ -1,4 +1,4 @@
|
|||
package drone
|
||||
package woodpecker
|
||||
|
||||
// Event values.
|
||||
const (
|
|
@ -1,4 +1,4 @@
|
|||
package drone
|
||||
package woodpecker
|
||||
|
||||
import "net/http"
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package drone
|
||||
package woodpecker
|
||||
|
||||
type (
|
||||
// User represents a user account.
|
Loading…
Reference in a new issue