automation: establish an automation framework

This commit is contained in:
Iain Learmonth 2022-05-08 17:20:04 +01:00
parent 1b53bf451c
commit 8abe5d60fa
31 changed files with 586 additions and 274 deletions

View file

@ -5,12 +5,12 @@ from app.lists.mirror_mapping import mirror_mapping
from app.lists.bc2 import mirror_sites
from app.lists.bridgelines import bridgelines
from app.models.base import MirrorList
from app.terraform import BaseAutomation
from app.terraform.terraform import TerraformAutomation
class ListAutomation(BaseAutomation):
def generate_terraform(self):
self.write_terraform_config(
class ListAutomation(TerraformAutomation):
def tf_generate(self):
self.tf_write(
self.template,
lists=MirrorList.query.filter(
MirrorList.destroyed == None,

View file

@ -1,9 +1,9 @@
from app import app
from app.terraform.list import ListAutomation
class ListGithubAutomation(ListAutomation):
short_name = "list_github"
description = "Update mirror lists in GitHub repositories"
provider = "github"
template_parameters = [
@ -45,11 +45,3 @@ class ListGithubAutomation(ListAutomation):
}
{% endfor %}
"""
if __name__ == "__main__":
with app.app_context():
auto = ListGithubAutomation()
auto.generate_terraform()
auto.terraform_init()
auto.terraform_apply()

View file

@ -1,9 +1,9 @@
from app import app
from app.terraform.list import ListAutomation
class ListGitlabAutomation(ListAutomation):
short_name = "list_gitlab"
description = "Update mirror lists in GitLab repositories"
provider = "gitlab"
template_parameters = [
@ -44,11 +44,3 @@ class ListGitlabAutomation(ListAutomation):
{% endfor %}
"""
if __name__ == "__main__":
with app.app_context():
auto = ListGitlabAutomation()
auto.generate_terraform()
auto.terraform_init()
auto.terraform_apply()

View file

@ -1,9 +1,9 @@
from app import app
from app.terraform.list import ListAutomation
class ListGithubAutomation(ListAutomation):
class ListS3Automation(ListAutomation):
short_name = "list_s3"
description = "Update mirror lists in AWS S3 buckets"
provider = "s3"
template_parameters = [
@ -36,11 +36,3 @@ class ListGithubAutomation(ListAutomation):
}
{% endfor %}
"""
if __name__ == "__main__":
with app.app_context():
auto = ListGithubAutomation()
auto.generate_terraform()
auto.terraform_init()
auto.terraform_apply()