Add initial build recipes for Dryad (on ARMv7) and Weles 02/190502/2
authorAlexander Mazuruk <a.mazuruk@samsung.com>
Tue, 2 Oct 2018 18:35:30 +0000 (20:35 +0200)
committerPawel Wieczorek <p.wieczorek2@samsung.com>
Thu, 17 Oct 2019 12:47:49 +0000 (14:47 +0200)
This patch provides new ansible roles for Weles and Dryad. Dryad
executables ("dryad" from Boruta and "stm", "fota" from MuxPi) are built
for ARMv7 by default.

Ansible inventory for Vagrant machine has been modified accordingly.
This environment is suggested for the first time users to minimize
initial overhead.

Change-Id: I508dce8bab2947b3dd0f811ce47a13b8e094c551
Signed-off-by: Alexander Mazuruk <a.mazuruk@samsung.com>
Signed-off-by: Pawel Wieczorek <p.wieczorek2@samsung.com>
ansible/main.yml
ansible/roles/slav/dryad/meta/main.yml [new file with mode: 0644]
ansible/roles/slav/dryad/tasks/main.yml [new file with mode: 0644]
ansible/roles/slav/weles/meta/main.yml [new file with mode: 0644]
ansible/roles/slav/weles/tasks/main.yml [new file with mode: 0644]
vagrant/Vagrantfile

index cf3c1c3..59f9493 100644 (file)
@@ -7,7 +7,19 @@
       - common/ansible_runable
       - common/packages_uptodate
 
-- name: Deploy Boruta
+- name: Build Dryad executables for ARMv7
+  hosts: boruta_srv
+  vars:
+    build_flags_muxpi: GOOS=linux GOARCH=arm GOARM=7
+  roles:
+      - slav/dryad
+
+- name: Build Boruta
   hosts: boruta_srv
   roles:
       - slav/boruta
