roer

package module
v0.11.3 Latest Latest
Warning

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

Go to latest
Published: May 8, 2018 License: Apache-2.0 Imports: 12 Imported by: 3

README

roer

Note: A new, better CLI is on the way. This tool is in maintenance mode.

A thin CLI for Spinnaker.

This project is aimed to provide a thin, limited client that's suitable for CI environments where you may want to publish Pipeline Templates or update pipeline configurations in Spinnaker. For a CLI to help configure and operate use halyard: config & operating utilities are not in Roer's scope.

You can download the most recent version from the Releases tab.

Usage

Make sure your Spinnaker installation has pipeline-templates enabled:

hal config features edit --pipeline-templates true

Export SPINNAKER_API pointing to your Gate API.

NAME:
   roer - Spinnaker CLI

USAGE:
   main [global options] command [command options] [arguments...]

VERSION:
   dev

COMMANDS:
     pipeline           pipeline tasks
     pipeline-template  pipeline template tasks
     help, h            Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --verbose, -v               show debug messages
   --certPath value, -c value  HTTPS x509 cert path
   --keyPath value, -k value   HTTPS x509 key path
   --version                   print the version

Commands

pipeline-template

NAME:
   roer pipeline-template - pipeline template tasks

USAGE:
   roer pipeline-template  command [command options] [arguments...]

VERSION:
   dev

COMMANDS:
     publish  publish a pipeline template
     plan     validate a pipeline template and or plan a configuration
     convert  converts an existing, non-templated pipeline config into a scaffolded template

Publish template for use:

$ SPINNAKER_API=https://localhost:7002 \
  go run cmd/roer/main.go pipeline-template publish examples/wait-template.yml

Plan a pipeline run using the template (invalid config example):

$ SPINNAKER_API=https://localhost:7002 \
  go run cmd/roer/main.go pipeline-template plan examples/wait-config-invalid.yml
{
  "errors": [
    {
      "location": "configuration:stages.noConfigStanza",
      "message": "Stage configuration is unset",
      "severity": "FATAL"
    },
    {
      "location": "configuration:stages.noConfigStanza",
      "message": "A configuration-defined stage should have either dependsOn or an inject rule defined",
      "severity": "WARN"
    }
  ],
  "message": "Pipeline template is invalid",
  "status": "BAD_REQUEST"
}

Plan a pipeline run using the template (valid config example):

$ SPINNAKER_API=https://localhost:7002 \
  go run cmd/roer/main.go pipeline-template plan examples/wait-config.yml
{
  "application": "spintest",
  "id": "unknown",
  "keepWaitingPipelines": false,
  "limitConcurrent": true,
  "name": "mpt",
  "notifications": [],
  "parameterConfig": [],
  "stages": [
    {
      "id": "947eb68b-1b03-4f33-b7c2-b3fa38eeef94",
      "name": "wait",
      "refId": "wait",
      "requisiteStageRefIds": [],
      "type": "wait",
      "waitTime": 5
    }
  ],
  "trigger": {
    "parameters": {},
    "type": "manual",
    "user": "anonymous"
  }
}

pipeline

Create or update a managed pipeline within an applicaiton:

$ SPINNAKER_API=https://localhost:7002 \
  go run cmd/roer/main.go pipeline save examples/wait-config.yml

Development

All dependencies have been vendored into the repository and are managed via govendor. You can sync the deps with govendor sync.

$ go run cmd/roer/main.go

Extending

You can extend the interface, as well as inject your own HTTP client by providing your own main.go. This can be useful if you need to provide custom auth logic, or if you want to add new commands, but not contribute them directly to the project.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppCreateAction added in v0.7.0

func AppCreateAction(clientConfig spinnaker.ClientConfig) cli.ActionFunc

AppCreateAction creates the ActionFunc for creating a spinnaker application

func AppDeleteAction added in v0.10.0

func AppDeleteAction(clientConfig spinnaker.ClientConfig) cli.ActionFunc

AppDeleteAction delete an application

func AppGetAction added in v0.7.0

func AppGetAction(clientConfig spinnaker.ClientConfig) cli.ActionFunc

AppGetAction creates the ActionFunc for fetching spinnaker application configuration

