marathon_deploy 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9bcaf91224aa85fcdf139558d0a9b46e77ebe2d6
4
- data.tar.gz: b49329c3062882104d991d1e2daa37f3fb8b19ee
3
+ metadata.gz: 66057ff70c6413bf464ae07fd56a42607e5db141
4
+ data.tar.gz: b9f77c6bae0ca2517d6696142625376257745481
5
5
  SHA512:
6
- metadata.gz: 0c37bd73039acd741397ad43832058cd7ab2414992d75acf910e18c8bf25e46bef87d3c85e44547f3b732f7a0f0debe7eafdce1b9e5894881555048bd5f00515
7
- data.tar.gz: 8514f8c1b68168551fbb7f2dd493c759fad92c1908c4755c7095afc2cf3287a272bc1cf71a471a4da084339bd536d5b74bb76bdcefe3b2af25e2263952f51318
6
+ metadata.gz: 5801d37f9352ac4bbf96dd123f04d6d6ce06a34b89c50764c77eca9b34fee570ec8842c584c0f952270e60adacc05f88e118b18e18ce592c5544054a28ea1a9d
7
+ data.tar.gz: f3273ef63fa0c04e0f3ffe98bbeb8b6e05e2ed2f411f2038e516414cd557b065f3e8b37a8aeebee9012e435f560613bc51e49370dd0606a7ab06bad067456aad
data/Rakefile CHANGED
@@ -1,2 +1,8 @@
1
1
  require "bundler/gem_tasks"
2
+ require 'rake/testtask'
3
+
4
+ Rake::TestTask.new do |t|
5
+ t.libs << 'test'
6
+ t.pattern = "test/*_test.rb"
7
+ end
2
8
 
@@ -13,13 +13,13 @@ module MarathonDeploy
13
13
  def initialize(options={})
14
14
  default_options = {
15
15
  :force => false,
16
- :deployfile => 'deploy.yaml'
17
- }
16
+ :deployfile => 'deploy.yml'
17
+ }
18
18
  options = default_options.merge!(options)
19
19
  deployfile = options[:deployfile]
20
20
 
21
- if (!File.exist?(File.join(Dir.pwd,deployfile)))
22
- message = "\'#{deployfile}\' not found in current directory #{File.join(Dir.pwd)}"
21
+ if (!File.exist?(deployfile))
22
+ message = "\'#{File.expand_path(deployfile)}\' not found."
23
23
  raise Error::IOError, message, caller
24
24
  end
25
25
 
@@ -66,7 +66,11 @@ module MarathonDeploy
66
66
  end
67
67
 
68
68
  def to_s
69
- return id
69
+ return JSON.pretty_generate(@json)
70
+ end
71
+
72
+ def env
73
+ @json[:env]
70
74
  end
71
75
 
72
76
  def id
@@ -1,3 +1,3 @@
1
1
  module MarathonDeploy
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
@@ -27,4 +27,6 @@ Gem::Specification.new do |spec|
27
27
 
28
28
  spec.add_development_dependency "bundler", "~> 1.7"
29
29
  spec.add_development_dependency "rake", "~> 10.0"
30
+ spec.add_development_dependency "minitest", "~> 5.7"
31
+
30
32
  end
