Prefer downloaded bridge artifact during deploy
This commit is contained in:
parent
bbeaa1c992
commit
68d4554be7
@ -13,6 +13,7 @@ xworkmate_bridge_listen_port: 8787
|
||||
xworkmate_bridge_binary_path: /usr/local/bin/xworkmate-bridge
|
||||
xworkmate_bridge_local_source_dir: "{{ playbook_dir }}/../xworkmate-bridge"
|
||||
xworkmate_bridge_local_build_dir: "{{ playbook_dir }}/.artifacts/xworkmate_bridge"
|
||||
xworkmate_bridge_artifact_path: "{{ lookup('ansible.builtin.env', 'XWORKMATE_BRIDGE_ARTIFACT_PATH') | default('', true) }}"
|
||||
xworkmate_bridge_local_binary_path: "{{ xworkmate_bridge_local_build_dir }}/xworkmate-bridge"
|
||||
xworkmate_bridge_build_goos: linux
|
||||
xworkmate_bridge_build_goarch: amd64
|
||||
|
||||
@ -12,6 +12,26 @@
|
||||
delegate_to: localhost
|
||||
become: false
|
||||
|
||||
- name: Check whether prebuilt xworkmate-bridge artifact exists
|
||||
ansible.builtin.stat:
|
||||
path: "{{ xworkmate_bridge_artifact_path }}"
|
||||
register: xworkmate_bridge_artifact_stat
|
||||
delegate_to: localhost
|
||||
become: false
|
||||
when:
|
||||
- xworkmate_bridge_artifact_path | trim | length > 0
|
||||
|
||||
- name: Prefer downloaded xworkmate-bridge artifact
|
||||
ansible.builtin.copy:
|
||||
src: "{{ xworkmate_bridge_artifact_path }}"
|
||||
dest: "{{ xworkmate_bridge_local_binary_path }}"
|
||||
mode: "0755"
|
||||
delegate_to: localhost
|
||||
become: false
|
||||
when:
|
||||
- xworkmate_bridge_artifact_path | trim | length > 0
|
||||
- xworkmate_bridge_artifact_stat.stat.exists | default(false)
|
||||
|
||||
- name: Build xworkmate-bridge locally
|
||||
ansible.builtin.command:
|
||||
cmd: go build -o "{{ xworkmate_bridge_local_binary_path }}" .
|
||||
@ -24,6 +44,11 @@
|
||||
delegate_to: localhost
|
||||
become: false
|
||||
check_mode: false
|
||||
when:
|
||||
- not (
|
||||
xworkmate_bridge_artifact_path | trim | length > 0 and
|
||||
xworkmate_bridge_artifact_stat.stat.exists | default(false)
|
||||
)
|
||||
|
||||
- name: Upload xworkmate-bridge binary
|
||||
ansible.builtin.copy:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user