vx-worker 0.2.1 → 0.3.0.pre0

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
  SHA1:
3
- metadata.gz: 96e09a570bfc0d594a12355a2b0638de9e647583
4
- data.tar.gz: f6353a5aa2583d06c2c1982f9849c62418929f66
3
+ metadata.gz: 4a191dee94cb01a6620420e3739eab93dae138e1
4
+ data.tar.gz: 32849707818830f282a6af4c0f9e83d7cc9d7f91
5
5
  SHA512:
6
- metadata.gz: 66c295d5ca7fe1c17f11e4f4dc80780bc5a8ba1c86f46e44a4da0b93f72e26e7e6b788948c3aca61f05725e0e9ac140a7f0b2bdc1f7eaec4e8fe87923efe62c8
7
- data.tar.gz: ea635b5522aed2fd5b70d8342dedf7c2dd2b0c08f486f0b64499d58d96a95fdf9032bd1e5fc14c3005a57a6b946f3e74c8ac0713bc370ecb9d0c58a1af6e09f6
6
+ metadata.gz: 3a66ad52567249f726d3f685906e81b0bbc67bda4adeeab76fe0780f5ed05cf6a739f6c5854e46cbaa1f204d85d104e39d6ee777cb1677e35996f0c18632fcab
7
+ data.tar.gz: acd583b29ea3b59afd002c42ce87fc3e37f56f8fdfb6528d42e5bb1745aefa69488d2f78d85006512c98ddca51b11edcf627d3941290c01d9a705e95bab6ff9a
data/.gitignore CHANGED
@@ -16,3 +16,5 @@ test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
18
  fixtures/
19
+ .tmp/
20
+ .vagrant/
data/Gemfile CHANGED
@@ -2,3 +2,8 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in vx-worker.gemspec
4
4
  gemspec
