Skip to content

Commit

Permalink
Keep generated files
Browse files Browse the repository at this point in the history
Signed-off-by: Ragin666 <ragin666@gmail.com>
  • Loading branch information
Ragin-LundF committed Jun 22, 2021
1 parent 47627ee commit b5abeab
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 11 deletions.
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.1.0
3.2.0
4 changes: 3 additions & 1 deletion app/actions/migration/configuration_migration.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
10 changes: 6 additions & 4 deletions app/actions/project/project_file_actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
}
}
11 changes: 6 additions & 5 deletions app/configuration/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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)
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions config/k8s_jcasc_mgmt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ k8sManagement:

# activate version check to get informed about new version
versionCheck: true
# keep generated temporary files
keepGeneratedTemplates: false

jenkins:
jcasc:
Expand Down

0 comments on commit b5abeab

Please sign in to comment.