Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare for release 1.14.0 #149

Merged
merged 4 commits into from
Jan 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions gh-pages/content/en/docs/overview/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ Each extra remote must have a unique name, it is used to identify the command as
}
```

| Config Name | Type | Description |
|-----------------|--------|----------------------------------------------------------------------------------------------------------------|
| remote_base_url | string | the base url of the remote repository, it must contain a `/index.json` endpoint to list all available packages |
| sync_policy | string | how often the repository is synched from its remote, always, hourly, daily, weekly, or monthly |
| repository_dir | string | the absolute path of the local repository folder to keep the downloaded local packages |
| Config Name | Type | Description |
|-----------------|--------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| remote_base_url | string | the base url of the remote repository, it must contain a `/index.json` endpoint to list all available packages |
| 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+) |
| repository_dir | string | the absolute path of the local repository folder to keep the downloaded local packages |

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

Expand Down
4 changes: 2 additions & 2 deletions gh-pages/content/en/docs/overview/resources.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ AUTH_TOKEN=${COLA_AUTH_TOKEN}
| USERNAME | Yes | the username collected from `login` command |
| PASSWORD | Yes | the password collected from `login` command |
| AUTH_TOKEN | Yes | the authentication token collected from `login` command |
| LOG_LEVEL | Yes | the log level of command launcher |
| DEBUG_FLAGS | Yes | the debug flags defined in command launcher's config |
| LOG_LEVEL | No | the log level of command launcher |
| DEBUG_FLAGS | No | the debug flags defined in command launcher's config |
| PACKAGE_DIR | No | the absolute path to the package directory |
| FULL_COMMAND_NAME | No | the name of the command executed (includes app and group) |
48 changes: 25 additions & 23 deletions internal/frontend/default-frontend.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,11 +322,7 @@ func (self *defaultFrontend) executeCommand(group, name string, args []string, i
return 1, errors.New(EXECUTABLE_NOT_DEFINED)
}

envCtx := self.getCmdEnvContext(initialEnvCtx, consent)

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

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

envCtx := self.getCmdEnvContext([]string{
envCtx := self.getCmdEnvContext(iCmd, []string{
fmt.Sprintf("%s=%s", self.appCtx.EnvVarName("TO_COMPLETE"), toComplete),
}, []string{})

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

envCtx := self.getCmdEnvContext([]string{}, []string{})
envCtx := self.getCmdEnvContext(iCmd, []string{}, []string{})

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

func (self *defaultFrontend) getCmdEnvContext(envVars []string, consents []string) []string {
func (self *defaultFrontend) getCmdEnvContext(cmd command.Command, envVars []string, consents []string) []string {
vars := append([]string{}, envVars...)

/* append environment variables that require consent */
for _, item := range consents {
switch item {
case consent.USERNAME:
Expand All @@ -515,21 +512,6 @@ func (self *defaultFrontend) getCmdEnvContext(envVars []string, consents []strin
if token != "" {
vars = append(vars, fmt.Sprintf("%s=%s", self.appCtx.AuthTokenEnvVar(), token))
}
case consent.LOG_LEVEL:
// append log level from configuration
logLevel := viper.GetString(config.LOG_LEVEL_KEY)
vars = append(vars, fmt.Sprintf("%s=%s",
self.appCtx.LogLevelEnvVar(),
logLevel,
))
case consent.DEBUG_FLAGS:
// append debug flags from configuration
debugFlags := os.Getenv(self.appCtx.DebugFlagsEnvVar())
vars = append(vars, fmt.Sprintf("%s=%s,%s",
self.appCtx.DebugFlagsEnvVar(),
debugFlags,
viper.GetString(config.DEBUG_FLAGS_KEY),
))
default:
value, err := helper.GetSecret(strings.ToLower(item))
if err != nil {
Expand All @@ -541,6 +523,26 @@ func (self *defaultFrontend) getCmdEnvContext(envVars []string, consents []strin
}
}

/* append environment variables that do not require consent */
// append log level from configuration
logLevel := viper.GetString(config.LOG_LEVEL_KEY)
vars = append(vars, fmt.Sprintf("%s=%s",
self.appCtx.LogLevelEnvVar(),
logLevel,
))

// append debug flags from configuration
debugFlags := os.Getenv(self.appCtx.DebugFlagsEnvVar())
vars = append(vars, fmt.Sprintf("%s=%s,%s",
self.appCtx.DebugFlagsEnvVar(),
debugFlags,
viper.GetString(config.DEBUG_FLAGS_KEY),
))

// append package dir and full command name
vars = append(vars, fmt.Sprintf("%s=%s", self.appCtx.CmdPackageDirEnvVar(), cmd.PackageDir()))
vars = append(vars, fmt.Sprintf("%s=%s", self.appCtx.FullCmdNameEnvVar(), self.getFullCommandName(cmd.RuntimeGroup(), cmd.RuntimeName())))

// Enable variable with prefix [binary_name] and COLA
// TODO: remove it when in version 1.8 all variables are migrated to COLA prefix
outputVars := []string{}
Expand Down
13 changes: 13 additions & 0 deletions release-notes.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
1.14.0:
version: 1.14.0
releaseNotes: |
# ✨ New Features and Updates
# 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.
# LOG_LEVEL and DEBUG_FLAGS no longer requires user consent.
# 🐛 Bug Fixes
# built-in update command now take into account the extra remote registries, and respect the sync_policy configuration for each registry.
# 📝 Documentation Updates
# Update configuration documentation to reflect the new sync_policy configuration and user consent resources.
startPartition: 0
endPartition: 9

1.13.0:
version: 1.13.0
releaseNotes: |
Expand Down
Loading