pcf_blue_green 0.43.50 → 0.43.312

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
- SHA256:
3
- metadata.gz: ebb2290f5bc9d8dab6508b108de347c4d9364bb096e4ce80cb5f6d5fbde9da9b
4
- data.tar.gz: 5c953009bd7d96c0423c81e303d472ef1822dc73bf7ba804d36d2e62c8043777
2
+ SHA1:
3
+ metadata.gz: 3248836c1143805b124cfefd334bda9c906f1a0f
4
+ data.tar.gz: ebf169201cafac7a379c0748fb0891fe4190d43a
5
5
  SHA512:
6
- metadata.gz: efc06e04a67d494e83f9d826f7844f3f826ee6d61043ebd2c03163c808002ae1b99b205fce3370779a8082ba002e084c4817c9eeb8fc959fd34eeb4b4a715a11
7
- data.tar.gz: b967d4be74083aa4ce4f0a6fa6db04636991eaecf5dd027709cd331d7187fbf9e4692703970ac77d196ef5e0e351f0737319ecc0bc5dcac52df0824dacdd4674
6
+ metadata.gz: 8aa2f964597b2cc0bb33aa21bbb9c09f03d9440200af83c33e768e7d4fb514990d9699b617e716f76ba10e4c6c094219f0b48a299bb8cf270442569c93789da2
7
+ data.tar.gz: 8f963844e99eeb6088f4473968d86ca3c0182dc96df79545009432963eda151fd1cf257b14d581d1abe927c4e2277c4a149d4e8145b95edba911e941de8898c4
@@ -1,3 +1,3 @@
1
1
  module PcfBlueGreen
2
- VERSION = "0.43.50"
2
+ VERSION = "0.43.312"
3
3
  end
@@ -17,7 +17,6 @@ module PcfBlueGreen
17
17
  @org = org
18
18
  @space = space
19
19
  @login_options = @options[:login]
20
- ENV['maitenance_enabled'] = maitenance_enabled?.to_s
21
20
  login if call_login
22
21
  cmd = "echo $(gem which pcf_blue_green)"
23
22
  shell = Mixlib::ShellOut.new(cmd)
@@ -91,11 +90,6 @@ module PcfBlueGreen
91
90
  mapped_routes.uniq.join(",\n")
92
91
  end
93
92
 
94
- def maitenance_enabled?
95
- entity = entity_for(ENV['cf_app'])
96
- entity ? entity['environment_json']['MAINTENANCE_ENABLED'] : false
97
- end
98
-
99
93
  private
100
94
 
101
95
  def entity_for(app_name)
@@ -136,7 +130,7 @@ module PcfBlueGreen
136
130
 
137
131
  def routes_stdout(entity)
138
132
  routes_url = entity['routes_url']
139
- app_routes_cmd = "cf curl #{routes_url}?results-per-page=100"
133
+ app_routes_cmd = "cf curl #{routes_url}"
140
134
  app_routes_shell = Mixlib::ShellOut.new(app_routes_cmd)
141
135
  app_routes_shell.run_command
142
136
  JSON.parse(app_routes_shell.stdout)
@@ -152,7 +146,7 @@ module PcfBlueGreen
152
146
 
153
147
  def login
154
148
  puts "Logging in to #{@url}"
155
- cf_login = "cf login -a #{@url} -u #{@user} -p '#{@pass}' -o #{@org} -s '#{@space}' #{@login_options} > /dev/null"
149
+ cf_login = "cf login -a #{@url} -u #{@user} -p '#{@pass}' -o #{@org} -s #{@space} #{@login_options} > /dev/null"
156
150
  cmd = "#{cf_login}"
157
151
  shell = Mixlib::ShellOut.new(cmd)
158
152
  shell.run_command