5
+
6
+ group :test do
7
+ gem 'rspec'
8
+ gem 'rr'
9
+ end
data/Vagrantfile ADDED
@@ -0,0 +1,80 @@
1
+ # -*- mode: ruby -*-
2
+ # vi: set ft=ruby :
3
+
4
+ class CloudUbuntuVagrant < VagrantVbguest::Installers::Ubuntu
5
+ def install(opts=nil, &block)
6
+ communicate.sudo('sed -i "/^# deb.*multiverse/ s/^# //" /etc/apt/sources.list ', opts, &block)
7
+ communicate.sudo('apt-get update', opts, &block)
8
+ communicate.sudo('apt-get -y -q purge virtualbox-guest-dkms virtualbox-guest-utils virtualbox-guest-x11', opts, &block)
9
+ @vb_uninstalled = true
10
+ super
11
+ end
12
+
13
+ def running?(opts=nil, &block)
14
+ return false if @vb_uninstalled
15
+ super
16
+ end
17
+ end
18
+
19
+ # Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
20
+ VAGRANTFILE_API_VERSION = "2"
21
+
22
+ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
23
+ config.vm.box = 'precise64'
24
+ config.vm.box_url = 'http://cloud-images.ubuntu.com/vagrant/precise/current/precise-server-cloudimg-amd64-vagrant-disk1.box'
25
+
26
+ script =<<SCRIPT
27
+ set -e
28
+
29
+ cat > /etc/apt/sources.list << EOF
30
+ deb mirror://mirrors.ubuntu.com/mirrors.txt precise main restricted universe multiverse
31
+ deb mirror://mirrors.ubuntu.com/mirrors.txt precise-updates main restricted universe multiverse
32
+ deb mirror://mirrors.ubuntu.com/mirrors.txt precise-backports main restricted universe multiverse
33
+ deb mirror://mirrors.ubuntu.com/mirrors.txt precise-security main restricted universe multiverse
34
+ EOF
35
+
36
+ mkdir -p /etc/apt/sources.list.d
37
+
38
+ if [ ! -f /etc/apt/sources.list.d/vexor.list ] ; then
39
+ echo 'deb http://download.opensuse.org/repositories/home:/dmexe:/vexor:/testing/xUbuntu_12.04/ ./' > /etc/apt/sources.list.d/vexor.list
40
+ curl -s http://download.opensuse.org/repositories/home:/dmexe:/vexor:/testing/xUbuntu_12.04/Release.key | apt-key add -
41
+ fi
42
+
43
+ if [ ! -f /etc/apt/sources.list.d/osc.list ] ; then
44
+ echo 'deb http://download.opensuse.org/repositories/openSUSE:/Tools/xUbuntu_12.04/ ./' > /etc/apt/sources.list.d/osc.list
45
+ curl -s http://download.opensuse.org/repositories/openSUSE:/Tools/xUbuntu_12.04/Release.key | apt-key add -
46
+ fi
47
+
48
+ apt-get -qqy update > /dev/null
49
+ apt-get -qy install osc build vx-embeded-ruby vx-embeded-bundler git-core devscripts debhelper > /dev/null
50
+ apt-get -qy autoremove > /dev/null
51
+
52
+ function sd () {
53
+ sudo su -c "$1" vagrant
54
+ }
55
+
56
+ if [ ! -d home:dmexe:vexor:testing ] ; then
57
+ pushd /home/vagrant
58
+ sd "osc co home:dmexe:vexor:testing"
59
+ popd
60
+ fi
61
+
62
+ pushd /vagrant/.tmp/
63
+ sudo su -c "sh build.sh" vagrant
64
+ popd
65
+
66
+ pushd /home/vagrant/home:dmexe:vexor:testing/vx-worker
67
+ sd "rm -rf vx-worker_*"
68
+ sd "cp /vagrant/.tmp/vx-worker_* ."
69
+ status=$(sudo su -c "osc st" vagrant)
70
+ if [ ! -z "${status}" ] ; then
71
+ echo "changes detected: ${status}"
72
+ sd "osc addremove"
73
+ sd "osc ci -m 'bump'"
74
+ fi
75
+ popd
76
+
77
+ SCRIPT
78
+
79
+ config.vm.provision :shell, :inline => script
80
+ end
data/dist/build.sh ADDED
@@ -0,0 +1,77 @@
1
+ #!/bin/bash
2
+
3
+ set -e
4
+
5
+ PACKAGE_NAME="vx-worker"
6
+
7
+ GIT_LAST_LOG=$(git log -n1 --format=oneline)
8
+ GIT_BUILD_NUMBER=$(git rev-list HEAD | wc -l | sed -e 's/ *//g' | xargs -n1 printf %04d)
9
+ GIT_LAST_TAG=$(git describe --abbrev=0 --tags)
10
+ GIT_VERSION=$(echo $GIT_LAST_TAG | sed -e "s/^v//g")
11
+ GIT_DATE=$(git log -n1 --format="%aD")
12
+
13
+ RELEASE_VERSION=$(echo $GIT_VERSION | ruby -e "puts Gem::Version.new(STDIN.read).release.to_s")
14
+ RELEASE_SHORT_VERSION=$(echo $GIT_VERSION | ruby -e "puts Gem::Version.new(STDIN.read).release.to_s.split('.')[0..1].join('.')")
15
+
16
+ VERSION="${RELEASE_VERSION}.rev${GIT_BUILD_NUMBER}"
17
+ PACKAGE_NAME_AND_VERSION="${PACKAGE_NAME}_${VERSION}"
18
+ WORKDIR=".tmp/${PACKAGE_NAME_AND_VERSION}"
19
+
20
+ function notice() {
21
+ echo " ---> $1"
22
+ }
23
+
24
+ function git_export () {
25
+ rm -rf .tmp
26
+ mkdir -p $WORKDIR
27
+ notice "export code to $WORKDIR"
28
+ git archive master | tar -x -C $WORKDIR
29
+ }
30
+
31
+ function package_gems () {
32
+ notice "packaging gems"
33
+ (cd $WORKDIR && bundle package > /dev/null)
34
+ }
35
+
36
+ function generate_debian () {
37
+ notice "generating debian scripts"
38
+
39
+ dst=${WORKDIR}/debian
40
+ src=dist/debian
41
+
42
+ pushd .tmp > /dev/null
43
+ tar -czf "${PACKAGE_NAME_AND_VERSION}.orig.tar.gz" ${PACKAGE_NAME_AND_VERSION}
44
+ popd > /dev/null
45
+
46
+ cp -r $src $dst
47
+
48
+ cat $dst/control.mk | sed -e "s/%PACKAGE_NAME%/${PACKAGE_NAME}/g" > $dst/control
49
+ cat $dst/changelog.mk | sed -e "s/%VERSION%/${VERSION}/g" | sed -e "s/%DATE%/${GIT_DATE}/g" > $dst/changelog
50
+ }
51
+
52
+ function run_vagrant () {
53
+ notice "run build in vagrant"
54
+
55
+ cat > .tmp/build.sh <<EOF
56
+ set -e
57
+ set -x
58
+
59
+ (cd ${PACKAGE_NAME_AND_VERSION} && debuild -i -us -uc -S)
60
+
61
+ mv ${PACKAGE_NAME_AND_VERSION} work
62
+ EOF
63
+ vagrant up
64
+ vagrant provision
65
+ }
66
+
67
+
68
+ function build () {
69
+ notice "Building ${PACKAGE_NAME_AND_VERSION}"
70
+
71
+ git_export
72
+ package_gems
73
+ generate_debian
74
+ run_vagrant
75
+ }
76
+
77
+ build
@@ -0,0 +1,6 @@
1
+ vx-worker (%VERSION%) UNRELEASED; urgency=low
2
+
3
+ * bump
4
+
5
+ -- Dmitry Galinsky <dima.exe@gmail.com> %DATE%
6
+
@@ -0,0 +1,7 @@
1
+ # RABBITMQ_URL=amqp://guest:guest@localhost/%2f
2
+
3
+ # VX_WORKERS=4
4
+ # VX_DOCKER_IMAGE=dmexe/precise
5
+
6
+ # AIRBRAKE_API_KEY=<key>
7
+ # AIRBRAKE_HOST=<host>
@@ -0,0 +1 @@
1
+ 5
@@ -0,0 +1,12 @@
1
+ Source: vx-worker
2
+ Section: ruby
3
+ Priority: optional
4
+ Maintainer: Dmitry Galinsky <dima.exe@gmail.com>
5
+ Build-Depends: debhelper (>= 9.0), vx-embeded-ruby, vx-embeded-bundler, git-core
6
+ Standards-Version: 3.9.3
7
+ Homepage: http://www.ruby-lang.org/
8
+
9
+ Package: %PACKAGE_NAME%
10
+ Architecture: any
11
+ Depends: ${shlibs:Depends}, ${misc:Depends}, vx-embeded-ruby, vx-embeded-bundler, adduser
12
+ Description: Vexor worker.
@@ -0,0 +1,35 @@
1
+ #!/bin/bash
2
+
3
+ set -e
4
+
5
+ # summary of how this script can be called:
6
+ # * <postrm> `remove'
7
+ # * <postrm> `purge'
8
+ # * <old-postrm> `upgrade' <new-version>
9
+ # * <new-postrm> `failed-upgrade' <old-version>
10
+ # * <new-postrm> `abort-install'
11
+ # * <new-postrm> `abort-install' <old-version>
12
+ # * <new-postrm> `abort-upgrade' <old-version>
13
+ # * <disappearer's-postrm> `disappear' <r>overwrit>r> <new-version>
14
+ # for details, see http://www.debian.org/doc/debian-policy/ or
15
+ # the debian-policy package
16
+
17
+ case "$1" in
18
+ purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
19
+ if test "x$1" == "xpurge"
20
+ then
21
+ userdel -r vx-worker || true
22
+ rm -rf /var/lib/vexor/worker
23
+ rm -f /var/log/upstart/vx-worker.log
24
+ fi
25
+ ;;
26
+
27
+ *)
28
+ echo "postrm called with unknown argument \`$1'" >&2
29
+ exit 0
30
+ esac
31
+
32
+ #DEBHELPER#
33
+
34
+ exit 0
35
+
@@ -0,0 +1,27 @@
1
+ #!/bin/bash
2
+
3
+ set -e
4
+
5
+ # summary of how this script can be called:
6
+ # * <new-preinst> `install'
7
+ # * <new-preinst> `install' <old-version>
8
+ # * <new-preinst> `upgrade' <old-version>
9
+ # * <old-preinst> `abort-upgrade' <new-version>
10
+ #
11
+ # for details, see http://www.debian.org/doc/debian-policy/ or
12
+ # the debian-policy package
13
+
14
+ if [ "$1" == "install" ] || [ "$1" == "upgrade" ]; then
15
+
16
+ if ! id vx-worker 1> /dev/null 2>&1; then
17
+ groupadd -f -r vx-worker
18
+ useradd -d /var/lib/vexor/worker -g vx-worker -G docker -c "Vexor worker daemon" -s /usr/sbin/nologin -r vx-worker
19
+ fi
20
+
21
+ install -m 750 -o vx-worker -g vx-worker -d /var/lib/vexor/worker
22
+ fi
23
+
24
+ #DEBHELPER#
25
+
26
+ exit 0
27
+
data/dist/debian/rules ADDED
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/make -f
2
+ # Sample debian/rules that uses debhelper.
3
+ # GNU copyright 1997 to 1999 by Joey Hess.
4
+
5
+ BUNDLE = /opt/vexor/bin/bundle
6
+ DIST = $(shell pwd)/debian/vx-worker/opt/vexor/worker
7
+
8
+ %:
9
+ dh $@
10
+
11
+ override_dh_auto_install:
12
+ $(BUNDLE) install --without development --local --standalone
13
+ mkdir -p $(DIST)
14
+ cp -r bin $(DIST)
15
+ cp -r docker $(DIST)
16
+ cp -r lib $(DIST)
17
+ cp -r bundle $(DIST)
18
+ rm -rf $(DIST)/debian
19
+ mkdir -p debian/vx-worker/etc/vexor
20
+ install -m 0644 debian/ci_env debian/vx-worker/etc/vexor/ci
21
+ mkdir -p debian/vx-worker/opt/vexor/bin
22
+ install -m 0755 debian/script debian/vx-worker/opt/vexor/bin/worker
@@ -0,0 +1,6 @@
1
+ #!/bin/sh
2
+
3
+ RUBY=/opt/vexor/ruby/bin/ruby
4
+ REQ=/opt/vexor/worker/bundle/bundler/setup.rb
5
+
6
+ exec ${RUBY} -r ${REQ} /opt/vexor/worker/bin/vx-worker $*
@@ -0,0 +1 @@
1
+ 1.0
@@ -0,0 +1,18 @@
1
+ description "start and stop the vexor worker"
2
+ version "1.0"
3
+
4
+ start on filesystem or runlevel [2345]
5
+ stop on runlevel [!2345]
6
+
7
+ respawn
8
+
9
+ console log
10
+
11
+ script
12
+ home=/var/lib/vexor/worker
13
+ user=vx-worker
14
+ command=/opt/vexor/bin/worker
15
+
16
+ chdir $home
17
+ su -s /bin/sh -c "exec $command" $user
18
+ end script
@@ -51,11 +51,11 @@ module Vx
51
51
  def create_message(job, status)
