Skip to content

Commit

Permalink
Fix installation (#40)
Browse files Browse the repository at this point in the history
* bump

* fix workflow-reporter

* fix workflow-reporter
  • Loading branch information
roi-codefresh authored Aug 3, 2021
1 parent 3682938 commit 417340c
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION=v0.0.44
VERSION=v0.0.45
OUT_DIR=dist
YEAR?=$(shell date +"%Y")

Expand Down
7 changes: 4 additions & 3 deletions cmd/commands/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ func createEventsReporter(ctx context.Context, cloneOpts *git.CloneOptions, opts
return err
}

if err := createSensor(repofs, store.Get().EventsReporterName, resPath, opts.RuntimeName, store.Get().EventsReporterName, "events"); err != nil {
if err := createSensor(repofs, store.Get().EventsReporterName, resPath, opts.RuntimeName, store.Get().EventsReporterName, "events", "data"); err != nil {
return err
}

Expand Down Expand Up @@ -571,7 +571,7 @@ func createWorkflowReporter(ctx context.Context, cloneOpts *git.CloneOptions, op
return err
}

if err := createSensor(repofs, store.Get().WorkflowReporterName, resPath, opts.RuntimeName, store.Get().WorkflowReporterName, "workflows"); err != nil {
if err := createSensor(repofs, store.Get().WorkflowReporterName, resPath, opts.RuntimeName, store.Get().WorkflowReporterName, "workflows", "data.object"); err != nil {
return err
}

Expand Down Expand Up @@ -738,14 +738,15 @@ func createWorkflowReporterEventSource(repofs fs.FS, path, namespace string) err
return repofs.WriteYamls(repofs.Join(path, "event-source.yaml"), eventSource)
}

func createSensor(repofs fs.FS, name, path, namespace, eventSourceName, trigger string) error {
func createSensor(repofs fs.FS, name, path, namespace, eventSourceName, trigger, dataKey string) error {
sensor := eventsutil.CreateSensor(&eventsutil.CreateSensorOptions{
Name: name,
Namespace: namespace,
EventSourceName: eventSourceName,
EventBusName: store.Get().EventBusName,
TriggerURL: cfConfig.GetCurrentContext().URL + store.Get().EventReportingEndpoint,
Triggers: []string{trigger},
TriggerDestKey: dataKey,
})
return repofs.WriteYamls(repofs.Join(path, "sensor.yaml"), sensor)
}
Expand Down
4 changes: 2 additions & 2 deletions docs/releases/release_notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
### Linux
```bash
# download and extract the binary
curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.0.44/cf-linux-amd64.tar.gz | tar zx
curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.0.45/cf-linux-amd64.tar.gz | tar zx

# move the binary to your $PATH
mv ./cf-linux-amd64 /usr/local/bin/cf
Expand All @@ -20,7 +20,7 @@ cf version
### Mac
```bash
# download and extract the binary
curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.0.44/cf-darwin-amd64.tar.gz | tar zx
curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.0.45/cf-darwin-amd64.tar.gz | tar zx

# move the binary to your $PATH
mv ./cf-darwin-amd64 /usr/local/bin/cf
Expand Down
2 changes: 1 addition & 1 deletion manifests/runtime.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
namespace: "{{ namespace }}"
spec:
defVersion: 1.0.0
version: 0.0.44
version: 0.0.45
bootstrapSpecifier: github.com/codefresh-io/cli-v2/manifests/argo-cd
components:
- name: events
Expand Down
11 changes: 7 additions & 4 deletions pkg/util/events/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,14 @@ type (
EventBusName string
TriggerURL string
Triggers []string
TriggerDestKey string
}

CreateTriggerOptions struct {
createTriggerOptions struct {
Conditions string
URL string
DependencyName string
DataDestKey string
}
)

Expand Down Expand Up @@ -187,10 +189,11 @@ func CreateSensor(opts *CreateSensorOptions) *sensorsv1alpha1.Sensor {
EventSourceName: opts.EventSourceName,
EventName: trigger,
})
triggers[i] = *CreateTrigger(&CreateTriggerOptions{
triggers[i] = *createTrigger(&createTriggerOptions{
Conditions: trigger,
URL: opts.TriggerURL,
DependencyName: trigger,
DataDestKey: opts.TriggerDestKey,
})
}

Expand All @@ -214,7 +217,7 @@ func CreateSensor(opts *CreateSensorOptions) *sensorsv1alpha1.Sensor {
}
}

func CreateTrigger(opts *CreateTriggerOptions) *sensorsv1alpha1.Trigger {
func createTrigger(opts *createTriggerOptions) *sensorsv1alpha1.Trigger {
return &sensorsv1alpha1.Trigger{
Template: &sensorsv1alpha1.TriggerTemplate{
Conditions: opts.Conditions,
Expand Down Expand Up @@ -244,7 +247,7 @@ func CreateTrigger(opts *CreateTriggerOptions) *sensorsv1alpha1.Trigger {
DependencyName: opts.DependencyName,
DataKey: "body",
},
Dest: "data.object",
Dest: opts.DataDestKey,
},
},
},
Expand Down

0 comments on commit 417340c

Please sign in to comment.