resource

package module
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2021 License: Apache-2.0 Imports: 2 Imported by: 0

README

Tanzu Observability Event Resource

A concourse resource to send pipeline events to VMware Tanzu Observability by Wavefront

Source Configuration

  • tenant_url: The URL to your tenant, for example https://longboard.wavefront.com
  • api_token: A REST API token. More information on generating an API token here

Behavior

check: No-op

Currently, this resource does not support monitoring for new events.

in: Fetch information about an event

Fetches the given event, and creates the following files:

  • id: contains the event's ID
  • event.json: represents the event object as returned by the API

Note: Because this resource does not support monitoring, the in script is really only used in a get-after-put context. It is used to pass the event between jobs in a pipeline so that it may be started in one job and ended in a subsequent job.

out: Start or end an event

Depending on the action parameter, out will either create a new event with a running state of ONGOING, or close an event with the given ID.

Parameters
  • action: Required. One of create, start, or end.

  • event: Required if action is end, ignored if action is start or create. The path to a previous event's get step, containing its id file.

  • event_name: Required if action is start or create, ignored if action is end. The name of the event to be created

  • annotations: Optional. A map of key-value pairs that will be added as annotations to the event. Values MUST be strings. In addition to any annotations specified here, the following annotations will be added:

    concourse-team: ${BUILD_TEAM_NAME}
    concourse-pipeline: ${BUILD_PIPELINE_NAME}
    concourse-job: ${BUILD_JOB_NAME}
    concourse-build-url: ${ATC_EXTERNAL_URL}/builds/${BUILD_ID}
    

    Learn more about environment variables available to the resource type here

    If you do not want one of those annotations on your event, add it as a custom annotation with a value of "".

    If annotations are set on a put with action == "end", those annotations will be added or updated on the original event. This is useful, for example, for changing the severity annotation from INFO to FAILED, or something similar.

  • tags: Optional, ignored if action is end. A list of strings to be added as tags on the event.

Note: event_name, annotations, and tags support very simple variable interpolation. For the list of allowed variables, see here and for a list of substitution patterns, see here.

Example

resource_types:
- name: observability-events
  type: registry-image
  source:
    repository: projects.registry.vmware.com/tanzu/observability-event-resource
    tag: "1"

resources:
- name: observability
  type: observability-events
  source:
    tenant_url: https://longboard.wavefront.com
    api_token: ((my-secret-wavefront-token))

jobs:
- name: start-event
  plan:
  - put: observability
    params:
      action: start
      event_name: Pipeline Started
      tags: ["${BUILD_PIPELINE_NAME}"]
      annotations:
        severity: INFO
- name: do-a-thing
  plan:
  - get: observability
    passed: [start-event]
    trigger: true
  - task: do-some-stuff
    config: ...
- name: end-event
  plan:
  - get: observability
    passed: [do-a-thing]
    trigger: true
  - put: observability
    params:
      action: end
      event: observability
      annotations:
        severity: SUCCESS

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AppVersion = "0.0.0-dev"

AppVersion will be specified by the build

View Source
var ErrMissingWavefrontToken = errors.New("wavefront token is missing")

ErrMissingWavefrontToken will be emitted or wrapped when the source is missing the wavefront token

View Source
var ErrMissingWavefrontURL = errors.New("wavefront url is missing")

ErrMissingWavefrontURL will be emitted or wrapped when the source is missing the wavefront URL

Functions

This section is empty.

Types

type Metadata

type Metadata []Metadatum

Metadata is a slice of Metadatum

type Metadatum

type Metadatum struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

Metadatum is a key value pair

type Source

type Source struct {
	WavefrontURL   string `json:"tenant_url"`
	WavefrontToken string `json:"api_token"`
	Debug          bool   `json:"debug"`
}

Source is what is configured for the concourse resource

resources:
- name: events
  type: wavefront
  source:
	tenant_url: http://<mywavefronttenant>.wavefront.com
	api_token: ((my-secret-token))

func (Source) Validate

func (s Source) Validate() error

Validate ensures that the source's required properties are set

type Version

type Version struct {
	ID string `json:"id"`
}

Version is used by the in and out script and represents an event's ID

Directories

Path Synopsis
cmd
in
out
internal

Jump to

Keyboard shortcuts

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