Merge branch 'release-1.0' into main
This commit is contained in:
commit
74351db902
6 changed files with 17 additions and 15 deletions
10
README.md
10
README.md
|
@ -22,18 +22,18 @@ Ensure that yout python3 version is at least Python 3.7!
|
||||||
|
|
||||||
```
|
```
|
||||||
sudo apt install python3-pip
|
sudo apt install python3-pip
|
||||||
pip3 install pip3 --upgrade --user
|
pip3 install pip3 --upgrade
|
||||||
pip3 install pybuilder ddadevops deprecation --user
|
pip3 install pybuilder ddadevops deprecation
|
||||||
export PATH=$PATH:~/.local/bin
|
export PATH=$PATH:~/.local/bin
|
||||||
|
|
||||||
# in case of using terraform
|
# in case of using terraform
|
||||||
pip3 install dda-python-terraform --user
|
pip3 install dda-python-terraform packaging
|
||||||
|
|
||||||
# in case of using AwsMixin
|
# in case of using AwsMixin
|
||||||
pip3 install boto3 --user
|
pip3 install boto3
|
||||||
|
|
||||||
# in case of using AwsMfaMixin
|
# in case of using AwsMfaMixin
|
||||||
pip3 install boto3 mfa --user
|
pip3 install boto3 mfa
|
||||||
```
|
```
|
||||||
|
|
||||||
# Example Build
|
# Example Build
|
||||||
|
|
2
build.py
2
build.py
|
@ -28,7 +28,7 @@ use_plugin("python.distutils")
|
||||||
default_task = "publish"
|
default_task = "publish"
|
||||||
|
|
||||||
name = "ddadevops"
|
name = "ddadevops"
|
||||||
version = "2.0.2"
|
version = "2.0.3"
|
||||||
summary = "tools to support builds combining gopass, terraform, dda-pallet, aws & hetzner-cloud"
|
summary = "tools to support builds combining gopass, terraform, dda-pallet, aws & hetzner-cloud"
|
||||||
description = __doc__
|
description = __doc__
|
||||||
authors = [Author("meissa GmbH", "buero@meissa-gmbh.de")]
|
authors = [Author("meissa GmbH", "buero@meissa-gmbh.de")]
|
||||||
|
|
|
@ -10,4 +10,5 @@ pytest==7.1
|
||||||
pytest-cov==3.0
|
pytest-cov==3.0
|
||||||
pytest-datafiles==2.0
|
pytest-datafiles==2.0
|
||||||
dda-python-terraform==2.0.1
|
dda-python-terraform==2.0.1
|
||||||
|
packaging==3.0
|
||||||
boto3==1.24
|
boto3==1.24
|
|
@ -5,4 +5,4 @@ git push --follow-tags
|
||||||
increase version no in build.py
|
increase version no in build.py
|
||||||
git commit -am "version bump"
|
git commit -am "version bump"
|
||||||
git push
|
git push
|
||||||
pip3 install --upgrade --user ddadevops
|
pip3 install --upgrade ddadevops
|
|
@ -38,7 +38,7 @@ class AwsBackendPropertiesMixin(DevopsTerraformBuild):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def init_client(self):
|
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)
|
tf.init(backend_config=self.backend_config)
|
||||||
self.print_terraform_command(tf)
|
self.print_terraform_command(tf)
|
||||||
if self.use_workspace:
|
if self.use_workspace:
|
||||||
|
|
|
@ -5,6 +5,7 @@ from pkg_resources import *
|
||||||
from dda_python_terraform import *
|
from dda_python_terraform import *
|
||||||
from .python_util import filter_none
|
from .python_util import filter_none
|
||||||
from .devops_build import DevopsBuild, create_devops_build_config
|
from .devops_build import DevopsBuild, create_devops_build_config
|
||||||
|
from packaging import version
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
@ -20,9 +21,9 @@ def create_devops_terraform_build_config(stage,
|
||||||
terraform_build_commons_dir_name='terraform',
|
terraform_build_commons_dir_name='terraform',
|
||||||
debug_print_terraform_command=False,
|
debug_print_terraform_command=False,
|
||||||
additional_tfvar_files=[],
|
additional_tfvar_files=[],
|
||||||
terraform_version=0.15):
|
terraform_semantic_version="1.0.8"):
|
||||||
if not output_json_name:
|
if not output_json_name:
|
||||||
output_json_name = 'out_' + module + '.json'
|
output_json_name = 'out_' + module + '.json'
|
||||||
ret = create_devops_build_config(
|
ret = create_devops_build_config(
|
||||||
stage, project_root_path, module, build_dir_name)
|
stage, project_root_path, module, build_dir_name)
|
||||||
ret.update({'additional_vars': additional_vars,
|
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,
|
'terraform_build_commons_dir_name': terraform_build_commons_dir_name,
|
||||||
'debug_print_terraform_command': debug_print_terraform_command,
|
'debug_print_terraform_command': debug_print_terraform_command,
|
||||||
'additional_tfvar_files': additional_tfvar_files,
|
'additional_tfvar_files': additional_tfvar_files,
|
||||||
'terraform_version': terraform_version})
|
'terraform_semantic_version': terraform_semantic_version})
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
class DevopsTerraformBuild(DevopsBuild):
|
class DevopsTerraformBuild(DevopsBuild):
|
||||||
|
@ -49,7 +50,7 @@ class DevopsTerraformBuild(DevopsBuild):
|
||||||
self.terraform_build_commons_dir_name = config['terraform_build_commons_dir_name']
|
self.terraform_build_commons_dir_name = config['terraform_build_commons_dir_name']
|
||||||
self.debug_print_terraform_command = config['debug_print_terraform_command']
|
self.debug_print_terraform_command = config['debug_print_terraform_command']
|
||||||
self.additional_tfvar_files = config['additional_tfvar_files']
|
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):
|
def terraform_build_commons_path(self):
|
||||||
mylist = [self.build_commons_path,
|
mylist = [self.build_commons_path,
|
||||||
|
@ -100,7 +101,7 @@ class DevopsTerraformBuild(DevopsBuild):
|
||||||
self.rescue_local_state()
|
self.rescue_local_state()
|
||||||
|
|
||||||
def init_client(self):
|
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()
|
tf.init()
|
||||||
self.print_terraform_command(tf)
|
self.print_terraform_command(tf)
|
||||||
if self.use_workspace:
|
if self.use_workspace:
|
||||||
|
@ -151,7 +152,7 @@ class DevopsTerraformBuild(DevopsBuild):
|
||||||
auto_approve_flag = IsFlagged
|
auto_approve_flag = IsFlagged
|
||||||
else:
|
else:
|
||||||
auto_approve_flag = None
|
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,
|
return_code, stdout, stderr = tf.apply(capture_output=False, raise_on_error=True,
|
||||||
auto_approve=auto_approve_flag,
|
auto_approve=auto_approve_flag,
|
||||||
var=self.project_vars(),
|
var=self.project_vars(),
|
||||||
|
@ -184,7 +185,7 @@ class DevopsTerraformBuild(DevopsBuild):
|
||||||
auto_approve_flag = IsFlagged
|
auto_approve_flag = IsFlagged
|
||||||
else:
|
else:
|
||||||
auto_approve_flag = None
|
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,
|
return_code, stdout, stderr = tf.destroy(capture_output=False, raise_on_error=True,
|
||||||
auto_approve=auto_approve_flag,
|
auto_approve=auto_approve_flag,
|
||||||
var=self.project_vars(),
|
var=self.project_vars(),
|
||||||
|
|
Loading…
Reference in a new issue