1. duksis/gcp-gke@0.1.9

duksis/gcp-gke@0.1.9

Sections
Google Kubernetes Engine (GKE) Orb
Created: September 12, 2019Version Published: September 27, 2019Releases: 10
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: gcp-gke: duksis/gcp-gke@0.1.9

Use gcp-gke elements in your existing workflows and jobs.

Opt-in to use of uncertified orbs on your organization’s Security settings page.

Jobs

publish-and-rollout-image

Update cluster with new Docker image.

Show job Source
PARAMETER
DESCRIPTION
REQUIRED
DEFAULT
TYPE
cluster
The Kubernetes cluster name.
Yes
-
string
deployment
The Kubernetes deployment name.
Yes
-
string
namespace
The Kubernetes namespace name.
No
default
string
container
The Kubernetes container name.
Yes
-
string
gcloud-service-key
The gcloud service key
No
GCLOUD_SERVICE_KEY
env_var_name
google-project-id
The Google project ID to connect with via the gcloud CLI
No
GOOGLE_PROJECT_ID
env_var_name
google-compute-zone
The Google compute zone to connect with via the gcloud CLI
No
GOOGLE_COMPUTE_ZONE
env_var_name
registry-url
The GCR registry URL from ['', us, eu, asia].gcr.io
No
gcr.io
string
image
A name for your docker image
Yes
-
string
tag
A docker image tag
No
latest
string
path-to-dockerfile
The relative path to the Dockerfile to use when building image
No
.
string

Commands

install

Install `gcloud` and `kubectl` if not already installed.

Show command Source

init

Initialize the `gcloud` CLI.

Show command Source

rollout-image

Update a deployment's Docker image.

Show command Source
PARAMETER
DESCRIPTION
REQUIRED
DEFAULT
TYPE
cluster
The Kubernetes cluster name.
Yes
-
string
deployment
The Kubernetes deployment name.
Yes
-
string
container
The Kubernetes container name.
Yes
-
string
image
A name for your docker image
Yes
-
string
namespace
The Kubernetes namespace name.
No
default
string

notify-datadog

Send a deploy event to DataDog

Show command Source
PARAMETER
DESCRIPTION
REQUIRED
DEFAULT
TYPE
api_key
Datadog API Key
No
DATADOG_API_KEY
env_var_name
image
Deployed image
Yes
-
string

notify-sentry

Send a deploy event to Sentry

Show command Source
PARAMETER
DESCRIPTION
REQUIRED
DEFAULT
TYPE
api_key
Sentry API Key
No
SENTRY_API_KEY
env_var_name
version
Release version
Yes
-
string
organization
Sentry organization slug
No
titelmedia-gmbh
string

notify-slack

Send a deploy event to Slack

