Skip to content

Commit 9759d9b

Browse files
authored
Merge pull request #149 from criteo/update-consent-resources
Prepare for release 1.14.0
2 parents 240c781 + c0eed5b commit 9759d9b

File tree

4 files changed

+45
-30
lines changed

4 files changed

+45
-30
lines changed

gh-pages/content/en/docs/overview/config.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,11 @@ Each extra remote must have a unique name, it is used to identify the command as
6363
}
6464
```
6565

66-
| Config Name | Type | Description |
67-
|-----------------|--------|----------------------------------------------------------------------------------------------------------------|
68-
| remote_base_url | string | the base url of the remote repository, it must contain a `/index.json` endpoint to list all available packages |
69-
| sync_policy | string | how often the repository is synched from its remote, always, hourly, daily, weekly, or monthly |
70-
| repository_dir | string | the absolute path of the local repository folder to keep the downloaded local packages |
66+
| Config Name | Type | Description |
67+
|-----------------|--------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
68+
| remote_base_url | string | the base url of the remote repository, it must contain a `/index.json` endpoint to list all available packages |
69+
| sync_policy | string | how often the repository is synched from its remote. Possible value: always, hourly, daily, weekly, or monthly. (hourly, daily, weekly and monthly are supported in 1.14+) |
70+
| repository_dir | string | the absolute path of the local repository folder to keep the downloaded local packages |
7171

7272
> You don't need to manage these extra remote configurations by your self. Use the built-in `remote` command instead
7373

gh-pages/content/en/docs/overview/resources.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ AUTH_TOKEN=${COLA_AUTH_TOKEN}
6868
| USERNAME | Yes | the username collected from `login` command |
6969
| PASSWORD | Yes | the password collected from `login` command |
7070
| AUTH_TOKEN | Yes | the authentication token collected from `login` command |
71-
| LOG_LEVEL | Yes | the log level of command launcher |
72-
| DEBUG_FLAGS | Yes | the debug flags defined in command launcher's config |
71+
| LOG_LEVEL | No | the log level of command launcher |
72+
| DEBUG_FLAGS | No | the debug flags defined in command launcher's config |
7373
| PACKAGE_DIR | No | the absolute path to the package directory |
7474
| FULL_COMMAND_NAME | No | the name of the command executed (includes app and group) |

internal/frontend/default-frontend.go

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -322,11 +322,7 @@ func (self *defaultFrontend) executeCommand(group, name string, args []string, i
322322
return 1, errors.New(EXECUTABLE_NOT_DEFINED)
323323
}
324324

325-
envCtx := self.getCmdEnvContext(initialEnvCtx, consent)
326-
327-
// Resources that do not depend on consent:
328-
envCtx = append(envCtx, fmt.Sprintf("%s=%s", self.appCtx.CmdPackageDirEnvVar(), iCmd.PackageDir()))
329-
envCtx = append(envCtx, fmt.Sprintf("%s=%s", self.appCtx.FullCmdNameEnvVar(), self.getFullCommandName(group, name)))
325+
envCtx := self.getCmdEnvContext(iCmd, initialEnvCtx, consent)
330326

331327
exitCode, err := iCmd.Execute(envCtx, args...)
332328
if err != nil {
@@ -343,7 +339,7 @@ func (self *defaultFrontend) executeValidArgsOfCommand(group, name string, args
343339
return "", err
344340
}
345341

346-
envCtx := self.getCmdEnvContext([]string{
342+
envCtx := self.getCmdEnvContext(iCmd, []string{
347343
fmt.Sprintf("%s=%s", self.appCtx.EnvVarName("TO_COMPLETE"), toComplete),
348344
}, []string{})
349345

@@ -362,7 +358,7 @@ func (self *defaultFrontend) executeFlagValuesOfCommand(group, name string, flag
362358
return "", err
363359
}
364360

365-
envCtx := self.getCmdEnvContext([]string{}, []string{})
361+
envCtx := self.getCmdEnvContext(iCmd, []string{}, []string{})
366362

367363
_, output, err := iCmd.ExecuteFlagValuesCmd(envCtx, flagCmd, args...)
368364
if err != nil {
@@ -486,9 +482,10 @@ func parseFlagDefinition(line string) (string, string, string, string, string) {
486482
return name, short, description, flagType, defaultValue
487483
}
488484

489-
func (self *defaultFrontend) getCmdEnvContext(envVars []string, consents []string) []string {
485+
func (self *defaultFrontend) getCmdEnvContext(cmd command.Command, envVars []string, consents []string) []string {
490486
vars := append([]string{}, envVars...)
491487

488+
/* append environment variables that require consent */
492489
for _, item := range consents {
493490
switch item {
494491
case consent.USERNAME:
@@ -515,21 +512,6 @@ func (self *defaultFrontend) getCmdEnvContext(envVars []string, consents []strin
515512
if token != "" {
516513
vars = append(vars, fmt.Sprintf("%s=%s", self.appCtx.AuthTokenEnvVar(), token))
517514
}
518-
case consent.LOG_LEVEL:
519-
// append log level from configuration
520-
logLevel := viper.GetString(config.LOG_LEVEL_KEY)
521-
vars = append(vars, fmt.Sprintf("%s=%s",
522-
self.appCtx.LogLevelEnvVar(),
523-
logLevel,
524-
))
525-
case consent.DEBUG_FLAGS:
526-
// append debug flags from configuration
527-
debugFlags := os.Getenv(self.appCtx.DebugFlagsEnvVar())
528-
vars = append(vars, fmt.Sprintf("%s=%s,%s",
529-
self.appCtx.DebugFlagsEnvVar(),
530-
debugFlags,
531-
viper.GetString(config.DEBUG_FLAGS_KEY),
532-
))
533515
default:
534516
value, err := helper.GetSecret(strings.ToLower(item))
535517
if err != nil {
@@ -541,6 +523,26 @@ func (self *defaultFrontend) getCmdEnvContext(envVars []string, consents []strin
541523
}
542524
}
543525

526+
/* append environment variables that do not require consent */
527+
// append log level from configuration
528+
logLevel := viper.GetString(config.LOG_LEVEL_KEY)
529+
vars = append(vars, fmt.Sprintf("%s=%s",
530+
self.appCtx.LogLevelEnvVar(),
531+
logLevel,
532+
))
533+
534+
// append debug flags from configuration
535+
debugFlags := os.Getenv(self.appCtx.DebugFlagsEnvVar())
536+
vars = append(vars, fmt.Sprintf("%s=%s,%s",
537+
self.appCtx.DebugFlagsEnvVar(),
538+
debugFlags,
539+
viper.GetString(config.DEBUG_FLAGS_KEY),
540+
))
541+
542+
// append package dir and full command name
543+
vars = append(vars, fmt.Sprintf("%s=%s", self.appCtx.CmdPackageDirEnvVar(), cmd.PackageDir()))
544+
vars = append(vars, fmt.Sprintf("%s=%s", self.appCtx.FullCmdNameEnvVar(), self.getFullCommandName(cmd.RuntimeGroup(), cmd.RuntimeName())))
545+
544546
// Enable variable with prefix [binary_name] and COLA
545547
// TODO: remove it when in version 1.8 all variables are migrated to COLA prefix
546548
outputVars := []string{}

release-notes.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
1.14.0:
2+
version: 1.14.0
3+
releaseNotes: |
4+
# ✨ New Features and Updates
5+
# Extra remote registry now support different sync policies: hourly, daily, weekly, and monthly. For the first iteration, the sync_policy configuration can only be modified in the configuration file. A built-in command will be provided in the future release to manage these sync policies.
6+
# LOG_LEVEL and DEBUG_FLAGS no longer requires user consent.
7+
# 🐛 Bug Fixes
8+
# built-in update command now take into account the extra remote registries, and respect the sync_policy configuration for each registry.
9+
# 📝 Documentation Updates
10+
# Update configuration documentation to reflect the new sync_policy configuration and user consent resources.
11+
startPartition: 0
12+
endPartition: 9
13+
114
1.13.0:
215
version: 1.13.0
316
releaseNotes: |

0 commit comments

Comments
 (0)