+
+- name: Build Weles
+  hosts: weles_srv
+  roles:
+      - slav/weles
diff --git a/ansible/roles/slav/dryad/meta/main.yml b/ansible/roles/slav/dryad/meta/main.yml
new file mode 100644 (file)
index 0000000..9a08e1a
--- /dev/null
@@ -0,0 +1,3 @@
+---
+dependencies:
+  - { role: andrewrothstein.go }
diff --git a/ansible/roles/slav/dryad/tasks/main.yml b/ansible/roles/slav/dryad/tasks/main.yml
new file mode 100644 (file)
index 0000000..5cba7d1
--- /dev/null
@@ -0,0 +1,63 @@
+---
+- name: Install git
+  apt: name=git state=present
+
+- name: Create GOPATH directory
+  file: path={{ hostvars[inventory_hostname].gopath }} state=directory
+  when: GOPATH is undefined
+
+- name: Create directory for SLAV
+  file:
+    path: "{{ hostvars[inventory_hostname].gopath }}/src/github.com/SamsungSLAV"
+    state: directory
+
+- name: Create directory for ARMv7 executables
+  file:
+    path: "{{ hostvars[inventory_hostname].gopath }}/bin/linux_armv7"
+    state: directory
+
+- name: Get MuxPi src
+  git:
+    repo: 'https://github.com/SamsungSLAV/muxpi'
+    dest: "{{ hostvars[inventory_hostname].gopath }}/src/github.com/SamsungSLAV/muxpi"
+    version: 'v0.1.0'
+
+- name: Get dependencies
+  command: /usr/local/go/bin/go get ./...
+  args:
+    chdir: "{{ hostvars[inventory_hostname].gopath }}/src/github.com/SamsungSLAV/muxpi"
+
+- name: Build stm executable
+  shell: >
+    {{ build_flags_muxpi }} /usr/local/go/bin/go build
+    -o "{{ hostvars[inventory_hostname].gopath }}/bin/linux_armv7/stm"
+    ./sw/nanopi/cmd/stm
+  args:
+    chdir: "{{ hostvars[inventory_hostname].gopath }}/src/github.com/SamsungSLAV/muxpi"
+
+- name: Build fota executable
+  shell: >
+    {{ build_flags_muxpi }} /usr/local/go/bin/go build
+    -o "{{ hostvars[inventory_hostname].gopath }}/bin/linux_armv7/fota"
+    ./sw/nanopi/cmd/fota
+  args:
+    chdir: "{{ hostvars[inventory_hostname].gopath }}/src/github.com/SamsungSLAV/muxpi"
+
+- name: Get Boruta src
+  git:
+    repo: 'https://github.com/SamsungSLAV/boruta'
+    dest: "{{ hostvars[inventory_hostname].gopath }}/src/github.com/SamsungSLAV/boruta"
+    version: 'v0.1.0'
+
+- name: Get dependencies
+  command: /usr/local/go/bin/go get ./...
+  args:
+    chdir: "{{ hostvars[inventory_hostname].gopath }}/src/github.com/SamsungSLAV/boruta"
+
+- name: Build dryad executable
+  shell: >
+    {{ build_flags_muxpi }} /usr/local/go/bin/go build
+    -o "{{ hostvars[inventory_hostname].gopath }}/bin/linux_armv7/dryad"
+    ./cmd/dryad
+  args:
+    chdir: "{{ hostvars[inventory_hostname].gopath }}/src/github.com/SamsungSLAV/boruta"
diff --git a/ansible/roles/slav/weles/meta/main.yml b/ansible/roles/slav/weles/meta/main.yml
new file mode 100644 (file)
index 0000000..9a08e1a
--- /dev/null
@@ -0,0 +1,3 @@
+---
+dependencies:
+  - { role: andrewrothstein.go }
diff --git a/ansible/roles/slav/weles/tasks/main.yml b/ansible/roles/slav/weles/tasks/main.yml
new file mode 100644 (file)
index 0000000..43128a6
--- /dev/null
@@ -0,0 +1,34 @@
+---
+- name: Install git
+  become: true
+  apt: name=git state=present
+
+- name: Install GCC
+  become: true
+  apt: name=gcc state=present
+
+- name: Create GOPATH directory
+  file: path={{ hostvars[inventory_hostname].gopath }} state=directory
+  when: GOPATH is undefined
+
+- name: Create directory for SLAV
+  file:
+    path: "{{ hostvars[inventory_hostname].gopath }}/src/github.com/SamsungSLAV"
+    state: directory
+
+- name: Get Boruta src
+  git:
+    repo: 'https://github.com/SamsungSLAV/boruta'
+    dest: "{{ hostvars[inventory_hostname].gopath }}/src/github.com/SamsungSLAV/boruta"
+    version: 'v0.1.0'
+
+- name: Get Weles src
+  git:
+    repo: 'https://github.com/SamsungSLAV/weles'
+    dest: "{{ hostvars[inventory_hostname].gopath }}/src/github.com/SamsungSLAV/weles"
+    version: 'v0.1.0'
+
+- name: Get dependencies and install named packages
+  command: /usr/local/go/bin/go get ./...
+  args:
+    chdir: "{{ hostvars[inventory_hostname].gopath }}/src/github.com/SamsungSLAV/weles"
index b612250..1bf34ba 100644 (file)
@@ -16,11 +16,15 @@ Vagrant.configure("2") do |config|
   config.vm.provision "ansible" do |ansible|
     ansible.playbook = "../ansible/main.yml"
     ansible.groups = {
-      "all_srvs:children" => "boruta_srv",
+      "all_srvs:children" => [ "boruta_srv", "weles_srv" ],
       "boruta_srv" => "default",
       "boruta_srv:vars" => {
-        "gopath" => "~/go"
-      }
+        "gopath" => "${HOME}/go"
+      },
+      "weles_srv" => "default",
+      "weles_srv:vars" => {
+        "gopath" => "${HOME}/go"
+      },
     }
   end
 end