Exemplo n.º 1
0
func deploy() error {
	raw, err := ioutil.ReadFile(*payload)
	if err != nil {
		return err
	}

	c := tugboat.NewClient(nil)
	c.URL = *url

	opts, err := tugboat.NewDeployOptsFromReader(bytes.NewReader(raw))
	if err != nil {
		return err
	}

	c.Deploy(context.Background(), opts, tugboat.ProviderFunc(perform))

	return nil
}
Exemplo n.º 2
0
func Example() {
	// First, you'll want to create a tugboat.Client and point it at a
	// tugboat server.
	c := tugboat.NewClient(nil)

	// Options should be parsed from the github webhook.
	opts := tugboat.DeployOpts{
		ID:          1,
		Sha:         "827fecd2d36ebeaa2fd05aa8ef3eed1e56a8cd57",
		Ref:         "master",
		Environment: "staging",
		Description: "Deploying to staging",
		Repo:        "remind101/acme-inc",
	}

	// Calling Deploy will perform the deployment and record the
	// logs.
	if _, err := c.Deploy(context.TODO(), opts, tugboat.ProviderFunc(deploy)); err != nil {
		log.Fatal(err)
	}
}