summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick White <git@njw.name>2019-09-05 09:52:44 +0100
committerNick White <git@njw.name>2019-09-05 09:52:44 +0100
commit7db73424b015ebc38e148cb4cb3c804177a1c77a (patch)
tree74e82846a3511919e8811bd419fcbf02840e5cef
parentcec563fbb76cf485527e434f16fe7bcb4e6662cc (diff)
Build go tools for pipeline on host machine
-rw-r--r--roles/pipeliner/tasks/pipeline.yml44
1 files changed, 40 insertions, 4 deletions
diff --git a/roles/pipeliner/tasks/pipeline.yml b/roles/pipeliner/tasks/pipeline.yml
index f3ca30d..e39bbcc 100644
--- a/roles/pipeliner/tasks/pipeline.yml
+++ b/roles/pipeliner/tasks/pipeline.yml
@@ -1,11 +1,47 @@
---
-# TODO: check out and build from repo, and copy into the right place
-- name: Install pipeline tools
+# Needed for stretch as we need golang >= 1.9 (for x/draw dependency), and stretch
+# only has 1.8 available
+- name: Install debian backports
+ lineinfile:
+ path: /etc/apt/sources.list.d/backports.list
+ line: deb http://deb.debian.org/debian stretch-backports main
+ create: yes
+
+# This shouldn't be needed due to update_cache line in the below install rule,
+# however that doesn't seem to trigger for some reason
+- name: Update apt
+ apt:
+ update_cache: yes
+
+- name: Install golang
+ apt:
+ name: golang-go
+ state: present
+ default_release: stretch-backports
+ update_cache: yes
+
+# Do this manually rather than relying on go get so that step can
+# be skipped if nothing has been changed
+- name: Get go repo
+ git: dest=/home/{{ ansible_user }}/src/go/src/rescribe.xyz/go.git repo=https://rescribe.xyz/go.git
+ become: no
+ register: gorepo
+
+- name: Get and build bookpipeline and dependencies
+ command: go get rescribe.xyz/go.git/bookpipeline/...
+ environment:
+ GOPATH: /home/{{ ansible_user }}/src/go
+ become: no
+ when: gorepo.changed
+ register: gobuilt
+
+- name: Install bookpipeline binary
copy:
- src: /home/nick/rescribe/2018-natphil/src/go/src/rescribe.xyz/go.git/bookpipeline/cmd/bookpipeline/bookpipeline
+ remote_src: true
+ src: /home/{{ ansible_user }}/src/go/bin/bookpipeline
dest: /usr/local/bin/
- mode: 0755
+ when: gobuilt
- name: Install systemd unit file
copy: src=bookpipeline.service dest=/etc/systemd/system