52
52
  tm = Time.now
53
53
  Message::JobStatus.new(
54
- build_id: job.message.id,
55
- job_id: job.message.job_id,
56
- status: status,
57
- tm: tm.to_i,
58
- matrix: job.message.matrix_keys
54
+ project_id: job.message.project_id,
55
+ build_id: job.message.id,
56
+ job_id: job.message.job_id,
57
+ status: status,
58
+ tm: tm.to_i,
59
59
  )
60
60
  end
61
61
 
@@ -1,5 +1,5 @@
1
1
  module Vx
2
2
  module Worker
3
- VERSION = "0.2.1"
3
+ VERSION = "0.3.0.pre0"
4
4
  end
5
5
  end
@@ -1,6 +1,6 @@
1
1
  shared_examples "UpdateJobStatus message" do
2
- its(:build_id) { should eq job.message.id }
3
- its(:job_id) { should eq job.message.job_id }
4
- its(:matrix) { should eq job.message.matrix_keys }
5
- its(:tm) { should be }
2
+ its(:project_id) { should eq job.message.project_id }
3
+ its(:build_id) { should eq job.message.id }
4
+ its(:job_id) { should eq job.message.job_id }
5
+ its(:tm) { should be }
6
6
  end
data/vx-worker.gemspec CHANGED
@@ -19,13 +19,11 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ["lib"]
20
20
 
