vagrant-vmck 0.0.4 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.drone.yml +96 -0
- data/Dockerfile +21 -10
- data/Gemfile +1 -1
- data/Readme.md +8 -2
- data/examples/docker.sh +26 -0
- data/lib/vagrant-vmck/action/create.rb +2 -0
- data/lib/vagrant-vmck/config.rb +6 -0
- data/lib/vagrant-vmck/version.rb +1 -1
- data/run-test.sh +19 -0
- metadata +6 -3
- data/example_box/Vagrantfile +0 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a4c8c0d2a2581947bfff1f4220f651982edaeb1d43b0137519140b4a1bac3762
|
4
|
+
data.tar.gz: e7760b4a7171e6383bfffbe51a9af1c2bed8292fbd77a6704f11f6588f263d79
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c6b520f270bcff9c09807977a33adc53b2d204ef5b588de921f9301ac004a321bc8bc6e8b5c7a565d9dce771d3fbb1f07882fab5ec24c29bcef393a354cc5a9
|
7
|
+
data.tar.gz: effff2148652e0b1dc70c6710d1cee2ccd456239dbe944c75566a2b31fb76309349c4585210666d7eb6ae649023003e022064a7612dd35512cecf0348574ea82
|
data/.drone.yml
ADDED
@@ -0,0 +1,96 @@
|
|
1
|
+
kind: pipeline
|
2
|
+
name: test
|
3
|
+
|
4
|
+
steps:
|
5
|
+
- name: docker build
|
6
|
+
image: docker:dind
|
7
|
+
volumes:
|
8
|
+
- name: dockersock
|
9
|
+
path: /var/run
|
10
|
+
commands:
|
11
|
+
- sleep 1; until docker version; do sleep 1; done
|
12
|
+
- docker build . --tag vagrant-vmck
|
13
|
+
|
14
|
+
- name: list plugins
|
15
|
+
image: docker:dind
|
16
|
+
volumes:
|
17
|
+
- name: dockersock
|
18
|
+
path: /var/run
|
19
|
+
commands:
|
20
|
+
- apk update -q && apk add -q grep
|
21
|
+
- docker run vagrant-vmck vagrant --version
|
22
|
+
- docker run vagrant-vmck vagrant plugin list
|
23
|
+
- docker run vagrant-vmck vagrant plugin list | grep -q vagrant-vmck
|
24
|
+
|
25
|
+
- name: launch example VM
|
26
|
+
image: docker:dind
|
27
|
+
volumes:
|
28
|
+
- name: dockersock
|
29
|
+
path: /var/run
|
30
|
+
commands:
|
31
|
+
- export VMCK_URL=http://$VMCK_IP:$VMCK_PORT
|
32
|
+
- docker run -e VMCK_URL=$VMCK_URL vagrant-vmck bash /src/run-test.sh
|
33
|
+
|
34
|
+
services:
|
35
|
+
- name: docker daemon in docker
|
36
|
+
image: docker:dind
|
37
|
+
privileged: true
|
38
|
+
volumes:
|
39
|
+
- name: dockersock
|
40
|
+
path: /var/run
|
41
|
+
|
42
|
+
volumes:
|
43
|
+
- name: dockersock
|
44
|
+
temp: {}
|
45
|
+
|
46
|
+
---
|
47
|
+
kind: pipeline
|
48
|
+
name: publish
|
49
|
+
|
50
|
+
trigger:
|
51
|
+
status:
|
52
|
+
- success
|
53
|
+
event:
|
54
|
+
- push
|
55
|
+
- tag
|
56
|
+
|
57
|
+
depends_on:
|
58
|
+
- test
|
59
|
+
|
60
|
+
steps:
|
61
|
+
- name: docker push branch ${DRONE_COMMIT_BRANCH}
|
62
|
+
image: plugins/docker
|
63
|
+
settings:
|
64
|
+
repo: vmck/vagrant-vmck
|
65
|
+
tags: ${DRONE_COMMIT_BRANCH}
|
66
|
+
username:
|
67
|
+
from_secret: docker_username
|
68
|
+
password:
|
69
|
+
from_secret: docker_password
|
70
|
+
when:
|
71
|
+
event:
|
72
|
+
- push
|
73
|
+
|
74
|
+
- name: docker push autotag + latest
|
75
|
+
image: plugins/docker
|
76
|
+
settings:
|
77
|
+
repo: vmck/vagrant-vmck
|
78
|
+
auto_tag: true
|
79
|
+
username:
|
80
|
+
from_secret: docker_username
|
81
|
+
password:
|
82
|
+
from_secret: docker_password
|
83
|
+
|
84
|
+
---
|
85
|
+
kind: secret
|
86
|
+
name: docker_username
|
87
|
+
get:
|
88
|
+
path: liquid/ci/drone.docker
|
89
|
+
name: username
|
90
|
+
|
91
|
+
---
|
92
|
+
kind: secret
|
93
|
+
name: docker_password
|
94
|
+
get:
|
95
|
+
path: liquid/ci/drone.docker
|
96
|
+
name: password
|
data/Dockerfile
CHANGED
@@ -1,13 +1,24 @@
|
|
1
|
-
FROM
|
1
|
+
FROM alpine:3.10.1
|
2
2
|
|
3
|
-
RUN
|
4
|
-
&& apt-get update \
|
5
|
-
&& apt-get install -y procps curl rsync kmod ssh \
|
6
|
-
&& apt-get clean && rm -rf /var/lib/apt/lists/*
|
3
|
+
RUN apk add ruby ruby-dev ruby-bundler ruby-json rsync gcc g++ make git libc-dev openssh bash
|
7
4
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
&&
|
5
|
+
ENV PATH=$PATH:/vagrant/exec
|
6
|
+
|
7
|
+
RUN git clone https://github.com/hashicorp/vagrant.git \
|
8
|
+
&& cd vagrant \
|
9
|
+
&& git checkout v2.2.4 \
|
10
|
+
&& bundle install \
|
11
|
+
&& bundle --binstubs exec \
|
12
|
+
&& vagrant --version \
|
13
|
+
&& vagrant plugin install vagrant-env
|
12
14
|
|
13
|
-
RUN
|
15
|
+
RUN mkdir /src
|
16
|
+
WORKDIR /src
|
17
|
+
ADD . .
|
18
|
+
|
19
|
+
RUN set -e \
|
20
|
+
&& gem build vagrant-vmck.gemspec \
|
21
|
+
&& vagrant plugin install vagrant-vmck-*.gem \
|
22
|
+
&& gem_dir="$(ls -d /root/.vagrant.d/gems/*/gems/vagrant-vmck-*)" \
|
23
|
+
&& rm -rf "$gem_dir" \
|
24
|
+
&& ln -s /src "$gem_dir"
|
data/Gemfile
CHANGED
data/Readme.md
CHANGED
@@ -16,16 +16,22 @@
|
|
16
16
|
|
17
17
|
## Usage
|
18
18
|
|
19
|
-
See `
|
19
|
+
See `examples/box/Vagrantfile` for an example configuration.
|
20
20
|
|
21
21
|
```shell
|
22
22
|
$ vagrant up --provider=vmck
|
23
23
|
```
|
24
24
|
|
25
|
+
The vmck provider is also packaged as a docker image:
|
26
|
+
|
27
|
+
```shell
|
28
|
+
./examples/docker.sh --dev --env VMCK_URL=http://10.66.60.1:9995
|
29
|
+
```
|
30
|
+
|
25
31
|
## Release
|
26
32
|
1. Update `lib/vagrant-vmck/version.rb` and commit
|
27
33
|
2. `git tag v1.2.3; git push --tags`
|
28
|
-
3. `gem release`
|
34
|
+
3. `gem install gem-release; gem release`
|
29
35
|
4. `docker build . --tag vmck/vagrant-vmck:1.2.3 --no-cache`
|
30
36
|
5. `docker build . --tag vmck/vagrant-vmck` (should reuse the previous build)
|
31
37
|
6. `docker push vmck/vagrant-vmck`
|
data/examples/docker.sh
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
#!/bin/bash -e
|
2
|
+
|
3
|
+
cd "$( dirname "${BASH_SOURCE[0]}" )"/..
|
4
|
+
|
5
|
+
image=vmck/vagrant-vmck:latest
|
6
|
+
options=(--rm --interactive --tty)
|
7
|
+
|
8
|
+
while [[ $# -gt 0 ]]; do
|
9
|
+
arg=$1
|
10
|
+
shift
|
11
|
+
case "$arg" in
|
12
|
+
"--dev")
|
13
|
+
options+=('--volume' "$(pwd):/src")
|
14
|
+
;;
|
15
|
+
"--env")
|
16
|
+
options+=('--env' "$1")
|
17
|
+
shift
|
18
|
+
;;
|
19
|
+
*)
|
20
|
+
echo "Unknown option $arg" >&2
|
21
|
+
exit 1
|
22
|
+
esac
|
23
|
+
done
|
24
|
+
|
25
|
+
set -x
|
26
|
+
exec docker run ${options[@]} $image
|
@@ -18,6 +18,8 @@ module VagrantPlugins
|
|
18
18
|
options = {
|
19
19
|
'cpus': env[:machine].provider_config.cpus,
|
20
20
|
'memory': env[:machine].provider_config.memory,
|
21
|
+
'image_path': env[:machine].provider_config.image_path,
|
22
|
+
'storage': env[:machine].provider_config.storage,
|
21
23
|
}
|
22
24
|
id = client.create(options)['id'].to_s
|
23
25
|
env[:machine].id = id
|
data/lib/vagrant-vmck/config.rb
CHANGED
@@ -5,12 +5,16 @@ module VagrantPlugins
|
|
5
5
|
attr_accessor :private_key_path
|
6
6
|
attr_accessor :memory
|
7
7
|
attr_accessor :cpus
|
8
|
+
attr_accessor :image_path
|
9
|
+
attr_accessor :storage
|
8
10
|
|
9
11
|
def initialize
|
10
12
|
@vmck_url = UNSET_VALUE
|
11
13
|
@private_key_path = UNSET_VALUE
|
12
14
|
@memory = UNSET_VALUE
|
13
15
|
@cpus = UNSET_VALUE
|
16
|
+
@image_path = UNSET_VALUE
|
17
|
+
@storage = UNSET_VALUE
|
14
18
|
end
|
15
19
|
|
16
20
|
def finalize!
|
@@ -18,6 +22,8 @@ module VagrantPlugins
|
|
18
22
|
@private_key_path = nil if @private_key_path == UNSET_VALUE
|
19
23
|
@memory = 512 if @memory == UNSET_VALUE
|
20
24
|
@cpus = 1 if @cpus == UNSET_VALUE
|
25
|
+
@image_path = 'imgbuild-master.qcow2.tar.gz' if @image_path == UNSET_VALUE
|
26
|
+
@storage = nil if @storage == UNSET_VALUE
|
21
27
|
end
|
22
28
|
|
23
29
|
end
|
data/lib/vagrant-vmck/version.rb
CHANGED
data/run-test.sh
ADDED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-vmck
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Morega
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-06
|
11
|
+
date: 2019-08-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -87,12 +87,14 @@ executables: []
|
|
87
87
|
extensions: []
|
88
88
|
extra_rdoc_files: []
|
89
89
|
files:
|
90
|
+
- ".drone.yml"
|
90
91
|
- ".gitignore"
|
91
92
|
- Dockerfile
|
92
93
|
- Gemfile
|
93
94
|
- LICENSE.txt
|
94
95
|
- Readme.md
|
95
|
-
-
|
96
|
+
- examples/box/Vagrantfile
|
97
|
+
- examples/docker.sh
|
96
98
|
- lib/vagrant-vmck.rb
|
97
99
|
- lib/vagrant-vmck/action.rb
|
98
100
|
- lib/vagrant-vmck/action/connect_vmck.rb
|
@@ -104,6 +106,7 @@ files:
|
|
104
106
|
- lib/vagrant-vmck/plugin.rb
|
105
107
|
- lib/vagrant-vmck/provider.rb
|
106
108
|
- lib/vagrant-vmck/version.rb
|
109
|
+
- run-test.sh
|
107
110
|
- vagrant-vmck.gemspec
|
108
111
|
homepage: https://github.com/mgax/vagrant-vmck
|
109
112
|
licenses:
|
data/example_box/Vagrantfile
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
# -*- mode: ruby -*-
|
2
|
-
# vi: set ft=ruby :
|
3
|
-
|
4
|
-
Vagrant.configure("2") do |config|
|
5
|
-
|
6
|
-
config.vm.box = "base"
|
7
|
-
|
8
|
-
config.vm.provision 'hello', type: 'shell', inline: 'echo hello world'
|
9
|
-
|
10
|
-
config.vm.provider :vmck do |provider|
|
11
|
-
provider.vmck_url = 'http://127.0.0.1:8000'
|
12
|
-
provider.memory = 1024
|
13
|
-
provider.cpus = 2
|
14
|
-
end
|
15
|
-
|
16
|
-
end
|