项目作者: codefresh-io

项目描述 :
Codefresh SDK for Golang
高级语言: Go
项目地址: git://github.com/codefresh-io/go-sdk.git
创建时间: 2018-12-28T15:27:29Z
项目社区:https://github.com/codefresh-io/go-sdk

开源协议:Apache License 2.0

下载


Codefresh SDK for Golang

Codefresh build status
GoDoc
Go Report Card

Start

go get -u github.com/codefresh-io/go-sdk

  1. import (
  2. "fmt"
  3. "os"
  4. "github.com/codefresh-io/go-sdk/pkg/utils"
  5. "github.com/codefresh-io/go-sdk/pkg"
  6. )
  7. func main() {
  8. path := fmt.Sprintf("%s/.cfconfig", os.Getenv("HOME"))
  9. options, err := utils.ReadAuthContext(path, "")
  10. if err != nil {
  11. fmt.Println("Failed to read codefresh config file")
  12. panic(err)
  13. }
  14. clientOptions := codefresh.ClientOptions{Host: options.URL,
  15. Auth: codefresh.AuthOptions{Token: options.Token}}
  16. cf := codefresh.New(&clientOptions)
  17. pipelines, err := cf.Pipelines().List()
  18. if err != nil {
  19. fmt.Println("Failed to get Pipelines from Codefresh API")
  20. panic(err)
  21. }
  22. for _, p := range pipelines {
  23. fmt.Printf("Pipeline: %+v\n\n", p)
  24. }
  25. }

This is not an official Codefresh project.