roer

package module
v0.0.0-...-e8571bd Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

README

roer

END OF LIFE: Roer has been EOL'd. Please use spin instead: https://github.com/spinnaker/spin

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 application:

$ 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

func AppCreateAction(clientConfig spinnaker.ClientConfig) cli.ActionFunc

AppCreateAction creates the ActionFunc for creating a spinnaker application

func AppDeleteAction

func AppDeleteAction(clientConfig spinnaker.ClientConfig) cli.ActionFunc

AppDeleteAction delete an application

func AppGetAction

func AppGetAction(clientConfig spinnaker.ClientConfig) cli.ActionFunc

AppGetAction creates the ActionFunc for fetching spinnaker application configuration

func AppListAction

func AppListAction(clientConfig spinnaker.ClientConfig) cli.ActionFunc

AppListAction creates the ActionFunc for listing applications

func PipelineDeleteAction

func PipelineDeleteAction(clientConfig spinnaker.ClientConfig) cli.ActionFunc

PipelineDeleteAction creates the ActionFunc for deleting a pipeline

func PipelineExecAction

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

func PipelineGetConfigAction(clientConfig spinnaker.ClientConfig) cli.ActionFunc

PipelineGetConfigAction creates the ActionFunc for fetching a pipeline config

func PipelineListConfigsAction

func PipelineListConfigsAction(clientConfig spinnaker.ClientConfig) cli.ActionFunc

PipelineListConfigsAction creates the ActionFunc for listing pipeline configs

func PipelineSaveAction

func PipelineSaveAction(clientConfig spinnaker.ClientConfig) cli.ActionFunc

PipelineSaveAction creates the ActionFunc for saving pipeline configurations.

func PipelineSaveJSONAction

func PipelineSaveJSONAction(clientConfig spinnaker.ClientConfig) cli.ActionFunc

PipelineSaveJSONAction creates the ActionFunc for saving a pipeline from json source

func PipelineTemplateConvertAction

func PipelineTemplateConvertAction(clientConfig spinnaker.ClientConfig) cli.ActionFunc

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

func PipelineTemplateDeleteAction

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

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

InheritanceControlRule inheritance control rule

type PipelineConfig

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

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

ToClient convert PipelineConfiguration to spinnaker.PipelineConfig

type PipelineConfigurationDefinition

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

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

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

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

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

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

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

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

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

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