From 00afe20fac63f48fbe48ff0136949d779c0d5237 Mon Sep 17 00:00:00 2001 From: Nick White Date: Tue, 1 Sep 2020 19:39:56 +0100 Subject: Ensure go modules are always used by the updatepipeline script --- README | 2 +- roles/pipeliner/tasks/pipeline.yml | 29 +++++++++++++++++++++-------- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/README b/README index bf36167..6d2b461 100644 --- a/README +++ b/README @@ -20,7 +20,7 @@ To create a fresh pipeliner image: host_vars/pipelineami - Run ansible: - ansible-playbook -i hosts pipeliner.yml + ansible-playbook --ask-vault-pass -i hosts pipeliner.yml - Get names of old images for reference: aws ec2 describe-images --owners self diff --git a/roles/pipeliner/tasks/pipeline.yml b/roles/pipeliner/tasks/pipeline.yml index 582e5de..9eaa5b9 100644 --- a/roles/pipeliner/tasks/pipeline.yml +++ b/roles/pipeliner/tasks/pipeline.yml @@ -21,23 +21,36 @@ 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 +# Do this manually rather than relying on go get so that go get +# with modules enabled can be run to do the build - name: Get go repo - git: dest=/home/{{ ansible_user }}/src/go/src/rescribe.xyz/{{ item }} repo=https://git.rescribe.xyz/{{ item }} + git: + dest: /home/{{ ansible_user }}/src/go/src/rescribe.xyz/{{ item }} + repo: https://git.rescribe.xyz/{{ item }} + force: yes become: no with_items: - bookpipeline - preproc - utils - register: gorepo - name: Get and build bookpipeline and dependencies - command: go get -u rescribe.xyz/bookpipeline/... - environment: - GOPATH: /home/{{ ansible_user }}/src/go + shell: + cmd: GOPATH=/home/{{ ansible_user }}/src/go GO111MODULE=on go get -u rescribe.xyz/bookpipeline/... + chdir: /home/{{ ansible_user }}/src/go/src/rescribe.xyz/bookpipeline become: no - when: gorepo.changed +# command fails because of a strange error with environment, resulting in +# 'go: unknown environment setting GO111MODULE=True' +# so we're setting it from the shell instead. +# we should be able to revert back to command once using a more recent +# go version where GO111MODULE is not required. +# command: +# cmd: go get -u rescribe.xyz/bookpipeline/... +# chdir: /home/{{ ansible_user }}/src/go/src/rescribe.xyz/bookpipeline +# environment: +# GOPATH: /home/{{ ansible_user }}/src/go +# GO111MODULE: on +# become: no - name: Install bookpipeline binary copy: -- cgit v1.2.1-24-ge1ad