@@ -33,7 +33,7 @@ function announce-success {
33
33
 
34
34
  function run-cmd {
35
35
  echo -e "\n\n${Cya}${@}${RCol}\n"
36
- "$@"
36
+ $@
37
37
  }
38
38
 
39
39
  function set-ruby {
@@ -56,33 +56,22 @@ function cf-setup {
56
56
  run-cmd cf api ${cf_api} --skip-ssl-validation
57
57
  set +x
58
58
  cf auth ${cf_user} ${cf_password}
59
+ echo "aaaaaa"
59
60
  run-cmd cf target -o ${cf_org} -s "${cf_space}"
60
61
  }
61
62
 
62
63
  function cf-push {
63
64
  local app_name=$1
64
65
  local manifest=$2
65
-
66
- if [ -z ${health_check_timeout+x} ]; then
67
- announce-task "Pushing ${app_name}"
68
- run-cmd cf push ${app_name} -f ${cf_manifest} --hostname ${app_name} -s cflinuxfs3
69
- else
70
- announce-task "Pushing ${app_name}. ${health_check_timeout} seconds health-check timeout set"
71
- run-cmd cf push ${app_name} -f ${cf_manifest} --hostname ${app_name} -t ${health_check_timeout} -s cflinuxfs3
72
- fi
73
- }
74
-
75
- function cf-push-healthcheck {
76
- local app_name=$1
77
- local manifest=$2
78
- local health_check_type=$3
79
66
  announce-task "Pushing ${app_name}"
80
- run-cmd cf push ${app_name} -f ${cf_manifest} --hostname ${app_name} --health-check-type ${health_check_type} -s cflinuxfs3
67
+ run-cmd cf push ${app_name} -f ${cf_manifest} --hostname ${app_name}
81
68
  }
82
69
 
83
70
  function check-health {
84
71
  local app_url=$1
85
72
  announce-task "Checking health"
73
+ maitenance_enabled=$(echo $(cf curl '/v2/apps' -X GET -H 'Content-Type: application/x-www-form-urlencoded' -d "q=name:$cf_app" | jq '.resources[0].entity.environment_json.MAINTENANCE_ENABLED'))
74
+ maitenance_enabled=$(echo ${maitenance_enabled//\"} | awk '{ print tolower($1) }')
86
75
  if [ $maitenance_enabled == "true" ] ; then
87
76
  status=$(curl -sSIL --header "x-digital-auth: ${JWT}" -X GET -o /dev/null -w "%{http_code}" ${app_url} --insecure)
88
77
  if [ $status == 503 ] ; then
@@ -129,24 +118,13 @@ function remove-blue {
129
118
  }
130
119
 
131
120
  function get-domain {
132
- if [ -z ${domain+x} ]; then
133
- arr=($cf_space)
134
- num=$(($(echo ${#arr[@]}) + 2))
135
- export domain=$(cf routes | grep ${cf_app} | awk -v env_var="$num" '{print $'$num'}' | grep "^apps\\." | tail -1)
136
- announce-task "Domain is ${domain}"
137
- else
138
- announce-task "app Domain is ${domain}"
139
- fi
121
+ export domain=$(cf routes | grep ${cf_app} | awk '{print $3}' | grep "^apps\\." | tail -1)
122
+ announce-task "Domain is ${domain}"
140
123
  }
141
- function join { local IFS="$1"; shift; echo "$*"; }
142
124
 
143
125
  function prep-green {
144
126
  blue=${cf_app}
145
- arr=($cf_space)
146
- space="$(join - ${arr[@]})"
147
- space="$(echo "${space//_/$'-'}")"
148
- export green="${cf_app}-${space}-g"
149
- echo "exported green: ${green}"
127
+ export green="${cf_app}-${cf_space}-g"
150
128
  if [ -z ${cf_manifest+x }]; then
151
129
  generate-manifest
152
130
  else
@@ -175,16 +153,9 @@ function blue-green {
175
153
  cd $app_directory
176
154
  cf-setup
177
155
 
178
- if [[ $maitenance_enabled == "true" ]] ; then
179
- cf set-health-check ${cf_app} port
180
- fi
181
-
182
156
  prep-green
183
- if [[ $maitenance_enabled == "false" ]] ; then
184
- cf-push-healthcheck ${green} ${cf_manifest} 'http'
185
- else
186
- cf-push ${green} ${cf_manifest}
187
- fi
157
+
158
+ cf-push ${green} ${cf_manifest}
188
159
  health_check_domain="${health_check_domain:-$domain}"
189
160
  if [ -z ${app_path+x} ]; then
190
161
  check-health "https://${green}.${health_check_domain}"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pcf_blue_green
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.43.50
4
+ version: 0.43.312
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pawel Bardzinski
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-10-03 00:00:00.000000000 Z
11
+ date: 2018-07-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mixlib-shellout
@@ -132,7 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
132
132
  version: '0'
133
133
  requirements: []
134
134
  rubyforge_project:
135
- rubygems_version: 2.7.7
135
+ rubygems_version: 2.6.10
136
136
  signing_key:
137
137
  specification_version: 4
138
138
  summary: gem encapsualting blue-green bash script