21
21
  spec.add_runtime_dependency 'vx-common', "= 0.2.1"
22
- spec.add_runtime_dependency 'vx-message', "= 0.2.1"
23
- spec.add_runtime_dependency 'vx-container_connector', "= 0.2.1"
22
+ spec.add_runtime_dependency 'vx-message', "= 0.4.1"
23
+ spec.add_runtime_dependency 'vx-container_connector', "= 0.2.3"
24
24
  spec.add_runtime_dependency 'vx-common-amqp', '~> 0.2.6'
25
25
  spec.add_runtime_dependency 'hashr', '= 0.0.22'
26
26
 
27
27
  spec.add_development_dependency "bundler", "~> 1.3"
28
28
  spec.add_development_dependency "rake"
29
- spec.add_development_dependency "rspec"
30
- spec.add_development_dependency "rr"
31
29
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vx-worker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0.pre0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitry Galinsky
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-19 00:00:00.000000000 Z
11
+ date: 2014-01-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: vx-common
@@ -30,28 +30,28 @@ dependencies:
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 0.2.1
33
+ version: 0.4.1
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 0.2.1
40
+ version: 0.4.1
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: vx-container_connector
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - '='
46
46
  - !ruby/object:Gem::Version
47
- version: 0.2.1
47
+ version: 0.2.3
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - '='
53
53
  - !ruby/object:Gem::Version
