alm

package module
v2.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2020 License: BSD-3-Clause Imports: 18 Imported by: 0

README

image:https://godoc.org/gitlab.com/jhinrichsen/alm?status.svg["godoc", link="https://godoc.org/gitlab.com/jhinrichsen/alm"]
image:https://goreportcard.com/badge/gitlab.com/jhinrichsen/alm["Go report card", link="https://goreportcard.com/report/gitlab.com/jhinrichsen/alm"]
image:https://gitlab.com/jhinrichsen/alm/badges/master/coverage.svg?style=flat["coverage", link="https://gitlab.com/jhinrichsen/alm/-/jobs"]
image:https://golangci.com/badges/gitlab.com/jhinrichsen/alm.svg["Golang CI", link="https://golangci.com/r/gitlab.com/jhinrichsen/alm"]

= ALM
REST client for HP ALM

Supports updating defects for now.

= Installation

----
go get gitlab.com/jhinrichsen/alm
----

= Configuration

alm supports the following parameters:

- protocol (`http` or `https`)
- server (`alm.mycompany.com`)
- port
- context (`/qcbin`)
- username
- password
- domain (ALM domain)
- project (ALM project)


These values can be configurated in a file `${HOME}/.alm` in yaml format, via environment variables (uppercase, prepended by `ALM_`, or via commandline. This order is also the precedence.

= Updating defects

----
alm-defect 
----

Documentation

Index

Constants

View Source
const (
	// SignInURL according to ALM REST documentation
	SignInURL = "/api/authentication/sign-in"
	// SignOutURL according to ALM REST documentation
	SignOutURL = "/api/authentication/sign-out"
)

Variables

View Source
var (
	// ErrMissingTmt indicates a missing root entry /tmt
	ErrMissingTmt = errors.New("missing required element tmt")
	// ErrEmptyTmt indicates root entry /tmt exists, but has no embedded
	// information.
	ErrEmptyTmt = errors.New("empty tmt:, missing required elements")
	// ErrMissingDomain indicates absence of tmt/domain
	ErrMissingDomain = errors.New("missing required element /tmt/domain")
	// ErrMissingProject indicates absence of tmt/project
	ErrMissingProject = errors.New("missing required element /tmt/project")
)

A couple of parsing errors

Functions

func Client

func Client(insecure bool) *http.Client

Client returns a configured http client usable for ALM access.

func DefaultConfig

func DefaultConfig() (string, error)

DefaultConfig returns the fully qualified filename of the config file, i.e. `${HOME}/.alm.yaml`

func DefectsURI

func DefectsURI(domain, project string, defect int) string

DefectsURI returns the relative, constant REST API path for given defect.

func ReadEnv

func ReadEnv(prefix string, a *Instance)

ReadEnv updates members in an ALM instance with values from corresponding environment variables, useful for twelve-factor apps.

func ReleasesURI

func ReleasesURI(domain, project string, release string) string

ReleasesURI returns relative, constant REST API for given parameter set.

Types

type Defect

type Defect struct {
	ID      int    `json:"id"`
	Subject int    `json:"subject"`
	Status  string `json:"status"`
	Type    string `json:"type"`
}

Defect represents a subset of an ALM defect

func ParseDefect

func ParseDefect(buf []byte) (*Defect, error)

ParseDefect tries to convert bytes in JSON format into a Defect.

type DefectsResponse

type DefectsResponse struct {
	Defects []Defect `json:"results"`
}

DefectsResponse represents a REST api call request.

type Delivery

type Delivery struct {
	Tmt Tmt
}

Delivery represents an ALM domain model

type Domain

type Domain struct {
	Name string `json:"name"`
}

Domain represents ALM domain model

type DomainsResponse

type DomainsResponse struct {
	Domains []Domain `json:"results"`
}

DomainsResponse contains a list of all available domains in ALM.

type Instance

type Instance struct {
	Protocol string
	Server   string
	Port     int
	Context  string

	Username string
	Password string

	Domain  string
	Project string

	FromStatus, IntoStatus string

	Client http.Client
	Dryrun bool
}

Instance represents one remote service instance.

func Merge

func Merge(as ...Instance) (*Instance, error)

Merge multiple partly filled structs into one, precedence from the left to the right

func ReadCfg

func ReadCfg(filename string) (Instance, error)

ReadCfg reads the config file

func (*Instance) Defects

func (a *Instance) Defects(domain, project string) ([]Defect, error)

Defects issues a REST call to retrieve a list of defects for given parameter set.

func (*Instance) Domains

func (a *Instance) Domains() ([]Domain, error)

Domains issues a REST call to retrieve a list of all available ALM domains.

func (*Instance) GetDefect

func (a *Instance) GetDefect(defect int) (*Defect, error)

GetDefect issues a remote REST call for given defect

func (*Instance) GetRelease

func (a *Instance) GetRelease(ID string) (*Release, error)

GetRelease issues a REST call to retrieve a Release.

func (*Instance) NewReleases

func (a *Instance) NewReleases(releaseIDs []string) error

NewReleases logs existing releases to stdout.

func (*Instance) PutDefect

func (a *Instance) PutDefect(d Defect) (*Defect, error)

PutDefect issues a REST call to store a Defect.

func (*Instance) SignIn

func (a *Instance) SignIn() error

SignIn authenticates against ALM. https://admhelp.microfocus.com/alm/en/12.55/api_refs/REST/Content/REST_API/sign_in.htm

func (*Instance) SignOut

func (a *Instance) SignOut() error

SignOut logs off from ALM

func (*Instance) URL

func (a *Instance) URL(uri string) string

URL returns a relative, constant REST API URL into a specific instance one

func (*Instance) UpdateDefects

func (a *Instance) UpdateDefects(defects []string) error

UpdateDefects issues a REST call to update status of defects.

type Release

type Release struct {
	ID      int    `json:"id"`
	Subject int    `json:"subject"`
	Status  string `json:"status"`
	Type    string `json:"type"`
}

Release represents ALM domain model

func ParseRelease

func ParseRelease(buf []byte) (*Release, error)

ParseRelease tries to convert bytes in JSON format into a Release.

type Tmt

type Tmt struct {
	Domain  string
	Project string
	Defects []string
}

Tmt is a root ALM domain model.

func Parse

func Parse(in io.Reader) (Tmt, error)

Parse expects a standard YAML structure that contains fixed issues.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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