1. circleci/spinnaker@0.3.2

circleci/spinnaker@0.3.2

Certified
Sections
This orb is no longer supported by CircleCI because of limited or no use. If you would like to use this orb or create your own version feel free to fork the repository and use the following https://circleci.com/blog/building-private-orbs/ as a guide to making this orb into a private orb for your own use. An orb to simplify deployments with Spinnaker. Repo: https://github.com/CircleCI-Public/spinnaker-orb
Created: July 31, 2019Version Published: June 25, 2024Releases: 5
Org Usage:
< 25

Orb Quick Start Guide

Use CircleCI version 2.1 at the top of your .circleci/config.yml file.

1 version: 2.1

Add the orbs stanza below your version, invoking the orb:

1 2 orbs: spinnaker: circleci/spinnaker@0.3.2

Use spinnaker elements in your existing workflows and jobs.

Usage Examples

trigger-pipeline-with-webhook

Trigger a Spinnaker application pipeline by sending a request to a preconfigured webhook endpoint.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 version: '2.1' orbs: aws-eks: circleci/aws-eks@0.2.0 spinnaker: circleci/spinnaker@x.y.z jobs: send-webhook: executor: spinnaker/default-stretch parameters: aws-region: description: | AWS region that the EKS cluster is in type: string cluster-name: description: | Name of the EKS cluster type: string steps: - aws-eks/update-kubeconfig-with-authenticator: aws-region: << parameters.aws-region >> cluster-name: << parameters.cluster-name >> install-kubectl: true - spinnaker/set-up-port-forwarding: namespace: spinnaker wait: true - spinnaker/trigger-pipeline-with-webhook: payload: >- {\"status\": \"success\", \"jobid\": \"$CIRCLE_WORKFLOW_JOB_ID\", \"message\": \"I've got it\"} webhook-endpoint: SPINNAKER_WEBHOOK workflows: example-workflow: jobs: - send-webhook: aws-region: ap-southeast-2 cluster-name: my-eks-tests

Commands

install-spin

Installs the spin CLI and optionally sets up the configuration directory. Currently this command only supports installation on Linux.

Show command Source
PARAMETER
DESCRIPTION
REQUIRED
DEFAULT
TYPE
configure-spin
Create a configuration for spin in the user's home directory. Either "spin-config-path" or "generate-config" should be enabled if the configure-spin parameter is set to true.
No
false
boolean
generate-config
Generates a spin config with authentication disabled and for connection to a local Gate endpoint at the default port. Either "spin-config-path" or "generate-config" should be enabled if the configure-spin parameter is set to true. This parameter is ineffective when "spin-config-path" is set to a non-default value.
No
false
boolean
spin-config-path
Path to config file to be copied to spin's config directory. Either "spin-config-path" or "generate-config" should be enabled if the configure-spin parameter is set to true. Takes precedence over "generate-config".
No
''
string

set-up-port-forwarding

Set up port forwarding for the Deck (Spinnaker UI) and Gate (Spinnaker API Gateway) pods in a Kubernetes-based Spinnaker installation. Port forwarding will be run as a background step for each pod, which means that the background steps will run concurrently with the next step(s) in the configuration, unless the "wait" parameter is set to true. Note: requires kubectl to be configured to connect to the kubernetes cluster.

Show command Source
PARAMETER
DESCRIPTION
REQUIRED
DEFAULT
TYPE
deck-protocol
The protocol used for port forwarding to the Deck pod. This is only effective when the "wait" parameter is enabled.
No
http
enum
deck-source-port
Specify the local port number in the Deck (Spinnaker UI) pod that port forwarding will be set up for. The default value of -1 will cause the default local port number for the Deck pod in a Spinnaker installation to be used.
No
-1
integer
deck-target-port
Specify the target port number for port forwarding to the Deck pod. The default value of -1 will cause the same port number to be used as the default local port number for the Deck pod in a Spinnaker installation.
No
-1
integer
gate-protocol
The protocol used for port forwarding to the Gate pod. This is only effective when the "wait" parameter is enabled.
No
http
enum
gate-source-port
Specify the local port number in the Gate (Spinnaker API Gateway) pod that port forwarding will be set up for. The default value of -1 will cause the default local port number for the Deck pod in a Spinnaker installation to be used.
No
-1
integer
gate-target-port
Specify the target port number for port forwarding to the Gate pod. The default value of -1 will cause the same port number to be used as the default local port number for the Deck pod in a Spinnaker installation.
No
-1
integer
namespace
The kubernetes namespace in which Spinnaker was installed.
Yes
-
string
wait
Whether to wait for port forwarding setup completion.
Yes
-
boolean

trigger-pipeline-with-webhook

Triggers an application's pipeline in Spinnaker by invoking a webhook which must be pre-configured in Spinnaker.

Show command Source
PARAMETER
DESCRIPTION
REQUIRED
DEFAULT
TYPE
payload
JSON payload. Escaping of double quotes in the payload is required; please check this parameter's description for instructions. If the parameter is surrounded with double quotes, the double quotes in the payload need to be escaped like in the following example. e.g. "{\\\"mystatus\\\": \\\"success\\\", \\\"mybuild\\\": \\\"$CIRCLE_BUILD_NUM\\\", \\\"mymessage\\\": \\\"I've got it\\\"}" If the parameter is surrounded with single quotes, the double quotes in the payload need to be escaped like in the following example, and single quotes will also need to be escaped. e.g. '{\"mystatus\": \"success\", \"mybuild\": \"$CIRCLE_BUILD_NUM\", \"mymessage\": \"It\u0027s possible\"}'
Yes
-
string
webhook-endpoint
Name of environment variable defined in CircleCI containing the webhook endpoint URL pre-configured in Spinnaker Example of value: http://localhost:8084/webhooks/webhook/myappwebhook
No
SPINNAKER_WEBHOOK
env_var_name

Executors

default-stretch

This is a default executor that is based on Debian Stretch and has Python 3 installed.

Show executor Source
PARAMETER
DESCRIPTION
REQUIRED
DEFAULT
TYPE
tag
Pick a specific circleci/python image variant: https://hub.docker.com/r/circleci/python/tags
No
3-stretch
string

Orb Source

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 # This code is licensed from CircleCI to the user under the MIT license. # See here for details: https://circleci.com/developer/orbs/licensing version: 2.1 description: "This orb is no longer supported by CircleCI \nbecause of limited or no use. If you would like \nto use this orb or create your own version feel \nfree to fork the repository and use the following \nhttps://circleci.com/blog/building-private-orbs/ \nas a guide to making this orb into a private orb \nfor your own use. \nAn orb to simplify deployments with Spinnaker.\nRepo: https://github.com/CircleCI-Public/spinnaker-orb\n" orbs: docker: circleci/docker@0.5.13 commands: install-spin: description: | Installs the spin CLI and optionally sets up the configuration directory. Currently this command only supports installation on Linux. parameters: configure-spin: default: false description: | Create a configuration for spin in the user's home directory. Either "spin-config-path" or "generate-config" should be enabled if the configure-spin parameter is set to true. type: boolean generate-config: default: false description: | Generates a spin config with authentication disabled and for connection to a local Gate endpoint at the default port. Either "spin-config-path" or "generate-config" should be enabled if the configure-spin parameter is set to true. This parameter is ineffective when "spin-config-path" is set to a non-default value. type: boolean spin-config-path: default: "" description: | Path to config file to be copied to spin's config directory. Either "spin-config-path" or "generate-config" should be enabled if the configure-spin parameter is set to true. Takes precedence over "generate-config". type: string steps: - run: command: | CONFIGURE_SPIN="<< parameters.configure-spin >>" SPIN_CONFIG_PATH="<< parameters.spin-config-path >>" GENERATE_CONFIG="<< parameters.generate-config >>" if which spin > /dev/null; then echo "spin is already installed" exit 0 fi curl --retry 5 -LO https://storage.googleapis.com/spinnaker-artifacts/spin/$(curl -s https://storage.googleapis.com/spinnaker-artifacts/spin/latest)/linux/amd64/spin chmod +x spin SUDO="" if [ $(id -u) -ne 0 ] && which sudo > /dev/null ; then SUDO="sudo" fi $SUDO mv spin /usr/local/bin/spin echo "Checking version of spin installed.." spin --version # Only used if generate-config is effective GENERATED_SPIN_CONFIG=$(mktemp generated_spin_config.XXXXXX) cat \<<EOF > ${GENERATED_SPIN_CONFIG} gate: endpoint: http://localhost:8084 auth: enabled: false EOF if [ "${CONFIGURE_SPIN}" == "true" ]; then SPIN_CONFIG_DIR="~/.spin" echo "Initializing spin configuration directory at ${SPIN_CONFIG_DIR}" mkdir -p ${SPIN_CONFIG_DIR} if [ -n "${SPIN_CONFIG_PATH}" ]; then echo "Copying spin config from ${SPIN_CONFIG_PATH} to ${SPIN_CONFIG_DIR}" cp ${SPIN_CONFIG_PATH} ${SPIN_CONFIG_DIR}/config elif [ "${GENERATE_CONFIG}" == "true" ]; then echo "Generating spin config with authentication disabled" cp ${GENERATED_SPIN_CONFIG} ${SPIN_CONFIG_DIR}/config echo "Generated config:" cat ${SPIN_CONFIG_DIR}/config else echo "Unable to configure spin; neither the spin-config-path "\ "nor the generate-spin-config parameters were configured." exit 1 fi fi name: Install spin set-up-port-forwarding: description: | Set up port forwarding for the Deck (Spinnaker UI) and Gate (Spinnaker API Gateway) pods in a Kubernetes-based Spinnaker installation. Port forwarding will be run as a background step for each pod, which means that the background steps will run concurrently with the next step(s) in the configuration, unless the "wait" parameter is set to true. Note: requires kubectl to be configured to connect to the kubernetes cluster. parameters: deck-protocol: default: http description: | The protocol used for port forwarding to the Deck pod. This is only effective when the "wait" parameter is enabled. enum: - http - https type: enum deck-source-port: default: -1 description: | Specify the local port number in the Deck (Spinnaker UI) pod that port forwarding will be set up for. The default value of -1 will cause the default local port number for the Deck pod in a Spinnaker installation to be used. type: integer deck-target-port: default: -1 description: | Specify the target port number for port forwarding to the Deck pod. The default value of -1 will cause the same port number to be used as the default local port number for the Deck pod in a Spinnaker installation. type: integer gate-protocol: default: http description: | The protocol used for port forwarding to the Gate pod. This is only effective when the "wait" parameter is enabled. enum: - http - https type: enum gate-source-port: default: -1 description: | Specify the local port number in the Gate (Spinnaker API Gateway) pod that port forwarding will be set up for. The default value of -1 will cause the default local port number for the Deck pod in a Spinnaker installation to be used. type: integer gate-target-port: default: -1 description: | Specify the target port number for port forwarding to the Gate pod. The default value of -1 will cause the same port number to be used as the default local port number for the Deck pod in a Spinnaker installation. type: integer namespace: description: | The kubernetes namespace in which Spinnaker was installed. type: string wait: description: | Whether to wait for port forwarding setup completion. type: boolean steps: - run: background: true command: | POD="deck" DEFAULT_SOURCE_PORT=9000 DEFAULT_TARGET_PORT=9000 SOURCE_PORT="<< parameters.deck-source-port >>" TARGET_PORT="<< parameters.deck-target-port >>" NAMESPACE="<< parameters.namespace >>" # Look up pod POD_NAME=$(kubectl get pods \ --selector=app.kubernetes.io/name=${POD},app.kubernetes.io/part-of=spinnaker \ --namespace ${NAMESPACE} \ --output=jsonpath={.items[0].metadata.name}) GET_PODS_EXIT_CODE=$? if [ -n "${POD_NAME}" ] && [ "${GET_PODS_EXIT_CODE}" == "0" ]; then echo "Pod name found: ${POD_NAME}" else echo "Result: ${POD_NAME}" echo "Exit code of kubectl get pods command for ${POD}: ${GET_PODS_EXIT_CODE}." echo "Could not look up name of ${POD} pod. Please check if "\ "kubectl is installed and able to connect to the cluster in which Spinnaker is installed." exit 1 fi if [ "${SOURCE_PORT}" == "-1" ]; then SOURCE_PORT="${DEFAULT_SOURCE_PORT}" fi if [ "${TARGET_PORT}" == "-1" ]; then TARGET_PORT="${DEFAULT_TARGET_PORT}" fi kubectl --namespace ${NAMESPACE} port-forward ${POD_NAME} ${SOURCE_PORT}:${TARGET_PORT} name: Set up port forwarding for the Spinnaker Deck pod - run: background: true command: | POD="gate" DEFAULT_SOURCE_PORT="8084" DEFAULT_TARGET_PORT="8084" SOURCE_PORT="<< parameters.gate-source-port >>" TARGET_PORT="<< parameters.gate-target-port >>" NAMESPACE="<< parameters.namespace >>" # Look up pod POD_NAME=$(kubectl get pods \ --selector=app.kubernetes.io/name=${POD},app.kubernetes.io/part-of=spinnaker \ --namespace ${NAMESPACE} \ --output=jsonpath={.items[0].metadata.name}) GET_PODS_EXIT_CODE=$? if [ -n "${POD_NAME}" ] && [ "${GET_PODS_EXIT_CODE}" == "0" ]; then echo "Pod name found: ${POD_NAME}" else echo "Result: ${POD_NAME}" echo "Exit code of kubectl get pods command for ${POD}: ${GET_PODS_EXIT_CODE}." echo "Could not look up name of ${POD} pod. Please check if "\ "kubectl is installed and able to connect to the cluster in which Spinnaker is installed." exit 1 fi if [ "${SOURCE_PORT}" == "-1" ]; then SOURCE_PORT="${DEFAULT_SOURCE_PORT}" fi if [ "${TARGET_PORT}" == "-1" ]; then TARGET_PORT="${DEFAULT_TARGET_PORT}" fi kubectl --namespace ${NAMESPACE} port-forward ${POD_NAME} ${SOURCE_PORT}:${TARGET_PORT} name: Set up port forwarding for the Spinnaker Gate pod - when: condition: << parameters.wait >> steps: - docker/install-dockerize - run: command: | DECK_TARGET_PORT="<< parameters.deck-target-port >>" DECK_PROTOCOL="<< parameters.deck-protocol >>" GATE_TARGET_PORT="<< parameters.gate-target-port >>" GATE_PROTOCOL="<< parameters.gate-protocol >>" DECK_DEFAULT_TARGET_PORT="9000" GATE_DEFAULT_TARGET_PORT="8084" if [ "${DECK_TARGET_PORT}" == "-1" ]; then DECK_TARGET_PORT="${DECK_DEFAULT_TARGET_PORT}" fi if [ "${GATE_TARGET_PORT}" == "-1" ]; then GATE_TARGET_PORT="${GATE_DEFAULT_TARGET_PORT}" fi dockerize -timeout 60s \ -wait ${DECK_PROTOCOL}://localhost:${DECK_TARGET_PORT} \ -wait ${GATE_PROTOCOL}://localhost:${GATE_TARGET_PORT}/health name: Wait for port forwarding setup completion trigger-pipeline-with-webhook: description: | Triggers an application's pipeline in Spinnaker by invoking a webhook which must be pre-configured in Spinnaker. parameters: payload: description: | JSON payload. Escaping of double quotes in the payload is required; please check this parameter's description for instructions. If the parameter is surrounded with double quotes, the double quotes in the payload need to be escaped like in the following example. e.g. "{\\\"mystatus\\\": \\\"success\\\", \\\"mybuild\\\": \\\"$CIRCLE_BUILD_NUM\\\", \\\"mymessage\\\": \\\"I've got it\\\"}" If the parameter is surrounded with single quotes, the double quotes in the payload need to be escaped like in the following example, and single quotes will also need to be escaped. e.g. '{\"mystatus\": \"success\", \"mybuild\": \"$CIRCLE_BUILD_NUM\", \"mymessage\": \"It\u0027s possible\"}' type: string webhook-endpoint: default: SPINNAKER_WEBHOOK description: | Name of environment variable defined in CircleCI containing the webhook endpoint URL pre-configured in Spinnaker Example of value: http://localhost:8084/webhooks/webhook/myappwebhook type: env_var_name steps: - run: command: | if [ -z "<< parameters.webhook-endpoint >>" ]; then echo "No webhook endpoint url set" echo "Please input your SPINNAKER_WEBHOOK value in the CircleCI settings for this project or as a parameter for this orb." exit 1 else curl -X POST -H "content-type: application/json" -d "<< parameters.payload >>" ${<< parameters.webhook-endpoint >>} fi name: Trigger Spinnaker pipeline with webhook executors: default-stretch: description: | This is a default executor that is based on Debian Stretch and has Python 3 installed. docker: - image: circleci/python:<<parameters.tag>> parameters: tag: default: 3-stretch description: | Pick a specific circleci/python image variant: https://hub.docker.com/r/circleci/python/tags type: string examples: trigger-pipeline-with-webhook: description: | Trigger a Spinnaker application pipeline by sending a request to a preconfigured webhook endpoint. usage: version: "2.1" orbs: aws-eks: circleci/aws-eks@0.2.0 spinnaker: circleci/spinnaker@x.y.z jobs: send-webhook: executor: spinnaker/default-stretch parameters: aws-region: description: | AWS region that the EKS cluster is in type: string cluster-name: description: | Name of the EKS cluster type: string steps: - aws-eks/update-kubeconfig-with-authenticator: aws-region: << parameters.aws-region >> cluster-name: << parameters.cluster-name >> install-kubectl: true - spinnaker/set-up-port-forwarding: namespace: spinnaker wait: true - spinnaker/trigger-pipeline-with-webhook: payload: '{\"status\": \"success\", \"jobid\": \"$CIRCLE_WORKFLOW_JOB_ID\", \"message\": \"I''ve got it\"}' webhook-endpoint: SPINNAKER_WEBHOOK workflows: example-workflow: jobs: - send-webhook: aws-region: ap-southeast-2 cluster-name: my-eks-tests
Developer Updates
Get tips to optimize your builds
Or join our research panel and give feedback
By submitting this form, you are agreeing to ourTerms of UseandPrivacy Policy.