From e90a46bb67d4ef183f5bc0eee28236d251e41101 Mon Sep 17 00:00:00 2001 From: jerger Date: Fri, 19 Aug 2022 15:01:10 +0200 Subject: [PATCH 1/9] fix terraform versioning usage --- README.md | 10 +++++----- dev_requirements.txt | 1 + src/main/python/ddadevops/devops_terraform_build.py | 13 +++++++------ 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 0b2cd37..0816f51 100644 --- a/README.md +++ b/README.md @@ -22,18 +22,18 @@ Ensure that yout python3 version is at least Python 3.7! ``` sudo apt install python3-pip -pip3 install pip3 --upgrade --user -pip3 install pybuilder ddadevops deprecation --user +pip3 install pip3 --upgrade +pip3 install pybuilder ddadevops deprecation export PATH=$PATH:~/.local/bin # in case of using terraform -pip3 install dda-python-terraform --user +pip3 install dda-python-terraform packaging # in case of using AwsMixin -pip3 install boto3 --user +pip3 install boto3 # in case of using AwsMfaMixin -pip3 install boto3 mfa --user +pip3 install boto3 mfa ``` # Example Build diff --git a/dev_requirements.txt b/dev_requirements.txt index 3c2e184..25d5dae 100644 --- a/dev_requirements.txt +++ b/dev_requirements.txt @@ -10,4 +10,5 @@ pytest==7.1 pytest-cov==3.0 pytest-datafiles==2.0 dda-python-terraform==2.0.1 +packaging==3.0 boto3==1.24 \ No newline at end of file diff --git a/src/main/python/ddadevops/devops_terraform_build.py b/src/main/python/ddadevops/devops_terraform_build.py index 5e64be5..ab8d3aa 100644 --- a/src/main/python/ddadevops/devops_terraform_build.py +++ b/src/main/python/ddadevops/devops_terraform_build.py @@ -5,6 +5,7 @@ from pkg_resources import * from dda_python_terraform import * from .python_util import filter_none from .devops_build import DevopsBuild, create_devops_build_config +from packaging import version import sys @@ -20,7 +21,7 @@ def create_devops_terraform_build_config(stage, terraform_build_commons_dir_name='terraform', debug_print_terraform_command=False, additional_tfvar_files=[], - terraform_version=0.15): + terraform_semantic_version="1.0.8"): ret = create_devops_build_config( stage, project_root_path, module, build_dir_name) ret.update({'additional_vars': additional_vars, @@ -31,7 +32,7 @@ def create_devops_terraform_build_config(stage, 'terraform_build_commons_dir_name': terraform_build_commons_dir_name, 'debug_print_terraform_command': debug_print_terraform_command, 'additional_tfvar_files': additional_tfvar_files, - 'terraform_version': terraform_version}) + 'terraform_semantic_version': terraform_semantic_version}) return ret class DevopsTerraformBuild(DevopsBuild): @@ -47,7 +48,7 @@ class DevopsTerraformBuild(DevopsBuild): self.terraform_build_commons_dir_name = config['terraform_build_commons_dir_name'] self.debug_print_terraform_command = config['debug_print_terraform_command'] self.additional_tfvar_files = config['additional_tfvar_files'] - self.terraform_version = config['terraform_version'] + self.terraform_semantic_version = config['terraform_semantic_version'] def terraform_build_commons_path(self): mylist = [self.build_commons_path, @@ -98,7 +99,7 @@ class DevopsTerraformBuild(DevopsBuild): self.rescue_local_state() def init_client(self): - tf = Terraform(working_dir=self.build_path(), terraform_version=self.terraform_version) + tf = Terraform(working_dir=self.build_path(), terraform_semantic_version=self.terraform_semantic_version) tf.init() self.print_terraform_command(tf) if self.use_workspace: @@ -148,7 +149,7 @@ class DevopsTerraformBuild(DevopsBuild): auto_approve_flag = IsFlagged else: auto_approve_flag = None - if self.terraform_version >= 1.0: + if version.parse(self.terraform_semantic_version) >= version.parse("1.0.0"): return_code, stdout, stderr = tf.apply(capture_output=False, raise_on_error=True, auto_approve=auto_approve_flag, var=self.project_vars(), @@ -181,7 +182,7 @@ class DevopsTerraformBuild(DevopsBuild): auto_approve_flag = IsFlagged else: auto_approve_flag = None - if self.terraform_version >= 1.0: + if version.parse(self.terraform_semantic_version >= version.parse("1.0.0"): return_code, stdout, stderr = tf.destroy(capture_output=False, raise_on_error=True, auto_approve=auto_approve_flag, var=self.project_vars(), From 09f4147f2c9b11a5c346ee7fe04678aa4b95c320 Mon Sep 17 00:00:00 2001 From: jerger Date: Fri, 19 Aug 2022 15:02:03 +0200 Subject: [PATCH 2/9] release --- build.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.py b/build.py index a65c6a4..d59c660 100644 --- a/build.py +++ b/build.py @@ -28,7 +28,7 @@ use_plugin("python.distutils") default_task = "publish" name = "ddadevops" -version = "1.1.0-dev" +version = "1.0.1" summary = "tools to support builds combining gopass, terraform, dda-pallet, aws & hetzner-cloud" description = __doc__ authors = [Author("meissa GmbH", "buero@meissa-gmbh.de")] From b4c8843b3cabeee37d925b3c3a2e66eeba35200a Mon Sep 17 00:00:00 2001 From: jerger Date: Fri, 19 Aug 2022 15:05:12 +0200 Subject: [PATCH 3/9] version bump --- build.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.py b/build.py index d59c660..9f9b7f9 100644 --- a/build.py +++ b/build.py @@ -28,7 +28,7 @@ use_plugin("python.distutils") default_task = "publish" name = "ddadevops" -version = "1.0.1" +version = "1.0.2-dev" summary = "tools to support builds combining gopass, terraform, dda-pallet, aws & hetzner-cloud" description = __doc__ authors = [Author("meissa GmbH", "buero@meissa-gmbh.de")] From c0689007457bfb1d7fb9c97d23cf4c616e2e29e3 Mon Sep 17 00:00:00 2001 From: jerger Date: Fri, 19 Aug 2022 15:10:56 +0200 Subject: [PATCH 4/9] fix --- doc/releasing.md | 2 +- src/main/python/ddadevops/devops_terraform_build.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/releasing.md b/doc/releasing.md index e8cbc0b..4b00776 100644 --- a/doc/releasing.md +++ b/doc/releasing.md @@ -5,4 +5,4 @@ git push --follow-tags increase version no in build.py git commit -am "version bump" git push -pip3 install --upgrade --user ddadevops \ No newline at end of file +pip3 install --upgrade ddadevops \ No newline at end of file diff --git a/src/main/python/ddadevops/devops_terraform_build.py b/src/main/python/ddadevops/devops_terraform_build.py index ab8d3aa..08b3f64 100644 --- a/src/main/python/ddadevops/devops_terraform_build.py +++ b/src/main/python/ddadevops/devops_terraform_build.py @@ -182,7 +182,7 @@ class DevopsTerraformBuild(DevopsBuild): auto_approve_flag = IsFlagged else: auto_approve_flag = None - if version.parse(self.terraform_semantic_version >= version.parse("1.0.0"): + if version.parse(self.terraform_semantic_version) >= version.parse("1.0.0"): return_code, stdout, stderr = tf.destroy(capture_output=False, raise_on_error=True, auto_approve=auto_approve_flag, var=self.project_vars(), From 9fad3326f5325765845c0ff84ab8c115fc6c12fa Mon Sep 17 00:00:00 2001 From: jerger Date: Fri, 19 Aug 2022 15:11:14 +0200 Subject: [PATCH 5/9] release --- build.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.py b/build.py index 9f9b7f9..f3e779b 100644 --- a/build.py +++ b/build.py @@ -28,7 +28,7 @@ use_plugin("python.distutils") default_task = "publish" name = "ddadevops" -version = "1.0.2-dev" +version = "1.0.2" summary = "tools to support builds combining gopass, terraform, dda-pallet, aws & hetzner-cloud" description = __doc__ authors = [Author("meissa GmbH", "buero@meissa-gmbh.de")] From 952b880e83320866c6efe1b9fe803fba5ff11cec Mon Sep 17 00:00:00 2001 From: jerger Date: Fri, 19 Aug 2022 15:11:57 +0200 Subject: [PATCH 6/9] version bump --- build.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.py b/build.py index f3e779b..069b69e 100644 --- a/build.py +++ b/build.py @@ -28,7 +28,7 @@ use_plugin("python.distutils") default_task = "publish" name = "ddadevops" -version = "1.0.2" +version = "1.0.3-dev" summary = "tools to support builds combining gopass, terraform, dda-pallet, aws & hetzner-cloud" description = __doc__ authors = [Author("meissa GmbH", "buero@meissa-gmbh.de")] From ef32125554f95b7b5ea32fd68eb643a0a2ad5518 Mon Sep 17 00:00:00 2001 From: jerger Date: Fri, 19 Aug 2022 15:22:50 +0200 Subject: [PATCH 7/9] fix --- src/main/python/ddadevops/aws_backend_properties_mixin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/python/ddadevops/aws_backend_properties_mixin.py b/src/main/python/ddadevops/aws_backend_properties_mixin.py index 0a1b961..b3c2bfe 100644 --- a/src/main/python/ddadevops/aws_backend_properties_mixin.py +++ b/src/main/python/ddadevops/aws_backend_properties_mixin.py @@ -38,7 +38,7 @@ class AwsBackendPropertiesMixin(DevopsTerraformBuild): pass def init_client(self): - tf = Terraform(working_dir=self.build_path(), terraform_version=self.terraform_version) + tf = Terraform(working_dir=self.build_path(), terraform_semantic_version=self.terraform_semantic_version) tf.init(backend_config=self.backend_config) self.print_terraform_command(tf) if self.use_workspace: From 75c8e114195edc6221c31f2446da37f11d787209 Mon Sep 17 00:00:00 2001 From: jerger Date: Fri, 19 Aug 2022 15:23:15 +0200 Subject: [PATCH 8/9] release --- build.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.py b/build.py index 069b69e..cd0d6cd 100644 --- a/build.py +++ b/build.py @@ -28,7 +28,7 @@ use_plugin("python.distutils") default_task = "publish" name = "ddadevops" -version = "1.0.3-dev" +version = "1.0.3" summary = "tools to support builds combining gopass, terraform, dda-pallet, aws & hetzner-cloud" description = __doc__ authors = [Author("meissa GmbH", "buero@meissa-gmbh.de")] From 78b213a69e5580e489d233beddde3c90c1943bb2 Mon Sep 17 00:00:00 2001 From: jerger Date: Fri, 19 Aug 2022 15:23:42 +0200 Subject: [PATCH 9/9] version bump --- build.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.py b/build.py index cd0d6cd..3b264b8 100644 --- a/build.py +++ b/build.py @@ -28,7 +28,7 @@ use_plugin("python.distutils") default_task = "publish" name = "ddadevops" -version = "1.0.3" +version = "1.0.4-dev" summary = "tools to support builds combining gopass, terraform, dda-pallet, aws & hetzner-cloud" description = __doc__ authors = [Author("meissa GmbH", "buero@meissa-gmbh.de")]