Skip to content

Commit

Permalink
MM-54715: Set service environment automatically (#666)
Browse files Browse the repository at this point in the history
We set the service environment to production
to avoid unexpected license validation failures.

https://mattermost.atlassian.net/browse/MM-54715
  • Loading branch information
agnivade authored Nov 18, 2023
1 parent 2c92e71 commit 086ee9f
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions cmd/ltctl/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,10 @@ func main() {
rootCmd.PersistentFlags().StringP("config", "c", "", "path to the deployer configuration file to use")

deploymentCmd := &cobra.Command{
Use: "deployment",
Short: "Manage a load-test deployment",
Use: "deployment",
Short: "Manage a load-test deployment",
PersistentPreRun: func(_ *cobra.Command, _ []string) { os.Setenv("MM_SERVICEENVIRONMENT", "production") },
PersistentPostRun: func(_ *cobra.Command, _ []string) { os.Unsetenv("MM_SERVICEENVIRONMENT") },
}

deploymentCommands := []*cobra.Command{
Expand Down Expand Up @@ -170,8 +172,10 @@ func main() {
rootCmd.AddCommand(deploymentCmd)

loadtestCmd := &cobra.Command{
Use: "loadtest",
Short: "Manage the load-test",
Use: "loadtest",
Short: "Manage the load-test",
PersistentPreRun: func(_ *cobra.Command, _ []string) { os.Setenv("MM_SERVICEENVIRONMENT", "production") },
PersistentPostRun: func(_ *cobra.Command, _ []string) { os.Unsetenv("MM_SERVICEENVIRONMENT") },
}

resetCmd := &cobra.Command{
Expand Down Expand Up @@ -316,8 +320,10 @@ func main() {
rootCmd.AddCommand(reportCmd)

comparisonCmd := &cobra.Command{
Use: "comparison",
Short: "Manage fully automated load-test comparisons environments",
Use: "comparison",
Short: "Manage fully automated load-test comparisons environments",
PersistentPreRun: func(_ *cobra.Command, _ []string) { os.Setenv("MM_SERVICEENVIRONMENT", "production") },
PersistentPostRun: func(_ *cobra.Command, _ []string) { os.Unsetenv("MM_SERVICEENVIRONMENT") },
}
comparisonCmd.Flags().StringP("comparison-config", "", "", "path to the comparison config file to use")
runComparisonCmd := &cobra.Command{
Expand Down

0 comments on commit 086ee9f

Please sign in to comment.