kubernetes_helper 1.10.0 → 1.11.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ad11b73ac23d45b86c9b5789ae815af2ee565d6360462368e96c4b15dfcc3301
4
- data.tar.gz: 61df31315a5b137c9e1c4575002b875f87175d72d5319cf0e1439d8c01afaee6
3
+ metadata.gz: c0b83d896c9cffe12e38bd7c7ed4ecf56ed2eaa45836338c00d387655bd4f451
4
+ data.tar.gz: 9b8e19cb71692e6ea90066c3cb5120786a85e6402e0ae9e156bdbf75d0f3de31
5
5
  SHA512:
6
- metadata.gz: f1a177f81e8bf2a9337d233369c39dd7cc42e2baf0c7dca7fdba25984d86014837db2207bcab10a1b9f8b8bc2060b55dee8c0dc0054074ac4846592856c8d778
7
- data.tar.gz: 8be87c0b86cc7e4a7711d20d6360e96d5b99d7655ea3a3bed0a8291dec59cc552a9a326911355d2427f0e5548c0976045d7d28204af1c9dcee2c5fd1bc2af1f9
6
+ metadata.gz: 0b60c04186e29c3a729244b669385f7614b6812b2bbf5aeb8418a86f739737e56ee1e19e4de9eb202218e763492a76c14b7128a64f702d4a1288b0d8f1a0ffaa
7
+ data.tar.gz: e39bfd0335359f746ad66f5791f636c056f3749c7abe2405c0e17f72475935bc03a3b7fc41faec095f030cfe8e0b8785a6369eea479953de6e02f8795de76061
data/README.md CHANGED
@@ -54,8 +54,8 @@ it looks for the file inside kubernetes_helper template folder.
54
54
 
55
55
  ## Settings API
56
56
  Below settings are used when running Continuous Deployment
57
- - `continuous_deployment.image_name` (String, Optional): Partial docker image url where `:latest` will be automatically added. Sample: `gcr.io/my-account/my_app_name`
58
- - `continuous_deployment.image` (String, Optional, is mandatory if `image_name` is empty): Full docker image url. Sample: `gcr.io/my-account/my_app_name:latest`
57
+ - `continuous_deployment.image_name` (String): Partial docker image url. Sample: `gcr.io/my-account/my_app_name`
58
+ - `continuous_deployment.image_tag` (String, default 'latest'): Image tag to be used for this application
59
59
  - `continuous_deployment.project_name`: Cloud project name. Sample: `my-project-name`
60
60
  - `continuous_deployment.cluster_name`: Cluster cluster name. Sample: `my-cluster-name`
61
61
  - `continuous_deployment.cluster_region`: Cluster region name. Sample: `europe-west4-a`
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module KubernetesHelper
4
- VERSION = '1.10.0'
4
+ VERSION = '1.11.0'
5
5
  end
data/lib/templates/cd.sh CHANGED
@@ -15,7 +15,7 @@ DOCKER_BUILD_CMD="<%=continuous_deployment.docker_build_cmd || 'build -f Dockerf
15
15
  CI_COMMIT_SHA=$(git rev-parse --verify HEAD || :)
16
16
  CI_COMMIT_SHA=${CI_COMMIT_SHA:-$(date +%s) }
17
17
  DEPLOY_NAME="${IMAGE_NAME}:${CI_COMMIT_SHA}"
18
- LATEST_NAME="${IMAGE_NAME}:latest"
18
+ LATEST_NAME="${IMAGE_NAME}:<%= continuous_deployment.image_tag || 'latest' %>"
19
19
 
20
20
  if [ ! -z "$KB_AUTH_TOKEN" ]
21
21
  then
@@ -37,10 +37,14 @@ then
37
37
  fi
38
38
 
39
39
 
40
- ## Build and push containers
41
- docker $DOCKER_BUILD_CMD -t $DEPLOY_NAME .
40
+ ALREADY_DEPLOYED="$(gcloud container images list-tags --format='get(tags)' $IMAGE_NAME | grep $CI_COMMIT_SHA)"
41
+ if [ -z $ALREADY_DEPLOYED ]
42
+ then
43
+ ## Build and push containers
44
+ docker $DOCKER_BUILD_CMD -t $DEPLOY_NAME .
45
+ docker push $DEPLOY_NAME
46
+ fi
42
47
  docker tag $DEPLOY_NAME $LATEST_NAME
43
- docker push $DEPLOY_NAME
44
48
  docker push $LATEST_NAME
45
49
 
46
50
  ## Update new secrets defined in secrets.yml as ENV vars for deployments
@@ -54,5 +58,4 @@ for deployment in "${deployments[@]}"; do
54
58
  [ -z "$deployment" ] && continue # if empty value
55
59
 
56
60
  <%= include_template "_cd_apply_images.sh" %>
57
- done
58
-
61
+ done
@@ -21,12 +21,7 @@ documents:
21
21
  spec: &template_spec
22
22
  containers:
23
23
  - &app_container
24
- <% if continuous_deployment.image_name %>
25
- image: '<%= continuous_deployment.image_name %>:latest'
26
- <% else %>
27
- image: '<%= continuous_deployment.image %>'
28
- <% end %>
29
-
24
+ image: '<%= continuous_deployment.image_name %>:<%= continuous_deployment.image_tag || "latest" %>'
30
25
  <% if deployment.command %>
31
26
  command: ["/bin/bash", "-c", "<%= deployment.command %>"]
32
27
  <% end %>
@@ -24,7 +24,8 @@ settings = {
24
24
  certificate_domain: is_production ? 'myapp.com' : 'beta.myapp.com' # nil if domain is not required
25
25
  },
26
26
  continuous_deployment: {
27
- image: "gcr.io/my-account/#{app_name}:latest",
27
+ image_name: "gcr.io/my-account/#{app_name}",
28
+ image_tag: 'latest',
28
29
  project_name: 'my-project-name',
29
30
  cluster_name: 'my-cluster-name',
30
31
  cluster_region: 'europe-west4-a',
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kubernetes_helper
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.10.0
4
+ version: 1.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - owen2345
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-02-03 00:00:00.000000000 Z
11
+ date: 2022-02-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: erb