go-sdk

module
v1.3.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 29, 2024 License: Apache-2.0

README

Codefresh SDK for Golang

Codefresh build status GoDoc Go Report Card

Start

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

import (
    "fmt"
    "os"

    "github.com/codefresh-io/go-sdk/pkg/utils"
    "github.com/codefresh-io/go-sdk/pkg"
)

func main() {
    path := fmt.Sprintf("%s/.cfconfig", os.Getenv("HOME"))
    options, err := utils.ReadAuthContext(path, "")
    if err != nil {
        fmt.Println("Failed to read codefresh config file")
        panic(err)
    }
    clientOptions := codefresh.ClientOptions{Host: options.URL,
        Auth: codefresh.AuthOptions{Token: options.Token}}
    cf := codefresh.New(&clientOptions)
    pipelines, err := cf.Pipelines().List()
    if err != nil {
        fmt.Println("Failed to get Pipelines from Codefresh API")
        panic(err)
    }
    for _, p := range pipelines {
        fmt.Printf("Pipeline: %+v\n\n", p)
    }
}

This is not an official Codefresh project.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL