From a9350550836cbf39fbad6d32390f90670b995844 Mon Sep 17 00:00:00 2001 From: Iain Learmonth Date: Wed, 18 May 2022 12:00:18 +0100 Subject: [PATCH] lists/git: always refresh when updating git repos looks like errors can occur when the latest commit isn't what is expected --- app/terraform/list/github.py | 1 + app/terraform/list/gitlab.py | 1 + app/terraform/terraform.py | 9 +++++++-- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/app/terraform/list/github.py b/app/terraform/list/github.py index e2d70e0..8b653a6 100644 --- a/app/terraform/list/github.py +++ b/app/terraform/list/github.py @@ -5,6 +5,7 @@ class ListGithubAutomation(ListAutomation): short_name = "list_github" description = "Update mirror lists in GitHub repositories" provider = "github" + always_refresh = True template_parameters = [ "github_api_key" diff --git a/app/terraform/list/gitlab.py b/app/terraform/list/gitlab.py index 9b51e88..5438396 100644 --- a/app/terraform/list/gitlab.py +++ b/app/terraform/list/gitlab.py @@ -5,6 +5,7 @@ class ListGitlabAutomation(ListAutomation): short_name = "list_gitlab" description = "Update mirror lists in GitLab repositories" provider = "gitlab" + always_refresh = True template_parameters = [ "gitlab_token", diff --git a/app/terraform/terraform.py b/app/terraform/terraform.py index af75856..e58bbfb 100644 --- a/app/terraform/terraform.py +++ b/app/terraform/terraform.py @@ -14,7 +14,12 @@ class TerraformAutomation(BaseAutomation): providers to deploy resources. """ - parallelism = 10 + always_refresh: bool = False + """ + Force refresh even when not a full run. + """ + + parallelism: int = 10 """ Default parallelism for remote API calls. """ @@ -44,7 +49,7 @@ class TerraformAutomation(BaseAutomation): prehook_result = self.tf_prehook() self.tf_generate() self.tf_init() - returncode, logs = self.tf_apply(refresh=full) + returncode, logs = self.tf_apply(refresh=self.always_refresh or full) self.tf_posthook(prehook_result=prehook_result) return True if returncode == 0 else False, logs