Skip to content

Commit 2a3a4f4

Browse files
CR-10064-align (#300)
* align installation resources * bump version * small fix * bump version * bump version
1 parent b35fe93 commit 2a3a4f4

File tree

5 files changed

+149
-119
lines changed

5 files changed

+149
-119
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
VERSION=v0.0.277
1+
VERSION=v0.0.278
22

33
OUT_DIR=dist
44
YEAR?=$(shell date +"%Y")

cmd/commands/git-source.go

Lines changed: 40 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -734,7 +734,7 @@ func createDemoWorkflowTemplate(gsFs fs.FS) error {
734734
func createGithubExamplePipeline(opts *gitSourceGithubExampleOptions) error {
735735
if !store.Get().SkipIngress {
736736
// Create an ingress that will manage external access to the github eventsource service
737-
ingress := createGithubExampleIngress(opts.ingressClass, opts.ingressHost, opts.hostName, opts.ingressControllerType)
737+
ingress := createGithubExampleIngress(opts.ingressClass, opts.ingressHost, opts.hostName, opts.ingressControllerType, opts.runtimeName)
738738
ingressFilePath := opts.gsFs.Join(opts.gsCloneOpts.Path(), store.Get().GithubExampleIngressFileName)
739739

740740
ingressRedundanded, err := cleanUpFieldsIngressGithub(&ingress)
@@ -753,7 +753,7 @@ func createGithubExamplePipeline(opts *gitSourceGithubExampleOptions) error {
753753

754754
// Create a github eventsource that will listen to push events in the git source repo
755755
gsRepoURL := opts.gsCloneOpts.URL()
756-
eventSource := createGithubExampleEventSource(gsRepoURL, opts.ingressHost)
756+
eventSource := createGithubExampleEventSource(gsRepoURL, opts.ingressHost, opts.runtimeName)
757757
eventSourceFilePath := opts.gsFs.Join(opts.gsCloneOpts.Path(), store.Get().GithubExampleEventSourceFileName)
758758

759759
eventSourceRedundanded, err := cleanUpFieldsGithubEventSource(&eventSource)
@@ -787,17 +787,17 @@ func createGithubExamplePipeline(opts *gitSourceGithubExampleOptions) error {
787787
return nil
788788
}
789789

790-
func createGithubExampleIngress(ingressClass string, ingressHost string, hostName string, ingressControllerType ingressControllerType) *netv1.Ingress {
790+
func createGithubExampleIngress(ingressClass string, ingressHost string, hostName string, ingressControllerType ingressControllerType, runtimeName string) *netv1.Ingress {
791791
ingressOptions := ingressutil.CreateIngressOptions{
792792
Name: store.Get().CodefreshDeliveryPipelines,
793793
IngressClassName: ingressClass,
794794
Host: hostName,
795795
Paths: []ingressutil.IngressPath{
796796
{
797-
Path: store.Get().GithubExampleEventSourceEndpointPath,
798-
PathType: netv1.PathTypePrefix,
797+
Path: util.GenerateIngressEventSourcePath(runtimeName),
799798
ServiceName: store.Get().GithubExampleEventSourceObjectName + "-eventsource-svc",
800799
ServicePort: store.Get().GithubExampleEventSourceServicePort,
800+
PathType: netv1.PathTypePrefix,
801801
},
802802
}}
803803

@@ -818,7 +818,7 @@ func getRepoOwnerAndNameFromRepoURL(repoURL string) (owner string, name string)
818818
return owner, name
819819
}
820820

821-
func createGithubExampleEventSource(repoURL string, ingressHost string) *eventsourcev1alpha1.EventSource {
821+
func createGithubExampleEventSource(repoURL string, ingressHost string, runtimeName string) *eventsourcev1alpha1.EventSource {
822822
repoOwner, repoName := getRepoOwnerAndNameFromRepoURL(repoURL)
823823

824824
return &eventsourcev1alpha1.EventSource{
@@ -841,11 +841,8 @@ func createGithubExampleEventSource(repoURL string, ingressHost string) *eventso
841841
},
842842
Github: map[string]eventsourcev1alpha1.GithubEventSource{
843843
store.Get().GithubExampleEventName: {
844-
Webhook: &eventsourcev1alpha1.WebhookContext{
845-
Endpoint: store.Get().GithubExampleEventSourceEndpointPath,
846-
URL: strings.Trim(ingressHost, "/"),
847-
Port: store.Get().GithubExampleEventSourceTargetPort,
848-
Method: "POST",
844+
Events: []string{
845+
"push",
849846
},
850847
Repositories: []eventsourcev1alpha1.OwnedRepositories{
851848
{
@@ -855,8 +852,11 @@ func createGithubExampleEventSource(repoURL string, ingressHost string) *eventso
855852
},
856853
},
857854
},
858-
Events: []string{
859-
"push",
855+
Webhook: &eventsourcev1alpha1.WebhookContext{
856+
Endpoint: fmt.Sprintf("%s/%s", util.GenerateIngressEventSourcePath(runtimeName), store.Get().GithubExampleEventName),
857+
URL: strings.Trim(ingressHost, "/"),
858+
Port: store.Get().GithubExampleEventSourceTargetPort,
859+
Method: "POST",
860860
},
861861
APIToken: &corev1.SecretKeySelector{
862862
Key: store.Get().GithubAccessTokenSecretKey,
@@ -875,7 +875,7 @@ func createGithubExampleEventSource(repoURL string, ingressHost string) *eventso
875875

876876
func createGithubExampleTrigger() sensorsv1alpha1.Trigger {
877877
workflow := wfutil.CreateWorkflow(&wfutil.CreateWorkflowOptions{
878-
GenerateName: "github-",
878+
GenerateName: store.Get().GithubExampleTriggerTemplateName + "-",
879879
SpecWfTemplateRefName: store.Get().GithubExampleTriggerTemplateName,
880880
Parameters: []string{
881881
"message",
@@ -886,7 +886,7 @@ func createGithubExampleTrigger() sensorsv1alpha1.Trigger {
886886

887887
return sensorsv1alpha1.Trigger{
888888
Template: &sensorsv1alpha1.TriggerTemplate{
889-
Name: store.Get().CronExampleTriggerTemplateName,
889+
Name: store.Get().GithubExampleTriggerTemplateName,
890890
ArgoWorkflow: &sensorsv1alpha1.ArgoWorkflowTrigger{
891891
GroupVersionResource: metav1.GroupVersionResource{
892892
Group: "argoproj.io",
@@ -912,6 +912,29 @@ func createGithubExampleTrigger() sensorsv1alpha1.Trigger {
912912
}
913913
}
914914

915+
// push heads filter for github
916+
func createGithubExampleDataFilters() *sensorsv1alpha1.EventDependencyFilter {
917+
return &sensorsv1alpha1.EventDependencyFilter{
918+
Data: []sensorsv1alpha1.DataFilter{
919+
{
920+
Path: fmt.Sprintf("body.%s", store.Get().GithubEventTypeHeader),
921+
Value: []string{
922+
"push",
923+
},
924+
Type: sensorsv1alpha1.JSONTypeString,
925+
},
926+
{
927+
Path: "body.ref",
928+
Template: "{{ (split \"/\" .Input)._1 }}",
929+
Value: []string{
930+
"heads",
931+
},
932+
Type: sensorsv1alpha1.JSONTypeString,
933+
},
934+
},
935+
}
936+
}
937+
915938
func createGithubExampleSensor() *sensorsv1alpha1.Sensor {
916939
triggers := []sensorsv1alpha1.Trigger{
917940
createGithubExampleTrigger(),
@@ -921,6 +944,7 @@ func createGithubExampleSensor() *sensorsv1alpha1.Sensor {
921944
Name: store.Get().GithubExampleDependencyName,
922945
EventSourceName: store.Get().GithubExampleEventSourceObjectName,
923946
EventName: store.Get().GithubExampleEventName,
947+
Filters: createGithubExampleDataFilters(),
924948
},
925949
}
926950

@@ -1033,7 +1057,7 @@ func cleanUpFieldsGithubEventSource(eventSource **eventsourcev1alpha1.EventSourc
10331057
}
10341058
}
10351059

1036-
_, githup := nestedMapLookup(crd, "spec", "github", "push", "id")
1060+
_, githup := nestedMapLookup(crd, "spec", "github", "github-push-heads", "id")
10371061
if githup != nil {
10381062
delete(githup, "id")
10391063
delete(githup, "owner")

cmd/commands/runtime.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -707,7 +707,7 @@ To complete the installation:
707707
<BIN> integration git register default --runtime %s --token <AUTHENTICATION_TOKEN>
708708
`,
709709
store.Get().AppProxyIngressPath,
710-
store.Get().GithubExampleEventSourceEndpointPath,
710+
util.GenerateIngressEventSourcePath(opts.RuntimeName),
711711
opts.RuntimeName,
712712
opts.GitIntegrationCreationOpts.APIURL,
713713
opts.RuntimeName))

pkg/store/store.go

Lines changed: 102 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -44,99 +44,100 @@ type Version struct {
4444
}
4545

4646
type Store struct {
47-
ArgoCDServerName string
48-
ArgoCDTokenKey string
49-
ArgoCDTokenSecret string
50-
ArgoWFServiceName string
51-
ArgoWFServicePort int32
52-
BinaryName string
53-
Codefresh string
54-
CodefreshDeliveryPipelines string
55-
CFComponentType string
56-
CFGitSourceType string
57-
CFRuntimeDefType string
58-
CFRuntimeType string
59-
CFTokenSecret string
60-
CFTokenSecretKey string
61-
CFStoreIVSecretKey string
62-
CodefreshCM string
63-
CodefreshSA string
64-
ComponentsReporterName string
65-
ComponentsReporterSA string
66-
ComponentsReporterURL string
67-
DefaultAPI string
68-
EventBusName string
69-
EventReportingEndpoint string
70-
EventsReporterName string
71-
GitSourceName string
72-
WorkflowsIngressName string
73-
WorkflowsIngressPath string
74-
AppProxyIngressName string
75-
AppProxyIngressPath string
76-
AppProxyServicePort int32
77-
AppProxyServiceName string
78-
DocsLink string
79-
LabelKeyCFType string
80-
LabelKeyCFInternal string
81-
MarketplaceGitSourceName string
82-
MarketplaceRepo string
83-
MaxDefVersion *semver.Version
84-
RuntimeDefURL string
85-
Version Version
86-
WaitTimeout time.Duration
87-
WorkflowName string
88-
WorkflowReporterName string
89-
WorkflowTriggerServiceAccount string
90-
CronExampleSensorFileName string
91-
CronExampleEventSourceFileName string
92-
CronExampleWfTemplateFileName string
93-
CronExampleEventSourceName string
94-
CronExampleEventName string
95-
CronExampleTriggerTemplateName string
96-
CronExampleDependencyName string
97-
GithubExampleEventSourceFileName string
98-
GithubExampleEventSourceObjectName string
99-
GithubExampleEventSourceEndpointPath string
100-
GithubExampleEventSourceTargetPort string
101-
GithubExampleEventSourceServicePort int32
102-
GithubExampleIngressFileName string
103-
GithubExampleIngressObjectName string
104-
GithubExampleSensorFileName string
105-
GithubExampleSensorObjectName string
106-
GithubExampleWfTemplateFileName string
107-
GithubExampleEventName string
108-
GithubExampleTriggerTemplateName string
109-
GithubExampleDependencyName string
110-
GithubAccessTokenSecretObjectName string
111-
GithubAccessTokenSecretKey string
112-
ArgoCD string
113-
Silent bool
114-
InsecureIngressHost bool
115-
BypassIngressClassCheck bool
116-
SkipIngress bool
117-
MinimumMemorySizeRequired string
118-
MinimumCpuRequired string
119-
MinimumLocalDiskSizeRequired string
120-
ReplicaSetResourceName string
121-
AnalysisRunResourceName string
122-
WorkflowResourceName string
123-
RequirementsLink string
124-
DownloadCliLink string
125-
RolloutReporterName string
126-
RolloutResourceName string
127-
RolloutReporterServiceAccount string
128-
SegmentWriteKey string
129-
DefaultNamespace string
130-
NetworkTesterName string
131-
NetworkTesterGenerateName string
132-
NetworkTesterImage string
133-
MinKubeVersion string
134-
MaxKubeVersion string
135-
MasterIngressName string
136-
InClusterPath string
137-
SccName string
138-
CFInternalGitSources []string
139-
CFInternalReporters []string
47+
ArgoCDServerName string
48+
ArgoCDTokenKey string
49+
ArgoCDTokenSecret string
50+
ArgoWFServiceName string
51+
ArgoWFServicePort int32
52+
BinaryName string
53+
Codefresh string
54+
CodefreshDeliveryPipelines string
55+
CFComponentType string
56+
CFGitSourceType string
57+
CFRuntimeDefType string
58+
CFRuntimeType string
59+
CFTokenSecret string
60+
CFTokenSecretKey string
61+
CFStoreIVSecretKey string
62+
CodefreshCM string
63+
CodefreshSA string
64+
ComponentsReporterName string
65+
ComponentsReporterSA string
66+
ComponentsReporterURL string
67+
DefaultAPI string
68+
EventBusName string
69+
EventReportingEndpoint string
70+
EventsReporterName string
71+
GitSourceName string
72+
WorkflowsIngressName string
73+
WorkflowsIngressPath string
74+
AppProxyIngressName string
75+
AppProxyIngressPath string
76+
AppProxyServicePort int32
77+
AppProxyServiceName string
78+
DocsLink string
79+
LabelKeyCFType string
80+
LabelKeyCFInternal string
81+
MarketplaceGitSourceName string
82+
MarketplaceRepo string
83+
MaxDefVersion *semver.Version
84+
RuntimeDefURL string
85+
Version Version
86+
WaitTimeout time.Duration
87+
WorkflowName string
88+
WorkflowReporterName string
89+
WorkflowTriggerServiceAccount string
90+
CronExampleSensorFileName string
91+
CronExampleEventSourceFileName string
92+
CronExampleWfTemplateFileName string
93+
CronExampleEventSourceName string
94+
CronExampleEventName string
95+
CronExampleTriggerTemplateName string
96+
CronExampleDependencyName string
97+
GithubExampleEventSourceFileName string
98+
GithubExampleEventSourceObjectName string
99+
WebhooksRootPath string
100+
GithubExampleEventSourceTargetPort string
101+
GithubExampleEventSourceServicePort int32
102+
GithubExampleIngressFileName string
103+
GithubExampleIngressObjectName string
104+
GithubExampleSensorFileName string
105+
GithubExampleSensorObjectName string
106+
GithubExampleWfTemplateFileName string
107+
GithubExampleEventName string
108+
GithubExampleTriggerTemplateName string
109+
GithubExampleDependencyName string
110+
GithubAccessTokenSecretObjectName string
111+
GithubAccessTokenSecretKey string
112+
GithubEventTypeHeader string
113+
ArgoCD string
114+
Silent bool
115+
InsecureIngressHost bool
116+
BypassIngressClassCheck bool
117+
SkipIngress bool
118+
MinimumMemorySizeRequired string
119+
MinimumCpuRequired string
120+
MinimumLocalDiskSizeRequired string
121+
ReplicaSetResourceName string
122+
AnalysisRunResourceName string
123+
WorkflowResourceName string
124+
RequirementsLink string
125+
DownloadCliLink string
126+
RolloutReporterName string
127+
RolloutResourceName string
128+
RolloutReporterServiceAccount string
129+
SegmentWriteKey string
130+
DefaultNamespace string
131+
NetworkTesterName string
132+
NetworkTesterGenerateName string
133+
NetworkTesterImage string
134+
MinKubeVersion string
135+
MaxKubeVersion string
136+
MasterIngressName string
137+
InClusterPath string
138+
SccName string
139+
CFInternalGitSources []string
140+
CFInternalReporters []string
140141
}
141142

142143
// Get returns the global store
@@ -152,7 +153,8 @@ func init() {
152153
s.ArgoWFServicePort = 2746
153154
s.BinaryName = binaryName
154155
s.Codefresh = "codefresh"
155-
s.CodefreshDeliveryPipelines = "codefresh-delivery-pipelines"
156+
s.GitSourceName = "default-git-source"
157+
s.CodefreshDeliveryPipelines = fmt.Sprintf("%s-%s", "cdp", s.GitSourceName)
156158
s.CFComponentType = "component"
157159
s.CFGitSourceType = "git-source"
158160
s.CFRuntimeDefType = "runtimeDef"
@@ -168,7 +170,6 @@ func init() {
168170
s.EventBusName = "codefresh-eventbus"
169171
s.EventReportingEndpoint = "/2.0/api/events"
170172
s.EventsReporterName = "events-reporter"
171-
s.GitSourceName = "default-git-source"
172173
s.WorkflowsIngressName = "-workflows-ingress"
173174
s.WorkflowsIngressPath = "workflows"
174175
s.AppProxyIngressName = "-cap-app-proxy"
@@ -195,19 +196,20 @@ func init() {
195196
s.CronExampleDependencyName = "calendar-dep"
196197
s.GithubExampleEventSourceFileName = "push-github.event-source.yaml"
197198
s.GithubExampleEventSourceObjectName = "push-github"
198-
s.GithubExampleEventSourceEndpointPath = "/webhooks/push-github/"
199-
s.GithubExampleEventSourceTargetPort = "13000"
200-
s.GithubExampleEventSourceServicePort = 13000
199+
s.WebhooksRootPath = "/webhooks"
200+
s.GithubExampleEventSourceTargetPort = "80"
201+
s.GithubExampleEventSourceServicePort = 80
201202
s.GithubExampleIngressFileName = fmt.Sprintf("%s.ingress.yaml", s.CodefreshDeliveryPipelines)
202203
s.GithubExampleIngressObjectName = "github"
203204
s.GithubExampleSensorFileName = "push-github.sensor.yaml"
204205
s.GithubExampleSensorObjectName = "push-github"
205206
s.GithubExampleWfTemplateFileName = "workflow-template.hello-world.yaml"
206-
s.GithubExampleEventName = "push"
207+
s.GithubExampleEventName = "github-push-heads"
207208
s.GithubExampleTriggerTemplateName = "hello-world"
208-
s.GithubExampleDependencyName = "github-dep"
209+
s.GithubExampleDependencyName = "github-push-heads"
209210
s.GithubAccessTokenSecretObjectName = "autopilot-secret"
210211
s.GithubAccessTokenSecretKey = "git_token"
212+
s.GithubEventTypeHeader = "X-GitHub-Event"
211213
s.ArgoCD = "argo-cd"
212214
s.RolloutResourceName = "rollouts"
213215
s.ReplicaSetResourceName = "replicasets"

0 commit comments

Comments
 (0)