Skip to content

Commit 0c7d9ae

Browse files
support log-formatter (#143)
* support log-formatter
1 parent 1468792 commit 0c7d9ae

19 files changed

+63
-38
lines changed

README.md

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,15 @@ Meanwhile 1.x.x is to release and makred as pre-release we will maintain 2 branc
1111
* `release-1.0` it the new release, which will be used when running Codefresh CLI to install the agent
1212
We highly suggest to use [Codefresh official CLI](https://codefresh-io.github.io/cli/) to install the agent:
1313
```bash
14-
kubectl create namespace codefresh
15-
codefresh install agent --kube-namespace codefresh --install-runtime
14+
codefresh runner init
1615
```
1716

1817
The last command will:
19-
1. Install the agent on the namespace `codefresh`
18+
1. Install the agent on the namespace `codefresh` (as you choose)
2019
2. Install the runtime on the same namespace
2120
3. Attach the runtime to the agent
21+
4. Register cluster on codefresh platform
22+
5. Create and run demo pipeline
2223

2324
It is still possible, for advanced users to install all manually, for example:
2425
One process of Venona can manage multiple runtime environments
@@ -57,19 +58,9 @@ codefresh attach runtime --agent-name $AGENT_NAME --agent-kube-namespace codefre
5758
```
5859

5960
## Migration
60-
Migrating from Venona `< 1.x.x` to `> 1.x.x` is not done automatically, please use the [migration script](https://github.com/codefresh-io/venona/blob/release-1.0/scripts/migration.sh) to do that, check out which environment variables are required to run it.
61+
Migrating from Venona `< 1.x.x` to `> 1.x.x` is not done automatically, please run the follwing
6162
```bash
62-
# This script comes to migrate old versions of Venona installation ( version < 1.x.x ) to new version (version >= 1.0.0 )
63-
# Please read carefully what the script does.
64-
# There will be a "downtime" in terms of your builds targeted to this runtime environment
65-
# Once the script is finished, all the builds during the downtime will start
66-
# The script will:
67-
# 1. Create new agent entity in Codefresh using Codefresh CLI - give it a name $CODEFRESH_AGENT_NAME, default is "codefresh"
68-
# 2. Install the agent on you cluster pass variables:
69-
# a. $VENONA_KUBE_NAMESPACE - required
70-
# b. $VENONA_KUBE_CONTEXT - default is current-context
71-
# c. $VENONA_KUBECONFIG_PATH - default is $HOME/.kube/config
72-
# 3. Attach runtime to the new agent (downtime ends) - pass $CODEFRESH_RUNTIME_NAME - required
63+
codefresh runner upgrade
7364
```
7465

7566

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"name": "venona",
3-
"version": "1.3.0",
3+
"version": "1.3.1",
4+
45
"description": "Codefresh agent to run on Codefresh's runtime environment and execute pipeline",
56
"main": "index.js",
67
"scripts": {

venonactl/VERSION

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
1.3.0
1+
1.3.1
2+

venonactl/cmd/attach.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ var attachRuntimeCmd = &cobra.Command{
4646
Run: func(cmd *cobra.Command, args []string) {
4747

4848
s := store.GetStore()
49-
lgr := createLogger("Attach-runtime", verbose)
49+
lgr := createLogger("Attach-runtime", verbose, logFormatter)
5050
buildBasicStore(lgr)
5151
extendStoreWithKubeClient(lgr)
5252

venonactl/cmd/cmdutils.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ var (
3333
commit = "none"
3434
date = "unknown"
3535

36-
verbose bool
36+
verbose bool
37+
logFormatter string
3738

3839
configPath string
3940
cfAPIHost string
@@ -153,13 +154,14 @@ func getKubeClientBuilder(context string, namespace string, path string, inClust
153154
})
154155
}
155156

156-
func createLogger(command string, verbose bool) logger.Logger {
157+
func createLogger(command string, verbose bool, logFormatter string) logger.Logger {
157158
logFile := "venonalog.json"
158159
os.Remove(logFile)
159160
return logger.New(&logger.Options{
160-
Command: command,
161-
Verbose: verbose,
162-
LogToFile: logFile,
161+
Command: command,
162+
Verbose: verbose,
163+
LogToFile: logFile,
164+
LogFormatter: logFormatter,
163165
})
164166
}
165167

venonactl/cmd/install-agent.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ var installAgentCmd = &cobra.Command{
4848
Short: "Install Codefresh's agent ",
4949
Run: func(cmd *cobra.Command, args []string) {
5050
s := store.GetStore()
51-
lgr := createLogger("Install-agent", verbose)
51+
lgr := createLogger("Install-agent", verbose, logFormatter)
5252
buildBasicStore(lgr)
5353
extendStoreWithAgentAPI(lgr, installAgentCmdOptions.agentToken, installAgentCmdOptions.agentID)
5454
extendStoreWithKubeClient(lgr)

venonactl/cmd/install-monitor.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ var installMonitorAgentCmd = &cobra.Command{
4444

4545
s := store.GetStore()
4646

47-
lgr := createLogger("Install-monitor-agent", verbose)
47+
lgr := createLogger("Install-monitor-agent", verbose, logFormatter)
4848
buildBasicStore(lgr)
4949
extendStoreWithKubeClient(lgr)
5050
fillKubernetesAPI(lgr, installMonitorAgentCmdOptions.kube.context, installMonitorAgentCmdOptions.kube.namespace, false)

venonactl/cmd/install-runtime.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ var installRuntimeCmd = &cobra.Command{
4848
Run: func(cmd *cobra.Command, args []string) {
4949

5050
s := store.GetStore()
51-
lgr := createLogger("Install-runtime", verbose)
51+
lgr := createLogger("Install-runtime", verbose, logFormatter)
5252
buildBasicStore(lgr)
5353
extendStoreWithAgentAPI(lgr, installRuntimeCmdOptions.codefreshToken, "")
5454
extendStoreWithKubeClient(lgr)

venonactl/cmd/migrate.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ var migrateCmd = &cobra.Command{
3535
Use: "migrate",
3636
Short: "Migrate existing runtime-environment from 0.X to 1.X version",
3737
Run: func(cmd *cobra.Command, args []string) {
38-
lgr := createLogger("Migrate", verbose)
38+
lgr := createLogger("Migrate", verbose, logFormatter)
3939
builder := plugins.NewBuilder(lgr)
4040
builder.Add(plugins.VenonaPluginType)
4141
s := store.GetStore()

venonactl/cmd/root.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,6 @@ func init() {
4949
rootCmd.PersistentFlags().StringVar(&kubeConfigPath, "kube-config-path", viper.GetString("kubeconfig"), "Path to kubeconfig file (default is $HOME/.kube/config) [$KUBECONFIG]")
5050

5151
rootCmd.PersistentFlags().BoolVar(&verbose, "verbose", false, "Print logs")
52+
rootCmd.PersistentFlags().StringVar(&logFormatter, "log-formtter", "Plain", "Print logs in custom format")
5253

5354
}

0 commit comments

Comments
 (0)