From 8aacaee3b7b40a443b52a1e7375e38828ff87bda Mon Sep 17 00:00:00 2001 From: blag Date: Thu, 29 Oct 2020 02:54:23 -0700 Subject: [PATCH 1/3] Check for Ubuntu 16.04 and conditionally install Python 3.6 and configure ST2 to use it --- actions/workflows/st2_pkg_e2e_test.yaml | 26 +++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/actions/workflows/st2_pkg_e2e_test.yaml b/actions/workflows/st2_pkg_e2e_test.yaml index 75fa96d..17bde42 100644 --- a/actions/workflows/st2_pkg_e2e_test.yaml +++ b/actions/workflows/st2_pkg_e2e_test.yaml @@ -156,6 +156,32 @@ tasks: input: hosts: <% ctx().vm_info.private_ip_address %> timeout: 600 + next: + - when: <% succeeded() %> + do: check_for_ubuntu_xenial + check_for_ubuntu_xenial: + action: core.remote + input: + hosts: <% ctx().vm_info.private_ip_address %> + cmd: grep 'Ubuntu 16' /etc/issue + next: + - when: <% succeeded() %> + do: install_python36 + - when: <% failed() %> + do: check_debug_mode + install_python36: + action: core.remote_sudo + input: + hosts: <% ctx().vm_info.private_ip_address %> + cmd: |- + python3 --version + add-apt-repository ppa:deadsnakes/ppa --yes + apt-get update + apt-get install --yes python3.6 + patch /etc/st2/st2.conf < python3_binary = /usr/bin/python3.6 + EOF next: - when: <% succeeded() %> do: check_debug_mode From 0dfc06452ef0f5cfea71a79ce13d4510ef39a787 Mon Sep 17 00:00:00 2001 From: blag Date: Mon, 14 Dec 2020 11:24:33 -0800 Subject: [PATCH 2/3] Install Python 3 packages before running bootstrap script --- actions/workflows/st2_pkg_e2e_test.yaml | 55 +++++++++++++------------ 1 file changed, 28 insertions(+), 27 deletions(-) diff --git a/actions/workflows/st2_pkg_e2e_test.yaml b/actions/workflows/st2_pkg_e2e_test.yaml index 17bde42..87f08e8 100644 --- a/actions/workflows/st2_pkg_e2e_test.yaml +++ b/actions/workflows/st2_pkg_e2e_test.yaml @@ -30,6 +30,7 @@ vars: - vm_windows_id: - vm_fqdn: <% ctx().hostname %>.<% ctx().dns_zone %> - vm_info: + - ubuntu_variant: "" - windows_hostname: <% ctx().hostname %>win - vm_windows_fqdn: <% ctx().hostname %>win.<% ctx().dns_zone %> - installed: @@ -99,12 +100,38 @@ tasks: publish: - vm_info: <% result().output.vm_info %> - vm_id: <% result().output.vm_info.id %> - do: get_bootstrap_script + do: check_for_ubuntu_xenial - when: <% failed() %> publish: - vm_id: <% result().output.get("vm_info", {}).get("id") %> - failed: True do: cleanup + check_for_ubuntu_xenial: + action: core.remote + input: + hosts: <% ctx().vm_info.private_ip_address %> + cmd: cat /etc/issue + next: + - when: <% succeeded() and "Ubuntu 16" in result().get(ctx().vm_info.private_ip_address).stdout %> + publish: + - ubuntu_variant: "Ubuntu 16" + do: add_deadsnakes_ppa + - when: <% succeeded() and not "Ubuntu 16" in result().get(ctx().vm_info.private_ip_address).stdout %> + do: get_bootstrap_script + - when: <% failed() %> + do: check_debug_mode + add_deadsnakes_ppa: + action: core.remote_sudo + input: + hosts: <% ctx().vm_info.private_ip_address %> + cmd: |- + python3 --version + add-apt-repository ppa:deadsnakes/ppa --yes + apt-get update + apt-get install --yes python3.6 + next: + - when: <% succeeded() %> + do: get_bootstrap_script get_bootstrap_script: action: core.remote_sudo input: @@ -156,32 +183,6 @@ tasks: input: hosts: <% ctx().vm_info.private_ip_address %> timeout: 600 - next: - - when: <% succeeded() %> - do: check_for_ubuntu_xenial - check_for_ubuntu_xenial: - action: core.remote - input: - hosts: <% ctx().vm_info.private_ip_address %> - cmd: grep 'Ubuntu 16' /etc/issue - next: - - when: <% succeeded() %> - do: install_python36 - - when: <% failed() %> - do: check_debug_mode - install_python36: - action: core.remote_sudo - input: - hosts: <% ctx().vm_info.private_ip_address %> - cmd: |- - python3 --version - add-apt-repository ppa:deadsnakes/ppa --yes - apt-get update - apt-get install --yes python3.6 - patch /etc/st2/st2.conf < python3_binary = /usr/bin/python3.6 - EOF next: - when: <% succeeded() %> do: check_debug_mode From 7c5468398053e36f75a6c6dce25ab3aef56cd902 Mon Sep 17 00:00:00 2001 From: blag Date: Tue, 15 Dec 2020 12:37:50 -0800 Subject: [PATCH 3/3] Instead of installing the deadsnakes PPA manually, configure the bootstrap script to do it --- actions/workflows/st2_pkg_e2e_test.yaml | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/actions/workflows/st2_pkg_e2e_test.yaml b/actions/workflows/st2_pkg_e2e_test.yaml index 87f08e8..2f1b28e 100644 --- a/actions/workflows/st2_pkg_e2e_test.yaml +++ b/actions/workflows/st2_pkg_e2e_test.yaml @@ -30,13 +30,13 @@ vars: - vm_windows_id: - vm_fqdn: <% ctx().hostname %>.<% ctx().dns_zone %> - vm_info: - - ubuntu_variant: "" - windows_hostname: <% ctx().hostname %>win - vm_windows_fqdn: <% ctx().hostname %>win.<% ctx().dns_zone %> - installed: distro: versions: version_str: not installed + - pipe_into_bootstrap_script: "" - bootstrap_script_url: <% coalesce(ctx().bootstrap_script, "https://raw.githubusercontent.com/StackStorm/st2-packages/" + ctx().bootstrap_branch + "/scripts/st2_bootstrap.sh") %> - bootstrap_script_arg_dev_or_ver: <% switch( @@ -114,24 +114,12 @@ tasks: next: - when: <% succeeded() and "Ubuntu 16" in result().get(ctx().vm_info.private_ip_address).stdout %> publish: - - ubuntu_variant: "Ubuntu 16" - do: add_deadsnakes_ppa + - pipe_into_bootstrap_script: "echo 'y'" + do: get_bootstrap_script - when: <% succeeded() and not "Ubuntu 16" in result().get(ctx().vm_info.private_ip_address).stdout %> do: get_bootstrap_script - when: <% failed() %> do: check_debug_mode - add_deadsnakes_ppa: - action: core.remote_sudo - input: - hosts: <% ctx().vm_info.private_ip_address %> - cmd: |- - python3 --version - add-apt-repository ppa:deadsnakes/ppa --yes - apt-get update - apt-get install --yes python3.6 - next: - - when: <% succeeded() %> - do: get_bootstrap_script get_bootstrap_script: action: core.remote_sudo input: @@ -144,7 +132,10 @@ tasks: action: core.remote_sudo input: hosts: <% ctx().vm_info.private_ip_address %> + # If pipe_into_bootstrap_script is not empty, return it + " | " + # If pipe_into_bootstrap_script is empty, return an empty string cmd: >- + <% switch(ctx().pipe_into_bootstrap_script => concat(ctx().pipe_into_bootstrap_script, " | "), true => "") %> bash /tmp/st2_bootstrap.sh --<% ctx().pkg_env %> --<% ctx().release %>