Merge branch 'release-1.0' into main

This commit is contained in:
jerger 2022-12-09 15:38:38 +01:00
commit 74351db902
6 changed files with 17 additions and 15 deletions

View file

@ -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

View file

@ -28,7 +28,7 @@ use_plugin("python.distutils")
default_task = "publish"
name = "ddadevops"
version = "2.0.2"
version = "2.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")]

View file

@ -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

View file

@ -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
pip3 install --upgrade ddadevops

View file

@ -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:

View file

@ -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,9 +21,9 @@ 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"):
if not output_json_name:
output_json_name = 'out_' + module + '.json'
output_json_name = 'out_' + module + '.json'
ret = create_devops_build_config(
stage, project_root_path, module, build_dir_name)
ret.update({'additional_vars': additional_vars,
@ -33,7 +34,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):
@ -49,7 +50,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,
@ -100,7 +101,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:
@ -151,7 +152,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(),
@ -184,7 +185,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(),