From f8c6d7e10416925fc6492ccf081a5785ba791dae Mon Sep 17 00:00:00 2001 From: Felipe Oliveira Date: Tue, 8 Oct 2019 18:27:58 -0300 Subject: [PATCH 01/27] Add lb attach member abd lb dettach member --- CHANGES.md | 4 ++++ actions/lb_attach_member.py | 14 ++++++++++++++ actions/lb_attach_member.yaml | 29 +++++++++++++++++++++++++++++ actions/lb_dettach_member.py | 14 ++++++++++++++ actions/lb_dettach_member.yaml | 29 +++++++++++++++++++++++++++++ pack.yaml | 2 +- 6 files changed, 91 insertions(+), 1 deletion(-) create mode 100644 actions/lb_attach_member.py create mode 100644 actions/lb_attach_member.yaml create mode 100644 actions/lb_dettach_member.py create mode 100644 actions/lb_dettach_member.yaml diff --git a/CHANGES.md b/CHANGES.md index 22cf1ab..b8a3f80 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,9 @@ # Change Log +## 0.5.15 + +- Add attach and dettach lb member + ## 0.5.14 - Add missing project_id at vm_get_info action diff --git a/actions/lb_attach_member.py b/actions/lb_attach_member.py new file mode 100644 index 0000000..595c6c1 --- /dev/null +++ b/actions/lb_attach_member.py @@ -0,0 +1,14 @@ +#!/usr/bin/env python + +from lib.cloudstack import CloudStackAPI + +__all__ = [ + 'LBAttachhMember' +] + + +class LBAttachhMember(CloudStackAPI): + def run(self, url, apikey, secretkey, lb_id, virtualmachineids, virtualmachineids): + cs = self.get_client(url, apikey, secretkey) + + return cs.assignToLoadBalancerRule(id=lb_id, virtualmachineids=virtualmachineids) diff --git a/actions/lb_attach_member.yaml b/actions/lb_attach_member.yaml new file mode 100644 index 0000000..3cae2b9 --- /dev/null +++ b/actions/lb_attach_member.yaml @@ -0,0 +1,29 @@ +--- +name: lb_attach_member +runner_type: python-script +description: Assigns virtual machine or a list of virtual machines to a load balancer rule. +enabled: true +entry_point: lb_attach_member.py +parameters: + url: + type: string + description: URL to use at ACS request + required: false + apikey: + type: string + description: API KEY to use at ACS request + required: true + secret: true + secretkey: + type: string + description: Secret KEY to use at ACS request + required: true + secret: true + lb_id: + type: string + description: ID of a LoadBalancer to retrieve members. + required: true + virtualmachineids: + type: array + description: Array of ID members atach LoadBalancer to retrieve members. + required: true \ No newline at end of file diff --git a/actions/lb_dettach_member.py b/actions/lb_dettach_member.py new file mode 100644 index 0000000..1109133 --- /dev/null +++ b/actions/lb_dettach_member.py @@ -0,0 +1,14 @@ +#!/usr/bin/env python + +from lib.cloudstack import CloudStackAPI + +__all__ = [ + 'LBDettachhMember' +] + + +class LBDettachhMember(CloudStackAPI): + def run(self, url, apikey, secretkey, lb_id, virtualmachineids, virtualmachineids): + cs = self.get_client(url, apikey, secretkey) + + return cs.removeFromLoadBalancerRule(id=lb_id, virtualmachineids=virtualmachineids) diff --git a/actions/lb_dettach_member.yaml b/actions/lb_dettach_member.yaml new file mode 100644 index 0000000..08c8d12 --- /dev/null +++ b/actions/lb_dettach_member.yaml @@ -0,0 +1,29 @@ +--- +name: lb_dettach_member +runner_type: python-script +description: Removes a virtual machine or a list of virtual machines from a load balancer rule. +enabled: true +entry_point: lb_dettach_member.py +parameters: + url: + type: string + description: URL to use at ACS request + required: false + apikey: + type: string + description: API KEY to use at ACS request + required: true + secret: true + secretkey: + type: string + description: Secret KEY to use at ACS request + required: true + secret: true + lb_id: + type: string + description: ID of a LoadBalancer to retrieve members. + required: true + virtualmachineids: + type: array + description: Array of ID members atach LoadBalancer to retrieve members. + required: true \ No newline at end of file diff --git a/pack.yaml b/pack.yaml index 590bc08..3eb5ab8 100644 --- a/pack.yaml +++ b/pack.yaml @@ -8,7 +8,7 @@ keywords: - apache-cloudstack - apache-acs - cloud -version: 0.5.14 +version: 0.5.15 python_versions: - "2" - "3" From 8ab210923bc582d4b5ec7240a1331f737eb16331 Mon Sep 17 00:00:00 2001 From: Felipe Oliveira Date: Tue, 8 Oct 2019 18:35:55 -0300 Subject: [PATCH 02/27] Fix duplicate parameter name --- actions/lb_dettach_member.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/actions/lb_dettach_member.py b/actions/lb_dettach_member.py index 1109133..660764e 100644 --- a/actions/lb_dettach_member.py +++ b/actions/lb_dettach_member.py @@ -8,7 +8,7 @@ class LBDettachhMember(CloudStackAPI): - def run(self, url, apikey, secretkey, lb_id, virtualmachineids, virtualmachineids): + def run(self, url, apikey, secretkey, lb_id, virtualmachineids): cs = self.get_client(url, apikey, secretkey) return cs.removeFromLoadBalancerRule(id=lb_id, virtualmachineids=virtualmachineids) From ebc35477c1a0b8aec30331af5c2c82a27057a6e4 Mon Sep 17 00:00:00 2001 From: Felipe Oliveira Date: Tue, 8 Oct 2019 18:40:59 -0300 Subject: [PATCH 03/27] Change duplicate names --- actions/lb_attach_member.py | 4 ++-- actions/lb_attach_member.yaml | 2 +- actions/lb_dettach_member.py | 4 ++-- actions/lb_dettach_member.yaml | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/actions/lb_attach_member.py b/actions/lb_attach_member.py index 595c6c1..0bbe0fd 100644 --- a/actions/lb_attach_member.py +++ b/actions/lb_attach_member.py @@ -8,7 +8,7 @@ class LBAttachhMember(CloudStackAPI): - def run(self, url, apikey, secretkey, lb_id, virtualmachineids, virtualmachineids): + def run(self, url, apikey, secretkey, lb_id, vm_ids): cs = self.get_client(url, apikey, secretkey) - return cs.assignToLoadBalancerRule(id=lb_id, virtualmachineids=virtualmachineids) + return cs.assignToLoadBalancerRule(id=lb_id, virtualmachineids=vm_ids) diff --git a/actions/lb_attach_member.yaml b/actions/lb_attach_member.yaml index 3cae2b9..5e84a03 100644 --- a/actions/lb_attach_member.yaml +++ b/actions/lb_attach_member.yaml @@ -23,7 +23,7 @@ parameters: type: string description: ID of a LoadBalancer to retrieve members. required: true - virtualmachineids: + vm_ids: type: array description: Array of ID members atach LoadBalancer to retrieve members. required: true \ No newline at end of file diff --git a/actions/lb_dettach_member.py b/actions/lb_dettach_member.py index 660764e..d261017 100644 --- a/actions/lb_dettach_member.py +++ b/actions/lb_dettach_member.py @@ -8,7 +8,7 @@ class LBDettachhMember(CloudStackAPI): - def run(self, url, apikey, secretkey, lb_id, virtualmachineids): + def run(self, url, apikey, secretkey, lb_id, vm_ids): cs = self.get_client(url, apikey, secretkey) - return cs.removeFromLoadBalancerRule(id=lb_id, virtualmachineids=virtualmachineids) + return cs.removeFromLoadBalancerRule(id=lb_id, virtualmachineids=vm_ids) diff --git a/actions/lb_dettach_member.yaml b/actions/lb_dettach_member.yaml index 08c8d12..95cba8a 100644 --- a/actions/lb_dettach_member.yaml +++ b/actions/lb_dettach_member.yaml @@ -23,7 +23,7 @@ parameters: type: string description: ID of a LoadBalancer to retrieve members. required: true - virtualmachineids: + vm_ids: type: array description: Array of ID members atach LoadBalancer to retrieve members. required: true \ No newline at end of file From c4c74c50e232be2e0a485df99edd64b193ea3bce Mon Sep 17 00:00:00 2001 From: Felipe Oliveira Date: Wed, 9 Oct 2019 17:57:57 -0300 Subject: [PATCH 04/27] Add new features attach member lb and dettach member lb in README --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 3885305..12b9547 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,8 @@ url: http://localhost:8080/client/api #### LoadBalancer * `lb_list_members` - list members from a LoadBalancer +* `lb_attach_member` - Assigns virtual machine or a list of virtual machines to a load balancer +* `lb_dettach_member` - Removes a virtual machine or a list of virtual machines from a load balancer #### SSH KeyPair From dc1ea5912a24d8ca198b9bf959f9a07dfc182ced Mon Sep 17 00:00:00 2001 From: Felipe Oliveira Date: Wed, 9 Oct 2019 18:11:24 -0300 Subject: [PATCH 05/27] Add feature list_auto_scale_vm_groups --- actions/list_auto_scale_vm_group.py | 14 ++++++++++++++ actions/list_auto_scale_vm_groups.yaml | 25 +++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 actions/list_auto_scale_vm_group.py create mode 100644 actions/list_auto_scale_vm_groups.yaml diff --git a/actions/list_auto_scale_vm_group.py b/actions/list_auto_scale_vm_group.py new file mode 100644 index 0000000..e8cddba --- /dev/null +++ b/actions/list_auto_scale_vm_group.py @@ -0,0 +1,14 @@ +#!/usr/bin/env python + +from lib.cloudstack import CloudStackAPI + +__all__ = [ + 'ListAutoScaleVmGroups' +] + + +class ListAutoScaleVmGroups(CloudStackAPI): + def run(self, url, apikey, secretkey, lb_id): + cs = self.get_client(url, apikey, secretkey) + + return cs.listAutoScaleVmGroups(lbruleid=lb_id) diff --git a/actions/list_auto_scale_vm_groups.yaml b/actions/list_auto_scale_vm_groups.yaml new file mode 100644 index 0000000..c06ed9e --- /dev/null +++ b/actions/list_auto_scale_vm_groups.yaml @@ -0,0 +1,25 @@ +--- +name: list_auto_scale_vm_groups +runner_type: python-script +description: Lists autoscale vm groups. +enabled: true +entry_point: list_auto_scale_vm_groups.py +parameters: + url: + type: string + description: URL to use at ACS request + required: false + apikey: + type: string + description: API KEY to use at ACS request + required: true + secret: true + secretkey: + type: string + description: Secret KEY to use at ACS request + required: true + secret: true + lb_id: + type: string + description: ID of a LoadBalancer to retrieve members. + required: true \ No newline at end of file From 7173a52f503d8af83f8c668ccf81f3a06be41d2e Mon Sep 17 00:00:00 2001 From: Felipe Oliveira Date: Wed, 9 Oct 2019 18:21:44 -0300 Subject: [PATCH 06/27] Rename actions/list_auto_scale_vm_group.py to actions/list_auto_scale_vm_groups.py --- .../{list_auto_scale_vm_group.py => list_auto_scale_vm_groups.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename actions/{list_auto_scale_vm_group.py => list_auto_scale_vm_groups.py} (100%) diff --git a/actions/list_auto_scale_vm_group.py b/actions/list_auto_scale_vm_groups.py similarity index 100% rename from actions/list_auto_scale_vm_group.py rename to actions/list_auto_scale_vm_groups.py From 02f07ab09be317486ea7989f1b8d1249760687c6 Mon Sep 17 00:00:00 2001 From: Felipe Oliveira Date: Wed, 9 Oct 2019 18:37:14 -0300 Subject: [PATCH 07/27] Add parameter projectid --- actions/list_auto_scale_vm_groups.py | 4 ++-- actions/list_auto_scale_vm_groups.yaml | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/actions/list_auto_scale_vm_groups.py b/actions/list_auto_scale_vm_groups.py index e8cddba..a1eb820 100644 --- a/actions/list_auto_scale_vm_groups.py +++ b/actions/list_auto_scale_vm_groups.py @@ -8,7 +8,7 @@ class ListAutoScaleVmGroups(CloudStackAPI): - def run(self, url, apikey, secretkey, lb_id): + def run(self, url, apikey, secretkey, lb_id, projectid): cs = self.get_client(url, apikey, secretkey) - return cs.listAutoScaleVmGroups(lbruleid=lb_id) + return cs.listAutoScaleVmGroups(lbruleid=lb_id, projectid=projectid) diff --git a/actions/list_auto_scale_vm_groups.yaml b/actions/list_auto_scale_vm_groups.yaml index c06ed9e..9d12db5 100644 --- a/actions/list_auto_scale_vm_groups.yaml +++ b/actions/list_auto_scale_vm_groups.yaml @@ -22,4 +22,8 @@ parameters: lb_id: type: string description: ID of a LoadBalancer to retrieve members. - required: true \ No newline at end of file + required: true + projectid: + type: string + description: ID of a project. + required: true From 423e8d5c1a30eea9c78e3efaabebcdfbd6e36a02 Mon Sep 17 00:00:00 2001 From: Felipe Oliveira Date: Wed, 9 Oct 2019 18:45:13 -0300 Subject: [PATCH 08/27] Update version 0.5.16 with changes feature listAutoScaleVmGroups --- CHANGES.md | 4 ++++ README.md | 3 +++ pack.yaml | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index b8a3f80..73cacfc 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,9 @@ # Change Log +## 0.5.16 + +- Add feature listAutoScaleVmGroups + ## 0.5.15 - Add attach and dettach lb member diff --git a/README.md b/README.md index 12b9547..c9b7b3a 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,9 @@ url: http://localhost:8080/client/api * `lb_attach_member` - Assigns virtual machine or a list of virtual machines to a load balancer * `lb_dettach_member` - Removes a virtual machine or a list of virtual machines from a load balancer +### AutoScale +* `listAutoScaleVmGroups` - list listAutoScaleVmGroups + #### SSH KeyPair * `sshkeypair_create` - create a SSH KeyPair diff --git a/pack.yaml b/pack.yaml index 3eb5ab8..c8b5fcf 100644 --- a/pack.yaml +++ b/pack.yaml @@ -8,7 +8,7 @@ keywords: - apache-cloudstack - apache-acs - cloud -version: 0.5.15 +version: 0.5.16 python_versions: - "2" - "3" From 0569bcc219224518c25b2e71afa92d1bcc5b0a34 Mon Sep 17 00:00:00 2001 From: Felipe Nicodemos Date: Thu, 10 Oct 2019 10:49:45 -0300 Subject: [PATCH 09/27] Update pack.yaml Co-Authored-By: Eugen C. --- pack.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pack.yaml b/pack.yaml index c8b5fcf..0a3d64a 100644 --- a/pack.yaml +++ b/pack.yaml @@ -8,9 +8,9 @@ keywords: - apache-cloudstack - apache-acs - cloud -version: 0.5.16 +version: 0.6.0 python_versions: - "2" - "3" author: Globo.com -email: a-team@corp.globo.com \ No newline at end of file +email: a-team@corp.globo.com From 8618b2bca0eb47e42b9679578e09d4801f028e93 Mon Sep 17 00:00:00 2001 From: Felipe Oliveira Date: Thu, 10 Oct 2019 11:24:30 -0300 Subject: [PATCH 10/27] Add features enable_auto_scale_vm_groups and disable_auto_scale_vm_groups --- CHANGES.md | 7 ++++++- README.md | 2 ++ actions/disable_auto-scale_vm_groups.yaml | 25 +++++++++++++++++++++++ actions/disable_auto_scale_vm_groups.py | 14 +++++++++++++ actions/enable_auto_scale_vm_groups.py | 14 +++++++++++++ actions/enable_auto_scale_vm_groups.yaml | 25 +++++++++++++++++++++++ pack.yaml | 2 +- 7 files changed, 87 insertions(+), 2 deletions(-) create mode 100644 actions/disable_auto-scale_vm_groups.yaml create mode 100644 actions/disable_auto_scale_vm_groups.py create mode 100644 actions/enable_auto_scale_vm_groups.py create mode 100644 actions/enable_auto_scale_vm_groups.yaml diff --git a/CHANGES.md b/CHANGES.md index 73cacfc..b6bf4d5 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,11 @@ # Change Log -## 0.5.16 +## 0.7.0 + +- Add feature enableAutoScaleVmGroups +- Add feature disableAutoScaleVmGroups + +## 0.6.0 - Add feature listAutoScaleVmGroups diff --git a/README.md b/README.md index c9b7b3a..4f8e5b7 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,8 @@ url: http://localhost:8080/client/api ### AutoScale * `listAutoScaleVmGroups` - list listAutoScaleVmGroups +* `enableAutoScaleVmGroups` - enable AutoScaleVmGroups +* `disableAutoScaleVmGroups` - disable AutoScaleVmGroups #### SSH KeyPair diff --git a/actions/disable_auto-scale_vm_groups.yaml b/actions/disable_auto-scale_vm_groups.yaml new file mode 100644 index 0000000..e7c6cd3 --- /dev/null +++ b/actions/disable_auto-scale_vm_groups.yaml @@ -0,0 +1,25 @@ +--- +name: disable_auto_scale_vm_groups +runner_type: python-script +description: Disables an AutoScale Vm Group. +enabled: true +entry_point: disable_auto_scale_vm_groups.py +parameters: + url: + type: string + description: URL to use at ACS request + required: false + apikey: + type: string + description: API KEY to use at ACS request + required: true + secret: true + secretkey: + type: string + description: Secret KEY to use at ACS request + required: true + secret: true + id: + type: string + description: the ID of the autoscale group. + required: true diff --git a/actions/disable_auto_scale_vm_groups.py b/actions/disable_auto_scale_vm_groups.py new file mode 100644 index 0000000..d154362 --- /dev/null +++ b/actions/disable_auto_scale_vm_groups.py @@ -0,0 +1,14 @@ +#!/usr/bin/env python + +from lib.cloudstack import CloudStackAPI + +__all__ = [ + 'DisableAutoScaleVmGroups' +] + + +class DisableAutoScaleVmGroups(CloudStackAPI): + def run(self, url, apikey, secretkey, id): + cs = self.get_client(url, apikey, secretkey) + + return cs.disableAutoScaleVmGroup(id=id) diff --git a/actions/enable_auto_scale_vm_groups.py b/actions/enable_auto_scale_vm_groups.py new file mode 100644 index 0000000..8b22444 --- /dev/null +++ b/actions/enable_auto_scale_vm_groups.py @@ -0,0 +1,14 @@ +#!/usr/bin/env python + +from lib.cloudstack import CloudStackAPI + +__all__ = [ + 'EnableAutoScaleVmGroups' +] + + +class EnableAutoScaleVmGroups(CloudStackAPI): + def run(self, url, apikey, secretkey, id): + cs = self.get_client(url, apikey, secretkey) + + return cs.enableAutoScaleVmGroup(id=id) diff --git a/actions/enable_auto_scale_vm_groups.yaml b/actions/enable_auto_scale_vm_groups.yaml new file mode 100644 index 0000000..8cb8ecd --- /dev/null +++ b/actions/enable_auto_scale_vm_groups.yaml @@ -0,0 +1,25 @@ +--- +name: enable_auto_scale_vm_groups +runner_type: python-script +description: Enables an AutoScale Vm Group. +enabled: true +entry_point: enable_auto_scale_vm_groups.py +parameters: + url: + type: string + description: URL to use at ACS request + required: false + apikey: + type: string + description: API KEY to use at ACS request + required: true + secret: true + secretkey: + type: string + description: Secret KEY to use at ACS request + required: true + secret: true + id: + type: string + description: the ID of the autoscale group. + required: true diff --git a/pack.yaml b/pack.yaml index 0a3d64a..33f8558 100644 --- a/pack.yaml +++ b/pack.yaml @@ -8,7 +8,7 @@ keywords: - apache-cloudstack - apache-acs - cloud -version: 0.6.0 +version: 0.7.0 python_versions: - "2" - "3" From 84efd53e3da719f6c8200d461d1e826f6fdcb54c Mon Sep 17 00:00:00 2001 From: Felipe Nicodemos Date: Thu, 10 Oct 2019 11:39:35 -0300 Subject: [PATCH 11/27] Update CHANGES.md Co-Authored-By: Eugen C. --- CHANGES.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 73cacfc..65cb8e1 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,6 @@ # Change Log -## 0.5.16 +## 0.6.0 - Add feature listAutoScaleVmGroups @@ -95,4 +95,4 @@ ## 0.1.0 -- Initial pack integration \ No newline at end of file +- Initial pack integration From dbe958fdac3d30f1f186171c8960238301b32ba4 Mon Sep 17 00:00:00 2001 From: Tomaz Muraus Date: Thu, 31 Oct 2019 12:08:10 +0100 Subject: [PATCH 12/27] Add missing LICENSE file. --- LICENSE | 201 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 201 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..8dada3e --- /dev/null +++ b/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. From cb1cc68c32aac485a7ef250af5906d0e5c946c4a Mon Sep 17 00:00:00 2001 From: blag Date: Fri, 21 Feb 2020 18:22:08 -0800 Subject: [PATCH 13/27] Block deployment until both Python 2 and 3 tests pass --- .circleci/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 9eecffa..e989228 100755 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -123,6 +123,7 @@ workflows: - deploy: requires: - build_and_test_python27 + - build_and_test_python36 filters: branches: only: master From 764554714a6fc3e821553315def30f4e5f879103 Mon Sep 17 00:00:00 2001 From: Rodrigo Ribeiro Date: Wed, 25 Mar 2020 13:19:27 -0300 Subject: [PATCH 14/27] implementing globo loadbalancer creation action --- actions/lb_dettach_member.yaml | 2 +- actions/lb_globo_create.py | 31 ++++++++++++++ actions/lb_globo_create.yml | 78 ++++++++++++++++++++++++++++++++++ actions/lib/cloudstack.py | 5 ++- 4 files changed, 113 insertions(+), 3 deletions(-) create mode 100644 actions/lb_globo_create.py create mode 100644 actions/lb_globo_create.yml diff --git a/actions/lb_dettach_member.yaml b/actions/lb_dettach_member.yaml index 95cba8a..ca3d5f8 100644 --- a/actions/lb_dettach_member.yaml +++ b/actions/lb_dettach_member.yaml @@ -26,4 +26,4 @@ parameters: vm_ids: type: array description: Array of ID members atach LoadBalancer to retrieve members. - required: true \ No newline at end of file + required: true diff --git a/actions/lb_globo_create.py b/actions/lb_globo_create.py new file mode 100644 index 0000000..fbd6a34 --- /dev/null +++ b/actions/lb_globo_create.py @@ -0,0 +1,31 @@ +#!/usr/bin/env python + +from lib.cloudstack import CloudStackAPI + +__all__ = [ + 'LBGloboCreate' +] + + +class LBGloboCreate(CloudStackAPI): + def run(self, url, apikey, secretkey, name, algorithm, publicport, + privateport, projectid, openfirewall, networkid, + additionalportmap, healthchecktype, healthcheckrequest, + expectedhealthcheck, lbenvironmentid, timeoutrequest): + + cs = self.get_client(url, apikey, secretkey, timeout=timeoutrequest) + + return cs.createGloboLoadBalancer( + algorithm=algorithm, + name=name, + publicport=publicport, + projectid=projectid, + privateport=privateport, + openfirewall=str(openfirewall), + networkid=networkid, + additionalportmap=additionalportmap, + healthcheckType=healthchecktype, + healthchecktype=healthcheckrequest, + expectedhealthcheck=expectedhealthcheck, + lbenvironmentid=str(lbenvironmentid) + ) diff --git a/actions/lb_globo_create.yml b/actions/lb_globo_create.yml new file mode 100644 index 0000000..a81fa47 --- /dev/null +++ b/actions/lb_globo_create.yml @@ -0,0 +1,78 @@ +--- +name: lb_globo_create +runner_type: python-script +description: Create Globo LoadBalancer +enabled: true +entry_point: lb_globo_create +parameters: + url: + type: string + description: URL to use at ACS request + required: false + apiKey: + type: string + description: API KEY to use at ACS request + required: true + secret: true + secretkey: + type: string + description: Secret KEY to use at ACS request + required: true + secret: true + name: + type: string + description: name of the load balancer + required: true + algorithm: + type: string + description: load balancer algorithm (source, roundrobin, leastconn) + required: true + publicport: + type: integer + description: the public port from where the network traffic will be load balanced from + required: true + privateport: + type: integer + description: the private port of the private IP address/virtual machine where the network traffic will be load balanced to + required: true + projectid: + type: string + description: id of the project to which the loadbalancer belongs + required: true + openfirewall: + type: boolean + description: id of the project to which the loadbalancer belongs + default: false + required: false + networkid: + type: string + description: The guest network this rule will be created for. Required when public Ip address is not associated with any Guest network yet (VPC case) + required: true + additionalportmap: + type: string + description: "Addional port map (pattern sample: 80:80)" + required: false + healthchecktype: + type: string + description: "Heath check protocol (example: HTTP, TCP)" + required: false + default: HTTP + healthcheckrequest: + type: string + description: "Path health check request (example: /healthcheck.html)" + required: false + default: "/" + expectedhealthcheck: + type: string + description: "Expected health check (example: 200 ok)" + required: false + default: "200 OK" + lbenvironmentid: + type: integer + description: "Load balancer environment id" + required: true + timeoutrequest: + type: integer + description: Timeout request in seconds + required: false + default: 35 diff --git a/actions/lib/cloudstack.py b/actions/lib/cloudstack.py index f4c526c..1dc857c 100644 --- a/actions/lib/cloudstack.py +++ b/actions/lib/cloudstack.py @@ -12,7 +12,7 @@ class CloudStackAPI(Action): def __init__(self, config): super(CloudStackAPI, self).__init__(config=config) - def get_client(self, url, apikey, secretkey): + def get_client(self, url, apikey, secretkey, timeout=10): url_temp = self.config.get('url') if url != "" and url is not None: @@ -23,5 +23,6 @@ def get_client(self, url, apikey, secretkey): secret=secretkey, dangerous_no_tls_verify=True, fetch_result=True, - method='POST') + method='POST', + timeout=timeout) return cs From 69cae2c2dbcc9a0772e5b3d77f0f6c5431a502b8 Mon Sep 17 00:00:00 2001 From: Rodrigo Ribeiro Date: Wed, 25 Mar 2020 15:43:44 -0300 Subject: [PATCH 15/27] correcting entrypoint file name --- actions/lb_globo_create.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/actions/lb_globo_create.yml b/actions/lb_globo_create.yml index a81fa47..e36789c 100644 --- a/actions/lb_globo_create.yml +++ b/actions/lb_globo_create.yml @@ -3,7 +3,7 @@ name: lb_globo_create runner_type: python-script description: Create Globo LoadBalancer enabled: true -entry_point: lb_globo_create +entry_point: lb_globo_create.py parameters: url: type: string From 6c41d07901cbf1f835505de99b0fde9a3177388b Mon Sep 17 00:00:00 2001 From: Rodrigo Ribeiro Date: Wed, 25 Mar 2020 15:52:42 -0300 Subject: [PATCH 16/27] correcting apikey parameter name --- actions/lb_globo_create.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/actions/lb_globo_create.yml b/actions/lb_globo_create.yml index e36789c..cc2bcf7 100644 --- a/actions/lb_globo_create.yml +++ b/actions/lb_globo_create.yml @@ -9,7 +9,7 @@ parameters: type: string description: URL to use at ACS request required: false - apiKey: + apikey: type: string description: API KEY to use at ACS request required: true From d85db26cefd8070d5f3169e3cf9f5e2f6d2ebbc2 Mon Sep 17 00:00:00 2001 From: Rodrigo Ribeiro Date: Wed, 25 Mar 2020 16:14:26 -0300 Subject: [PATCH 17/27] correcting healthcheckrequest argument --- actions/lb_globo_create.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/actions/lb_globo_create.py b/actions/lb_globo_create.py index fbd6a34..0e62206 100644 --- a/actions/lb_globo_create.py +++ b/actions/lb_globo_create.py @@ -25,7 +25,7 @@ def run(self, url, apikey, secretkey, name, algorithm, publicport, networkid=networkid, additionalportmap=additionalportmap, healthcheckType=healthchecktype, - healthchecktype=healthcheckrequest, + healthcheckrequest=healthcheckrequest, expectedhealthcheck=expectedhealthcheck, lbenvironmentid=str(lbenvironmentid) ) From 392d50c5a8d8a5c4d14795e8ad3be7540b8747f2 Mon Sep 17 00:00:00 2001 From: Rodrigo Ribeiro Date: Wed, 25 Mar 2020 16:30:15 -0300 Subject: [PATCH 18/27] changing readme --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 4f8e5b7..369c872 100644 --- a/README.md +++ b/README.md @@ -44,6 +44,7 @@ url: http://localhost:8080/client/api * `lb_list_members` - list members from a LoadBalancer * `lb_attach_member` - Assigns virtual machine or a list of virtual machines to a load balancer * `lb_dettach_member` - Removes a virtual machine or a list of virtual machines from a load balancer +* `lb_globo_create` - Creates a load balancer Globo ### AutoScale * `listAutoScaleVmGroups` - list listAutoScaleVmGroups From 6cdb8fbad1bfe554aa15e9ad0a6198409c6cdd33 Mon Sep 17 00:00:00 2001 From: Jean da Silva Felix Date: Thu, 26 Mar 2020 14:14:04 -0300 Subject: [PATCH 19/27] Update CHANGES.md --- CHANGES.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index dc0f53d..ea51846 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,7 @@ # Change Log +## 0.8.0 +- Add feature create load balancer globo ## 0.7.0 - Add feature enableAutoScaleVmGroups From 273a3380dfcb5e7dd851a787867d98368d89b321 Mon Sep 17 00:00:00 2001 From: Jean da Silva Felix Date: Thu, 26 Mar 2020 14:20:27 -0300 Subject: [PATCH 20/27] Update version --- pack.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pack.yaml b/pack.yaml index 33f8558..fa9ca2a 100644 --- a/pack.yaml +++ b/pack.yaml @@ -8,7 +8,7 @@ keywords: - apache-cloudstack - apache-acs - cloud -version: 0.7.0 +version: 0.8.0 python_versions: - "2" - "3" From 36a0b5c7797ad8a9535bf67cec0bcc97d35edbb8 Mon Sep 17 00:00:00 2001 From: Nick Maludy Date: Tue, 19 May 2020 11:54:02 -0400 Subject: [PATCH 21/27] Fixing deploy workflow by updating apt cache during this build phase --- .circleci/config.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e989228..5d45587 100755 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -105,7 +105,9 @@ jobs: at: / - run: name: Install dependencies - command: sudo apt -y install gmic optipng + command: | + sudo apt-get update + sudo apt -y install gmic optipng - run: # NOTE: We try to retry the script up to 5 times if it fails. The command could fail due # to the race (e.g. we try to push changes to index, but index has been updated by some From 6bf4e778a30cb34204ace929b2d1bba09647dcbe Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Fri, 29 Jan 2021 19:10:51 -0600 Subject: [PATCH 22/27] Test infra for py2.7 is broken. Drop it. We will no longer test packs with python2.7, as it is broken and the fix (re-adding 2.7) is too invasive across all of our infrastructure. on-behalf-of: @StackStorm-Exchange --- .circleci/config.yml | 63 +++++++++----------------------------------- 1 file changed, 13 insertions(+), 50 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 5d45587..c2a710b 100755 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,51 +1,6 @@ version: 2 jobs: - build_and_test_python27: - docker: - - image: circleci/python:2.7 - - image: rabbitmq:3 - - image: mongo:3.4 - - working_directory: ~/repo - - environment: - VIRTUALENV_DIR: "~/virtualenv" - # Don't install various StackStorm dependencies which are already - # installed by CI again in the various check scripts - ST2_INSTALL_DEPS: "0" - - steps: - - checkout - - restore_cache: - key: v1-dependency-cache-py27-{{ checksum "requirements.txt" }} - - run: - name: Download dependencies - command: | - git clone -b master git://github.com/stackstorm-exchange/ci.git ~/ci - ~/ci/.circle/dependencies - - run: - name: Run tests (Python 2.7) - command: ~/ci/.circle/test - - save_cache: - key: v1-dependency-cache-py27-{{ checksum "requirements.txt" }} - paths: - - ~/.cache/pip - - ~/.apt-cache - # NOTE: We use virtualenv files from Python 2.7 step in "deploy" job so we - # only persist paths from this job - - persist_to_workspace: - root: / - paths: - - home/circleci/ci - - home/circleci/virtualenv - - tmp/st2 - - home/circleci/repo - - home/circleci/.gitconfig - - # NOTE: Until we add "python_version" metadata attribute to pack.yaml and - # explicitly call which packs work with Python 3.x, Python 3.x failures are - # not considered fatal build_and_test_python36: docker: - image: circleci/python:3.6 @@ -87,10 +42,21 @@ jobs: paths: - ~/.cache/pip - ~/.apt-cache + # NOTE: We use virtualenv files from Python 3.6 step in "deploy" job so we + # only persist paths from this job + - persist_to_workspace: + root: / + paths: + - home/circleci/ci + - home/circleci/virtualenv + - tmp/st2 + - home/circleci/repo + - home/circleci/.gitconfig + deploy: docker: - - image: circleci/python:2.7 + - image: circleci/python:3.6 working_directory: ~/repo @@ -100,7 +66,7 @@ jobs: steps: - checkout - restore_cache: - key: v1-dependency-cache-py27-{{ checksum "requirements.txt" }} + key: v1-dependency-cache-py36-{{ checksum "requirements.txt" }} - attach_workspace: at: / - run: @@ -120,18 +86,15 @@ workflows: # Workflow which runs on each push build_test_deploy_on_push: jobs: - - build_and_test_python27 - build_and_test_python36 - deploy: requires: - - build_and_test_python27 - build_and_test_python36 filters: branches: only: master build_test_weekly: jobs: - - build_and_test_python27 - build_and_test_python36 # Workflow which runs nightly - note we don't perform deploy job on nightly # build From 3493f7b1c3d34f0f8f5333dea3fdca6756a9f4d8 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Thu, 4 Feb 2021 21:06:02 -0600 Subject: [PATCH 23/27] drop py2 support on-behalf-of: @StackStorm-Exchange --- CHANGES.md | 4 ++++ pack.yaml | 3 +-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index ea51846..863ea31 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,9 @@ # Change Log +## 1.0.0 + +* Drop Python 2.7 support + ## 0.8.0 - Add feature create load balancer globo diff --git a/pack.yaml b/pack.yaml index fa9ca2a..5d85240 100644 --- a/pack.yaml +++ b/pack.yaml @@ -8,9 +8,8 @@ keywords: - apache-cloudstack - apache-acs - cloud -version: 0.8.0 +version: 1.0.0 python_versions: - - "2" - "3" author: Globo.com email: a-team@corp.globo.com From 8ced86c98260657078689b112df92ba1d8f348fb Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Fri, 5 Feb 2021 14:45:39 -0600 Subject: [PATCH 24/27] drop the deploy retry script on-behalf-of: @StackStorm-Exchange --- .circleci/config.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index c2a710b..81bbc28 100755 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -75,11 +75,8 @@ jobs: sudo apt-get update sudo apt -y install gmic optipng - run: - # NOTE: We try to retry the script up to 5 times if it fails. The command could fail due - # to the race (e.g. we try to push changes to index, but index has been updated by some - # other pack in the mean time) name: Update exchange.stackstorm.org - command: ~/ci/.circle/retry_on_failure.sh ~/ci/.circle/deployment + command: ~/ci/.circle/deployment workflows: version: 2 From b3d1b611b5a845552a9a2ed54b00d029dc0291a2 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Mon, 8 Feb 2021 15:44:44 -0600 Subject: [PATCH 25/27] Updates for ci#104 (use github graphql in deployment) on-behalf-of: @StackStorm-Exchange --- .circleci/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 81bbc28..4cc43b8 100755 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -74,6 +74,7 @@ jobs: command: | sudo apt-get update sudo apt -y install gmic optipng + ~/ci/.circle/install_gh - run: name: Update exchange.stackstorm.org command: ~/ci/.circle/deployment From c12f4373f47fa6b6346c15822f6ee2e30b3e4645 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Mon, 8 Feb 2021 21:58:32 -0600 Subject: [PATCH 26/27] Revert "drop the deploy retry script" This reverts commit 8ced86c98260657078689b112df92ba1d8f348fb. --- .circleci/config.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 4cc43b8..a8b0b41 100755 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -76,8 +76,11 @@ jobs: sudo apt -y install gmic optipng ~/ci/.circle/install_gh - run: + # NOTE: We try to retry the script up to 5 times if it fails. The command could fail due + # to the race (e.g. we try to push changes to index, but index has been updated by some + # other pack in the mean time) name: Update exchange.stackstorm.org - command: ~/ci/.circle/deployment + command: ~/ci/.circle/retry_on_failure.sh ~/ci/.circle/deployment workflows: version: 2 From 4f693e0fab0de5ccb94f2c521540d3eea0b11882 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Sun, 19 Dec 2021 01:26:36 -0600 Subject: [PATCH 27/27] Use Github Actions instead of CirclecI --- .circleci/config.yml | 104 ++------------------------ .github/workflows/build_and_test.yaml | 17 +++++ .github/workflows/release.yaml | 25 +++++++ 3 files changed, 47 insertions(+), 99 deletions(-) create mode 100644 .github/workflows/build_and_test.yaml create mode 100644 .github/workflows/release.yaml diff --git a/.circleci/config.yml b/.circleci/config.yml index a8b0b41..4664451 100755 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,110 +1,16 @@ version: 2 jobs: - build_and_test_python36: + circleci_is_disabled_job: docker: - - image: circleci/python:3.6 - - image: rabbitmq:3 - - image: mongo:3.4 - - working_directory: ~/repo - - environment: - VIRTUALENV_DIR: "~/virtualenv" - # Don't install various StackStorm dependencies which are already - # installed by CI again in the various check scripts - ST2_INSTALL_DEPS: "0" - + - image: cimg/base:stable steps: - - checkout - - restore_cache: - key: v1-dependency-cache-py36-{{ checksum "requirements.txt" }} - - run: - name: Download dependencies - # NOTE: We don't want to use default "-e" option because this means - # step will fail immediately on one of the commands failures and we - # can't intercept the error and cause non-fatal exit in case pack - # doesn't declare support for Python 3 - shell: /bin/bash - command: | - git clone -b master git://github.com/stackstorm-exchange/ci.git ~/ci - ~/ci/.circle/dependencies ; ~/ci/.circle/exit_on_py3_checks $? - run: - name: Run tests (Python 3.6) - # NOTE: We don't want to use default "-e" option because this means - # step will fail immediately on one of the commands failures and we - # can't intercept the error and cause non-fatal exit in case pack - # doesn't declare support for Python 3 shell: /bin/bash - command: ~/ci/.circle/test ; ~/ci/.circle/exit_on_py3_checks $? - - save_cache: - key: v1-dependency-cache-py36-{{ checksum "requirements.txt" }} - paths: - - ~/.cache/pip - - ~/.apt-cache - # NOTE: We use virtualenv files from Python 3.6 step in "deploy" job so we - # only persist paths from this job - - persist_to_workspace: - root: / - paths: - - home/circleci/ci - - home/circleci/virtualenv - - tmp/st2 - - home/circleci/repo - - home/circleci/.gitconfig - - - deploy: - docker: - - image: circleci/python:3.6 - - working_directory: ~/repo - - environment: - VIRTUALENV_DIR: "~/virtualenv" - - steps: - - checkout - - restore_cache: - key: v1-dependency-cache-py36-{{ checksum "requirements.txt" }} - - attach_workspace: - at: / - - run: - name: Install dependencies - command: | - sudo apt-get update - sudo apt -y install gmic optipng - ~/ci/.circle/install_gh - - run: - # NOTE: We try to retry the script up to 5 times if it fails. The command could fail due - # to the race (e.g. we try to push changes to index, but index has been updated by some - # other pack in the mean time) - name: Update exchange.stackstorm.org - command: ~/ci/.circle/retry_on_failure.sh ~/ci/.circle/deployment + command: echo CircleCI disabled on StackStorm-Exchange workflows: version: 2 - # Workflow which runs on each push - build_test_deploy_on_push: - jobs: - - build_and_test_python36 - - deploy: - requires: - - build_and_test_python36 - filters: - branches: - only: master - build_test_weekly: + circleci_is_disabled: jobs: - - build_and_test_python36 - # Workflow which runs nightly - note we don't perform deploy job on nightly - # build - triggers: - # Run nightly build for the pack - - schedule: - # NOTE: We run it at 1 am UTC on every Sunday - cron: "0 1 * * 0" - filters: - branches: - only: - - master + - circleci_is_disabled_job diff --git a/.github/workflows/build_and_test.yaml b/.github/workflows/build_and_test.yaml new file mode 100644 index 0000000..07317f9 --- /dev/null +++ b/.github/workflows/build_and_test.yaml @@ -0,0 +1,17 @@ +name: CI + +on: + pull_request: + schedule: + # NOTE: We run this weekly at 1 am UTC on every Sunday + - cron: '0 1 * * 0' + +jobs: + # This is mirrored in the release workflow. + build_and_test: + name: 'Build and Test' + uses: StackStorm-Exchange/ci/.github/workflows/pack-build_and_test.yaml@master + with: + enable-common-libs: true + #apt-cache-version: v0 + #py-cache-version: v0 diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..9896772 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,25 @@ +name: Release + +on: + push: + branches: + # the default branch + - master + +permissions: + contents: write + +jobs: + # This mirrors build_and_test workflow + build_and_test: + name: 'Build and Test' + uses: StackStorm-Exchange/ci/.github/workflows/pack-build_and_test.yaml@master + with: + enable-common-libs: true + #apt-cache-version: v0 + #py-cache-version: v0 + + tag_release: + needs: build_and_test + name: Tag Release + uses: StackStorm-Exchange/ci/.github/workflows/pack-tag_release.yaml@master