54
- version: 0.2.1
54
+ version: 0.2.3
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: vx-common-amqp
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -108,34 +108,6 @@ dependencies:
108
108
  - - '>='
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
- - !ruby/object:Gem::Dependency
112
- name: rspec
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - '>='
116
- - !ruby/object:Gem::Version
117
- version: '0'
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - '>='
123
- - !ruby/object:Gem::Version
124
- version: '0'
125
- - !ruby/object:Gem::Dependency
126
- name: rr
127
- requirement: !ruby/object:Gem::Requirement
128
- requirements:
129
- - - '>='
130
- - !ruby/object:Gem::Version
131
- version: '0'
132
- type: :development
133
- prerelease: false
134
- version_requirements: !ruby/object:Gem::Requirement
135
- requirements:
136
- - - '>='
137
- - !ruby/object:Gem::Version
138
- version: '0'
139
111
  description: ' ci worker '
140
112
  email:
141
113
  - dima.exe@gmail.com
@@ -150,7 +122,19 @@ files:
150
122
  - Gemfile
151
123
  - LICENSE.txt
152
124
  - Rakefile
125
+ - Vagrantfile
153
126
  - bin/vx-worker
127
+ - dist/build.sh
128
+ - dist/debian/changelog.mk
129
+ - dist/debian/ci_env
130
+ - dist/debian/compat
131
+ - dist/debian/control.mk
132
+ - dist/debian/postrm
133
+ - dist/debian/preinst
134
+ - dist/debian/rules
135
+ - dist/debian/script
136
+ - dist/debian/source/format
137
+ - dist/debian/upstart
154
138
  - docker/.gitignore
155
139
  - docker/Dockerfile
156
140
  - docker/build.sh
@@ -226,9 +210,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
226
210
  version: '0'
227
211
  required_rubygems_version: !ruby/object:Gem::Requirement
228
212
  requirements:
229
- - - '>='
213
+ - - '>'
230
214
  - !ruby/object:Gem::Version
231
- version: '0'
215
+ version: 1.3.1
232
216
  requirements: []
233
217
  rubyforge_project:
234
218
  rubygems_version: 2.0.14