Show command Source
PARAMETER
DESCRIPTION
REQUIRED
DEFAULT
TYPE
web_hook
Slack Webhook URL
No
SLACK_WEBHOOK_URL
env_var_name
text
Message to post to slack
No
Oh boy!
string
channel
Slack channel to post message
No
'#deployments'
string
username
Slack username to send message as
No
webhookbot
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 # 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: Google Kubernetes Engine (GKE) Orb # Orb Dependencies orbs: gcloud: circleci/gcp-cli@1.0.6 gcr: circleci/gcp-gcr@0.6.1 k8s: circleci/kubernetes@0.1.0 commands: install: description: "Install `gcloud` and `kubectl` if not already installed." steps: - gcloud/install - k8s/install init: description: "Initialize the `gcloud` CLI." steps: - gcloud/initialize rollout-image: description: "Update a deployment's Docker image." parameters: cluster: description: "The Kubernetes cluster name." type: string deployment: description: "The Kubernetes deployment name." type: string container: description: "The Kubernetes container name." type: string image: description: A name for your docker image type: string namespace: description: "The Kubernetes namespace name." type: string default: "default" steps: - run: | gcloud container clusters get-credentials <<parameters.cluster>> kubectl -n <<parameters.namespace>> set image deployment <<parameters.deployment>> <<parameters.container>>=<<parameters.image>> notify-datadog: description: Send a deploy event to DataDog parameters: api_key: description: Datadog API Key type: env_var_name default: DATADOG_API_KEY image: description: Deployed image type: string steps: - run: command: | curl -X POST -H "Content-type: application/json" --data \ "{ \"title\": \"Deployed <<parameters.image>>\", \"text\": \"Oh boy! New deployment for $CIRCLE_PROJECT_REPONAME on $CIRCLE_BRANCH. See more information here: $CIRCLE_BUILD_URL\", \"priority\": \"normal\", \"alert_type\": \"info\", \"source_type_name\": \"circleci\", \"aggregation_key\": \"deploys\", \"tags\": [ \"kube_deployment:$CIRCLE_PROJECT_REPONAME\", \"repository:$CIRCLE_PROJECT_REPONAME\", \"organization:$CIRCLE_PROJECT_USERNAME\", \"branch:$CIRCLE_BRANCH\", \"build_num:$CIRCLE_BUILD_NUM\", \"job:$CIRCLE_JOB\", \"started_by:$CIRCLE_USERNAME\" ] }" "https://api.datadoghq.com/api/v1/events?api_key=$<<parameters.api_key>>" name: Datadog - Sending Deploy Event when: on_success notify-sentry: description: Send a deploy event to Sentry parameters: api_key: description: Sentry API Key type: env_var_name default: SENTRY_API_KEY version: description: Release version type: string organization: description: Sentry organization slug type: string default: titelmedia-gmbh steps: - run: command: | if [[ -z "$<<parameters.api_key>>" ]]; then echo "Skipping Sentry notification as SENTRY_API_KEY not set" else curl -XPOST -s -H 'Content-Type: application/json' \ -H "Authorization: Bearer $<<parameters.api_key>>" --data \ "{ \"version\": \"<<parameters.version>>\", \"url\":\"$CIRCLE_BUILD_URL\", \"refs\":[{ \"repository\":\"$CIRCLE_PROJECT_REPONAME\", \"commit\":\"$CIRCLE_SHA1\" }], \"projects\":[ \"$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME\" ] }" "https://sentry.io/api/0/organizations/<<parameters.organization>>/releases/" fi name: Sentry - Sending Deploy Event when: on_success notify-slack: description: Send a deploy event to Slack parameters: web_hook: description: Slack Webhook URL type: env_var_name default: SLACK_WEBHOOK_URL text: description: Message to post to slack type: string default: "Oh boy!" channel: description: Slack channel to post message type: string default: "#deployments" username: description: Slack username to send message as type: string default: webhookbot steps: - run: command: | if [[ -z "$<<parameters.web_hook>>" ]]; then echo "Skipping Slack notification as <<parameters.web_hook>> not set" else GIT_COMMIT_DESC="$(git log --format=%B -n 1 $CIRCLE_SHA1)" emoji=$(echo :computer: :cool: :8ball: :thumbsup_all: | xargs -n1 echo | sort -R | head -n1) curl -XPOST --data-urlencode "payload={ \"channel\":\"<<parameters.channel>>\", \"username\":\"<<parameters.username>>\", \"text\":\"<<parameters.text>>\", \"icon_emoji\": \"$emoji\" }" $<<parameters.web_hook>> fi name: Slack - Sending Deploy Event when: on_success jobs: publish-and-rollout-image: description: "Update cluster with new Docker image." machine: true parameters: cluster: description: "The Kubernetes cluster name." type: string deployment: description: "The Kubernetes deployment name." type: string namespace: description: "The Kubernetes namespace name." type: string default: "default" container: description: "The Kubernetes container name." type: string gcloud-service-key: description: The gcloud service key type: env_var_name default: GCLOUD_SERVICE_KEY google-project-id: description: The Google project ID to connect with via the gcloud CLI type: env_var_name default: GOOGLE_PROJECT_ID google-compute-zone: description: The Google compute zone to connect with via the gcloud CLI type: env_var_name default: GOOGLE_COMPUTE_ZONE registry-url: description: The GCR registry URL from ['', us, eu, asia].gcr.io type: string default: gcr.io image: description: A name for your docker image type: string tag: description: A docker image tag type: string default: "latest" path-to-dockerfile: description: The relative path to the Dockerfile to use when building image type: string default: "." steps: - checkout - run: name: "Pull Submodules" command: | git submodule init git submodule update --remote - gcr/gcr-auth: google-project-id: <<parameters.google-project-id>> google-compute-zone: <<parameters.google-compute-zone>> - install - gcr/build-image: registry-url: <<parameters.registry-url>> google-project-id: <<parameters.google-project-id>> image: <<parameters.image>> tag: << parameters.tag >> path: <<parameters.path-to-dockerfile>> - gcr/push-image: registry-url: <<parameters.registry-url>> google-project-id: <<parameters.google-project-id>> image: <<parameters.image>> tag: <<parameters.tag>> - rollout-image: cluster: "<<parameters.cluster>>" deployment: "<<parameters.deployment>>" namespace: "<<parameters.namespace>>" container: "<<parameters.container>>" image: "<<parameters.registry-url>>/$<<parameters.google-project-id>>/<<parameters.image>>:<<parameters.tag>>" - notify-datadog: image: "<<parameters.image>>:<<parameters.tag>>" - notify-sentry: version: "$CIRCLE_PROJECT_REPONAME:<<parameters.tag>>" - notify-slack: text: "Deployed *<<parameters.image>>:<<parameters.tag>>* <$CIRCLE_BUILD_URL|Build> by: <https://github.com/$CIRCLE_USERNAME|$CIRCLE_USERNAME> message: $GIT_COMMIT_DESC" example: publish-and-rollout-image: description: | "The simplest example of using this Orb. Logs into GCP, builds and publishes a Docker image, and then rolls the image out to a GKE cluster." usage: version: 2.1 orbs: gke: felicianotech/test-gke@dev:testing-3 workflows: main: jobs: - build - gke/publish-and-rollout-image: context: gcp-testing deployment: orb-badge-server image: orb-badge-server tag: "2"
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.