func AppListAction added in v0.7.0

func AppListAction(clientConfig spinnaker.ClientConfig) cli.ActionFunc

AppListAction creates the ActionFunc for listing applications

func PipelineDeleteAction added in v0.7.0

func PipelineDeleteAction(clientConfig spinnaker.ClientConfig) cli.ActionFunc

PipelineDeleteAction creates the ActionFunc for deleting a pipeline

func PipelineExecAction added in v0.11.0

func PipelineExecAction(clientConfig spinnaker.ClientConfig) cli.ActionFunc

PipelineExecAction requests a pipeline execution and optionally waits for it to complete. Arguments are the name of the app and the name of the pipeline to start.

func PipelineGetConfigAction added in v0.8.0

func PipelineGetConfigAction(clientConfig spinnaker.ClientConfig) cli.ActionFunc

PipelineGetConfigAction creates the ActionFunc for fetching a pipeline config

func PipelineListConfigsAction added in v0.8.0

func PipelineListConfigsAction(clientConfig spinnaker.ClientConfig) cli.ActionFunc

PipelineListConfigsAction creates the ActionFunc for listing pipeline configs

func PipelineSaveAction added in v0.2.0

func PipelineSaveAction(clientConfig spinnaker.ClientConfig) cli.ActionFunc

PipelineSaveAction creates the ActionFunc for saving pipeline configurations.

func PipelineSaveJSONAction added in v0.10.0

func PipelineSaveJSONAction(clientConfig spinnaker.ClientConfig) cli.ActionFunc

PipelineSaveJSONAction creates the ActionFunc for saving a pipeline from json source

func PipelineTemplateConvertAction added in v0.2.0

func PipelineTemplateConvertAction(clientConfig spinnaker.ClientConfig) cli.ActionFunc

PipelineTemplateConvertAction creates the ActionFunc for converting an existing pipeline into a pipeline template

func PipelineTemplateDeleteAction added in v0.4.0

func PipelineTemplateDeleteAction(clientConfig spinnaker.ClientConfig) cli.ActionFunc

PipelineTemplateDeleteAction creates the ActionFunc for deleting a pipeline template

func PipelineTemplatePlanAction

func PipelineTemplatePlanAction(clientConfig spinnaker.ClientConfig) cli.ActionFunc

PipelineTemplatePlanAction creates the ActionFunc for planning a pipeline template with a given configuration.

func PipelineTemplatePublishAction

func PipelineTemplatePublishAction(clientConfig spinnaker.ClientConfig) cli.ActionFunc

PipelineTemplatePublishAction creates the ActionFunc for publishing pipeline templates.

Types

type InheritanceControlRule added in v0.4.2

type InheritanceControlRule struct {
	Path  string      `json:"path"`
	Value interface{} `json:"value"`
}

InheritanceControlRule inheritance control rule

type PipelineConfig added in v0.2.0

type PipelineConfig struct {
	Inherit              []string        `json:"inherit"`
	ConcurrentExecutions map[string]bool `json:"concurrentExecutions"`
	Triggers             []interface{}   `json:"triggers"`
	ExpectedArtifacts    []interface{}   `json:"expectedArtifacts"`
	Parameters           []interface{}   `json:"parameters"`
	Notifications        []interface{}   `json:"notifications"`
	Description          string          `json:"description"`
}

PipelineConfig pipeline config

type PipelineConfiguration added in v0.2.0

type PipelineConfiguration struct {
	Schema        string                          `json:"schema"`
	ID            string                          `json:"id"`
	Pipeline      PipelineConfigurationDefinition `json:"pipeline"`
	Configuration PipelineConfig                  `json:"configuration"`
	Stages        []PipelineTemplateStage         `json:"stages"`
	Modules       []PipelineTemplateModule        `json:"modules,omitempty"`
	Partials      []PipelineTemplatePartial       `json:"partials,omitempty"`
}

PipelineConfiguration pipeline configuration

func (PipelineConfiguration) ToClient added in v0.2.0

ToClient convert PipelineConfiguration to spinnaker.PipelineConfig

type PipelineConfigurationDefinition added in v0.2.0

