diff --git a/CHANGELOG.md b/CHANGELOG.md index 8c8483f..675ca1d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,27 @@ +# 3.2.0 +## Configuration to keep temporary files + +Now it is possible to set a configuration to keep the temporary files for the configuration deployments. +The configuration can be set in the main or in the project configuration: + +```yaml +k8sManagement: + # keep generated temporary files + keepGeneratedTemplates: false +``` + +(see [config/k8s_jcasc_mgmt.yaml](config/k8s_jcasc_mgmt.yaml)) + +To avoid to check those files in, please add the following line to your `.gitignore` + +```bash +__k8smgmt__* +``` + +## Bugfixes + +There was a path error for the migration assistant, which should be fixed now. + # 3.1.0 ## Bugfixes - The uninstall was unable to load the configuration, which made it impossible to uninstall only namespaces for deployment. diff --git a/VERSION b/VERSION index a0cd9f0..a4f52a5 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.1.0 \ No newline at end of file +3.2.0 \ No newline at end of file diff --git a/app/actions/migration/configuration_migration.go b/app/actions/migration/configuration_migration.go index a5a2abd..c7740e2 100644 --- a/app/actions/migration/configuration_migration.go +++ b/app/actions/migration/configuration_migration.go @@ -383,7 +383,9 @@ func migrateFromCnfToYaml() (string, bool) { var yamlConfig = string(yamlOutByte) loggingstate.AddInfoEntryAndDetails("New custom configuration", yamlConfig) - var configFile = configuration.GetConfiguration().CustomConfig.K8SManagement.ConfigFile + var basePath = configuration.GetConfiguration().GetProjectBaseDirectory() + var k8sConfigFile = configuration.GetConfiguration().CustomConfig.K8SManagement.ConfigFile + var configFile = files.AppendPath(basePath, k8sConfigFile) if files.FileOrDirectoryExists(configFile) { return "FAILED - Config already exists", false } diff --git a/app/actions/project/project_file_actions.go b/app/actions/project/project_file_actions.go index bd2fd4a..b502a1e 100644 --- a/app/actions/project/project_file_actions.go +++ b/app/actions/project/project_file_actions.go @@ -57,10 +57,12 @@ func CopyTemplate(projectDirectory string, filename string, useTemplatePrefix bo // RemoveTempFile : removes a temporary file if it exists func RemoveTempFile(tempFile string) { - var _, file = filepath.Split(tempFile) - if strings.HasPrefix(file, constants.FilenameTempPrefix) { - if files.FileOrDirectoryExists(tempFile) { - _ = os.Remove(tempFile) + if !configuration.GetConfiguration().K8SManagement.KeepGeneratedTemplates { + var _, file = filepath.Split(tempFile) + if strings.HasPrefix(file, constants.FilenameTempPrefix) { + if files.FileOrDirectoryExists(tempFile) { + _ = os.Remove(tempFile) + } } } } diff --git a/app/configuration/configuration.go b/app/configuration/configuration.go index 039b39b..dc56ad1 100644 --- a/app/configuration/configuration.go +++ b/app/configuration/configuration.go @@ -59,10 +59,11 @@ type config struct { TemplateDirectory string `yaml:"templateDirectory,omitempty"` SecretFiles string `yaml:"secretFiles,omitempty"` } `yaml:"project,omitempty"` - VersionCheck bool `yaml:"versionCheck,omitempty"` - DryRunOnly bool `yaml:"-"` - CliOnly bool `yaml:"-"` - BasePath string `yaml:"-"` + VersionCheck bool `yaml:"versionCheck,omitempty"` + KeepGeneratedTemplates bool `yaml:"keepGeneratedTemplates,omitempty"` + DryRunOnly bool `yaml:"-"` + CliOnly bool `yaml:"-"` + BasePath string `yaml:"-"` } `yaml:"k8sManagement,omitempty"` Jenkins struct { Jcasc struct { @@ -352,7 +353,7 @@ func (conf *config) loadCustomConfig() { log.Panicf("Unable to merge custom config with config: %v", err) } } else { - log.Panicf("Unable to load defined custom config from path [%v]", customConfig) + log.Fatalf("Unable to load defined custom config from path [%v]", customConfig) } } } diff --git a/config/k8s_jcasc_mgmt.yaml b/config/k8s_jcasc_mgmt.yaml index 9d30630..0388b20 100644 --- a/config/k8s_jcasc_mgmt.yaml +++ b/config/k8s_jcasc_mgmt.yaml @@ -28,6 +28,8 @@ k8sManagement: # activate version check to get informed about new version versionCheck: true + # keep generated temporary files + keepGeneratedTemplates: false jenkins: jcasc: