go-utils

module
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2019 License: Apache-2.0

README

Keptn go-utils

Build Status GitHub release (latest by date) Go Report Card

This repo serves as a util package for common functionalities such as logging of the Keptn Project.

Please post any issues with this package to the keptn/keptn repository and label them with area:go-utils.

Installation

Get the latest version using

go get github.com/keptn/go-utils

Also consider browsing our Releases Page to find out about all releases.

Usage

Below we have listed some basic examples. You can find more information about the usage within the docs/ folder.

Utils

If you need to access several utility functions:

import {
  keptnutils "github.com/keptn/go-utils/pkg/utils"
}

Logging Example:

keptnutils.Debug(keptncontext, message)
keptnutils.Info(keptncontext, message)
keptnutils.Error(keptncontext, message)
CloudEvent Data

If you need to access data within CloudEvents:

import {
	keptnevents "github.com/keptn/go-utils/pkg/events"
)

Example:

func parseCloudEvent(event cloudevents.Event) (keptnevents.TestFinishedEventData, error) {
	eventData := &keptnevents.TestsFinishedEventData{}
	err := event.DataAs(eventData)
    
    return eventData, err
}
Models

If you need to access Models for YAML files:

import {
	keptnmodels "github.com/keptn/go-utils/pkg/models"
)

Jump to

Keyboard shortcuts

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