@@ -0,0 +1,28 @@
1
+ require 'test_helper'
2
+
3
+ class ApplicationTest < Minitest::Test
4
+ def setup
5
+ $LOG = Logger.new(STDOUT)
6
+ $LOG.level = Logger::INFO
7
+ @release_version = "TEST_VERSION_#{Time.now.utc.iso8601}"
8
+ ENV['RELEASE_VERSION'] = @release_version
9
+ @json = File.expand_path('../fixtures/deploy.json',__FILE__)
10
+ @yml = File.expand_path('../fixtures/deploy.yml',__FILE__)
11
+ end
12
+
13
+ def test_new_application_with_json
14
+ application = MarathonDeploy::Application.new(:deployfile => @json)
15
+ assert_instance_of(MarathonDeploy::Application,application)
16
+ refute_empty(application.id)
17
+ application.add_envs({ :MINITEST => "MINITEST_ENV_TEST" })
18
+ assert_equal("MINITEST_ENV_TEST",application.env[:MINITEST])
19
+ end
20
+
21
+ def test_new_application_with_yaml
22
+ application = MarathonDeploy::Application.new(:deployfile => @yml)
23
+ assert_instance_of(MarathonDeploy::Application,application)
24
+ refute_empty(application.id)
25
+ assert_equal(@release_version,application.env[:RELEASE_VERSION])
26
+ end
27
+
28
+ end
@@ -0,0 +1,11 @@
1
+ require 'test_helper'
2
+
3
+ class EnvironmentTest < Minitest::Test
4
+ def setup
5
+ puts "YOYO"
6
+ end
7
+
8
+ def test_env
9
+ puts "THIS IS ENV"
10
+ end
11
+ end
@@ -0,0 +1,66 @@
1
+ {
2
+ "args": [
3
+ "properties.py && FOO=\"`cat /opt/etc/public-search-germany-webapp.properties | grep -v '^\\s*#' | grep -E '.+=.+'`\"; echo $FOO; echo; env $FOO; echo; env $FOO hostName=$HOSTNAME backend.instance.name=$HOSTNAME java -Dhttp.port=8080 -Dajp.port=8009 -Dinstance.confdir=file:///opt/etc -Dbackend.logdir=$MESOS_SANDBOX -Dlog.rootDir=$MESOS_SANDBOX -DlogDir=$MESOS_SANDBOX $CMD_OPTS -Xmx$JAVA_XMX -Xms$JAVA_XMS -jar $MESOS_SANDBOX/public-search-germany-webapp*.jar"
4
+ ],
5
+ "cmd": null,
6
+ "container": {
7
+ "docker": {
8
+ "image": "dockerregistry.mobile.rz/mobile-java8:latest",
9
+ "network": "BRIDGE",
10
+ "portMappings": [
11
+ {
12
+ "containerPort": 8080,
13
+ "hostPort": 0,
14
+ "protocol": "tcp"
15
+ },
16
+ {
17
+ "containerPort": 8009,
18
+ "hostPort": 0,
19
+ "protocol": "tcp"
20
+ }
21
+ ]
22
+ },
23
+ "type": "DOCKER"
24
+ },
25
+ "cpus": 0.1,
26
+ "env": {
27
+ "APPLICATION_NAME": "public-search-germany-webapp",
28
+ "CMD_OPTS": "",
29
+ "CONFIG_ASSEMBLER_BASE_URL": "http://mobile-config-assembler.service.consul/config-assembler",
30
+ "DATACENTER_NUMBER": "44",
31
+ "JAVA_XMS": "252m",
32
+ "JAVA_XMX": "504m",
33
+ "SERVERCLASS_NAME": "pubse",
34
+ "SERVICE_8009_NAME": "public-search-germany-webapp",
35
+ "SERVICE_8009_TAGS": "ajp",
36
+ "SERVICE_8080_CHECK_SCRIPT": "curl --fail --silent $HOST_IP:$SERVICE_PORT/fz/release-info",
37
+ "SERVICE_8080_NAME": "public-search-germany-webapp",
38
+ "SERVICE_8080_TAGS": "http,haproxy"
39
+ },
40
+ "healthChecks": [
41
+ {
42
+ "gracePeriodSeconds": 30,
43
+ "intervalSeconds": 10,
44
+ "maxConsecutiveFailures": 3,
45
+ "portIndex": 0,
46
+ "protocol": "TCP",
47
+ "timeoutSeconds": 30
48
+ },
49
+ {
50
+ "gracePeriodSeconds": 30,
51
+ "intervalSeconds": 10,
52
+ "maxConsecutiveFailures": 3,
53
+ "path": "/fz/release-info",
54
+ "portIndex": 0,
55
+ "protocol": "HTTP",
56
+ "timeoutSeconds": 30
57
+ }
58
+ ],
59
+ "id": "public-search-germany-webapp",
60
+ "instances": 4,
61
+ "mem": 512,
62
+ "storeUrls": [
63
+ "http://maven-download.mobile.rz/maven/hosted-mobile-deployment-productive-releases/de/mobile/public-search-germany-webapp/ecs-1558-gb70c745/public-search-germany-webapp-ecs-1558-gb70c745.jar"
64
+ ],
65
+ "uris": []
66
+ }
@@ -0,0 +1,33 @@
1
+ ---
2
+ id: python-example-stable
3
+ cmd: echo python stable `hostname` > index.html; python3 -m http.server 8080
4
+ mem: 16
5
+ cpus: 0.1
6
+ instances: 5
7
+ container:
8
+ type: DOCKER
9
+ docker:
10
+ image: ubuntu:14.04
11
+ network: BRIDGE
12
+ portMappings:
13
+ - containerPort: 8080
14
+ hostPort: 0
15
+ protocol: tcp
16
+ env:
17
+ SERVICE_TAGS: python,webapp,http,weight=100
18
+ SERVICE_NAME: python
19
+ RELEASE_VERSION: %%RELEASE_VERSION%%
20
+ healthChecks:
21
+ - portIndex: 0
22
+ protocol: TCP
23
+ gracePeriodSeconds: 30
24
+ intervalSeconds: 10
25
+ timeoutSeconds: 30
26
+ maxConsecutiveFailures: 3
27
+ - path: "/"
28
+ portIndex: 0
29
+ protocol: HTTP
30
+ gracePeriodSeconds: 30
31
+ intervalSeconds: 10
32
+ timeoutSeconds: 30
33
+ maxConsecutiveFailures: 3
@@ -0,0 +1,7 @@
1
+ require 'marathon_deploy'
2
+ require 'logger'
3
+ require 'time'
4
+ require 'marathon_deploy/application'
5
+ require 'minitest/autorun'
6
+ require 'minitest/unit'
7
+ require 'minitest/pride'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: marathon_deploy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Colby
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-06 00:00:00.000000000 Z
11
+ date: 2015-06-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: logger
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '10.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: minitest
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '5.7'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '5.7'
69
83
  description: Pushes a yaml or json file to the Marathon API.
70
84
  email:
71
85
  - jcolby@team.mobile.de
@@ -109,6 +123,11 @@ files:
109
123
  - lib/marathon_deploy/version.rb
110
124
  - lib/marathon_deploy/yaml_json.rb
111
125
  - marathon_deploy.gemspec
126
+ - test/application_test.rb
127
+ - test/environment_test.rb
128
+ - test/fixtures/deploy.json
129
+ - test/fixtures/deploy.yml
130
+ - test/test_helper.rb
112
131
  homepage: https://github.com/joncolby/marathon_deploy
113
132
  licenses:
114
133
  - MIT
@@ -133,4 +152,9 @@ rubygems_version: 2.4.5
133
152
  signing_key:
134
153
  specification_version: 4
135
154
  summary: Mesos/Marathon deployment tool.
136
- test_files: []
155
+ test_files:
156
+ - test/application_test.rb
157
+ - test/environment_test.rb
158
+ - test/fixtures/deploy.json
159
+ - test/fixtures/deploy.yml
160
+ - test/test_helper.rb