type PipelineConfigurationDefinition struct {
	Application      string                 `json:"application"`
	Name             string                 `json:"name"`
	Template         TemplateSource         `json:"template"`
	PipelineConfigID string                 `json:"pipelineConfigId"`
	Variables        map[string]interface{} `json:"variables"`
}

PipelineConfigurationDefinition pipline config definition

type PipelineTemplate added in v0.2.0

type PipelineTemplate struct {
	Schema        string                   `json:"schema"`
	ID            string                   `json:"id"`
	Metadata      PipelineTemplateMetadata `json:"metadata"`
	Protect       bool                     `json:"protect"`
	Configuration PipelineTemplateConfig   `json:"configuration,omitempty"`
	Variables     []interface{}            `json:"variables,omitempty"`
	Stages        []PipelineTemplateStage  `json:"stages"`
}

PipelineTemplate is a pipeline template

type PipelineTemplateConfig added in v0.2.0

type PipelineTemplateConfig struct {
	ConcurrentExecutions map[string]bool          `json:"concurrentExecutions,omitempty"`
	Triggers             []map[string]interface{} `json:"triggers,omitempty"`
	ExpectedArtifacts    []map[string]interface{} `json:"expectedArtifacts,omitempty"`
	Parameters           []map[string]interface{} `json:"parameters,omitempty"`
	Notifications        []map[string]interface{} `json:"notifications,omitempty"`
}

PipelineTemplateConfig pipeline template config

type PipelineTemplateMetadata added in v0.2.0

type PipelineTemplateMetadata struct {
	Name        string   `json:"name"`
	Description string   `json:"description"`
	Owner       string   `json:"owner"`
	Scopes      []string `json:"scopes,omitempty"`
}

PipelineTemplateMetadata metadata for a template

type PipelineTemplateModule added in v0.2.0

type PipelineTemplateModule struct {
	ID         string                   `json:"id"`
	Usage      string                   `json:"usage"`
	Variables  []map[string]interface{} `json:"variables,omitempty"`
	When       []string                 `json:"when,omitempty"`
	Definition map[string]interface{}   `json:"definition"`
}

PipelineTemplateModule pipeline template module

type PipelineTemplatePartial added in v0.2.0

type PipelineTemplatePartial struct {
	ID        string                   `json:"id"`
	Usage     string                   `json:"usage"`
	Variables []map[string]interface{} `json:"variables,omitempty"`
	Stages    []PipelineTemplateStage  `json:"stages"`
}

PipelineTemplatePartial pipeline template partial

type PipelineTemplateStage added in v0.2.0

type PipelineTemplateStage struct {
	ID                 string                                  `json:"id"`
	Type               string                                  `json:"type"`
	DependsOn          []string                                `json:"dependsOn,omitempty"`
	Inject             PipelineTemplateStageInjection          `json:"inject,omitempty"`
	Name               string                                  `json:"name"`
	Config             map[string]interface{}                  `json:"config"`
	Notifications      []map[string]interface{}                `json:"notifications,omitempty"`
	Comments           string                                  `json:"comments,omitempty"`
	When               []string                                `json:"when,omitempty"`
	InheritanceControl PipelineTemplateStageInheritanceControl `json:"inheritanceControl,omitempty"`
}

PipelineTemplateStage a pipeline template stage

type PipelineTemplateStageInheritanceControl added in v0.4.2

type PipelineTemplateStageInheritanceControl struct {
	Merge   []InheritanceControlRule `json:"merge,omitempty"`
	Replace []InheritanceControlRule `json:"replace,omitempty"`
	Remove  []InheritanceControlRule `json:"remove,omitempty"`
}

PipelineTemplateStageInheritanceControl pipeline template stage inheritance control

type PipelineTemplateStageInjection added in v0.4.2

type PipelineTemplateStageInjection struct {
	First  bool     `json:"first,omitempty"`
	Last   bool     `json:"last,omitempty"`
	Before []string `json:"before,omitempty"`
	After  []string `json:"after,omitempty"`
}

PipelineTemplateStageInjection is a pipeline template stage injection

type TemplateSource added in v0.2.0

type TemplateSource struct {
	Source string `json:"source"`
}

TemplateSource template source

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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