Skip to content

Commit c29ac53

Browse files
support for example pipeline (#210)
* support for example pipeline * wip * wip * remove ingress annotation
1 parent ca8da18 commit c29ac53

File tree

6 files changed

+42
-37
lines changed

6 files changed

+42
-37
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.190
1+
VERSION=v0.0.191
22

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

cmd/commands/git-source.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ type (
7373
CreateDemoResources bool
7474
Exclude string
7575
Include string
76+
IngressHost string
7677
}
7778

7879
GitSourceDeleteOptions struct {
@@ -99,6 +100,7 @@ type (
99100
runtimeName string
100101
gsCloneOpts *git.CloneOptions
101102
gsFs fs.FS
103+
ingressHost string
102104
}
103105
)
104106

@@ -249,6 +251,7 @@ func createDemoResources(ctx context.Context, opts *GitSourceCreateOptions, gsRe
249251
runtimeName: opts.RuntimeName,
250252
gsCloneOpts: opts.GsCloneOpts,
251253
gsFs: gsFs,
254+
ingressHost: opts.IngressHost,
252255
})
253256
if err != nil {
254257
return fmt.Errorf("failed to create github example pipeline. Error: %w", err)
@@ -668,7 +671,7 @@ func createGithubExamplePipeline(opts *gitSourceGithubExampleOptions) error {
668671

669672
// Create a github eventsource that will listen to push events in the git source repo
670673
gsRepoURL := opts.gsCloneOpts.URL()
671-
eventSource := createGithubExampleEventSource(gsRepoURL)
674+
eventSource := createGithubExampleEventSource(gsRepoURL, opts.ingressHost)
672675
eventSourceFilePath := opts.gsFs.Join(opts.gsCloneOpts.Path(), store.Get().GithubExampleEventSourceFileName)
673676
err = opts.gsCloneOpts.FS.WriteYamls(eventSourceFilePath, eventSource)
674677
if err != nil {
@@ -688,16 +691,15 @@ func createGithubExamplePipeline(opts *gitSourceGithubExampleOptions) error {
688691

689692
func createGithubExampleIngress() *netv1.Ingress {
690693
return ingressutil.CreateIngress(&ingressutil.CreateIngressOptions{
691-
Name: store.Get().GithubExampleIngressObjectName,
694+
Name: store.Get().CodefreshDeliveryPipelines,
692695
Paths: []ingressutil.IngressPath{
693696
{
694697
Path: store.Get().GithubExampleEventSourceEndpointPath,
695698
PathType: netv1.PathTypeImplementationSpecific,
696699
ServiceName: store.Get().GithubExampleEventSourceObjectName + "-eventsource-svc",
697700
ServicePort: store.Get().GithubExampleEventSourceServicePort,
698701
},
699-
},
700-
})
702+
}, })
701703
}
702704

703705
func getRepoOwnerAndNameFromRepoURL(repoURL string) (owner string, name string) {
@@ -708,7 +710,7 @@ func getRepoOwnerAndNameFromRepoURL(repoURL string) (owner string, name string)
708710
return owner, name
709711
}
710712

711-
func createGithubExampleEventSource(repoURL string) *eventsourcev1alpha1.EventSource {
713+
func createGithubExampleEventSource(repoURL string, ingressHost string) *eventsourcev1alpha1.EventSource {
712714
repoOwner, repoName := getRepoOwnerAndNameFromRepoURL(repoURL)
713715

714716
return &eventsourcev1alpha1.EventSource{
@@ -733,7 +735,7 @@ func createGithubExampleEventSource(repoURL string) *eventsourcev1alpha1.EventSo
733735
store.Get().GithubExampleEventName: {
734736
Webhook: &eventsourcev1alpha1.WebhookContext{
735737
Endpoint: store.Get().GithubExampleEventSourceEndpointPath,
736-
URL: "http://replace-with-real-public-url",
738+
URL: strings.Trim(ingressHost, "/"),
737739
Port: store.Get().GithubExampleEventSourceTargetPort,
738740
Method: "POST",
739741
},

cmd/commands/runtime.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,7 @@ func RunRuntimeInstall(ctx context.Context, opts *RuntimeInstallOptions) error {
431431
GsName: store.Get().GitSourceName,
432432
RuntimeName: opts.RuntimeName,
433433
CreateDemoResources: opts.InstallDemoResources,
434+
IngressHost: opts.IngressHost,
434435
})
435436
appendLogToSummary(gitSrcMessage, err)
436437
if err != nil {

docs/releases/release_notes.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ cf version
2323

2424
```bash
2525
# download and extract the binary
26-
curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.0.190/cf-linux-amd64.tar.gz | tar zx
26+
curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.0.191/cf-linux-amd64.tar.gz | tar zx
2727

2828
# move the binary to your $PATH
2929
mv ./cf-linux-amd64 /usr/local/bin/cf
@@ -36,7 +36,7 @@ cf version
3636

3737
```bash
3838
# download and extract the binary
39-
curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.0.190/cf-darwin-amd64.tar.gz | tar zx
39+
curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.0.191/cf-darwin-amd64.tar.gz | tar zx
4040

4141
# move the binary to your $PATH
4242
mv ./cf-darwin-amd64 /usr/local/bin/cf

manifests/runtime.yaml

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
apiVersion: codefresh.io/v1alpha1
22
kind: Runtime
33
metadata:
4-
name: '{{ name }}'
5-
namespace: '{{ namespace }}'
4+
name: "{{ name }}"
5+
namespace: "{{ namespace }}"
66
spec:
7-
defVersion: 1.0.0
8-
version: 0.0.190
9-
bootstrapSpecifier: github.com/codefresh-io/cli-v2/manifests/argo-cd
10-
components:
11-
- name: events
12-
type: kustomize
13-
url: github.com/codefresh-io/cli-v2/manifests/argo-events
14-
wait: true
15-
- name: rollouts
16-
type: kustomize
17-
url: github.com/codefresh-io/cli-v2/manifests/argo-rollouts
18-
- name: workflows
19-
type: kustomize
20-
url: github.com/codefresh-io/cli-v2/manifests/argo-workflows
21-
- name: argocd-agent
22-
type: kustomize
23-
url: github.com/codefresh-io/cli-v2/manifests/argo-agent
24-
- name: app-proxy
25-
type: kustomize
26-
url: github.com/codefresh-io/cli-v2/manifests/app-proxy
7+
defVersion: 1.0.0
8+
version: 0.0.191
9+
bootstrapSpecifier: github.com/codefresh-io/cli-v2/manifests/argo-cd
10+
components:
11+
- name: events
12+
type: kustomize
13+
url: github.com/codefresh-io/cli-v2/manifests/argo-events
14+
wait: true
15+
- name: rollouts
16+
type: kustomize
17+
url: github.com/codefresh-io/cli-v2/manifests/argo-rollouts
18+
- name: workflows
19+
type: kustomize
20+
url: github.com/codefresh-io/cli-v2/manifests/argo-workflows
21+
- name: argocd-agent
22+
type: kustomize
23+
url: github.com/codefresh-io/cli-v2/manifests/argo-agent
24+
- name: app-proxy
25+
type: kustomize
26+
url: github.com/codefresh-io/cli-v2/manifests/app-proxy

pkg/store/store.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ type Store struct {
6868
ArgoWFServicePort int32
6969
BinaryName string
7070
Codefresh string
71+
CodefreshDeliveryPipelines string
7172
CFComponentType string
7273
CFGitSourceType string
7374
CFRuntimeDefType string
@@ -151,6 +152,7 @@ func init() {
151152
s.ArgoWFServicePort = 2746
152153
s.BinaryName = binaryName
153154
s.Codefresh = "codefresh"
155+
s.CodefreshDeliveryPipelines = "codefresh-delivery-pipelines"
154156
s.CFComponentType = "component"
155157
s.CFGitSourceType = "git-source"
156158
s.CFRuntimeDefType = "runtimeDef"
@@ -193,15 +195,15 @@ func init() {
193195
s.CronExampleEventName = "example-with-interval"
194196
s.CronExampleTriggerTemplateName = "hello-world"
195197
s.CronExampleDependencyName = "calendar-dep"
196-
s.GithubExampleEventSourceFileName = "event-source.git-source.yaml"
197-
s.GithubExampleEventSourceObjectName = "github"
198-
s.GithubExampleEventSourceEndpointPath = "/git-source/"
198+
s.GithubExampleEventSourceFileName = "push-github.event-source.yaml"
199+
s.GithubExampleEventSourceObjectName = "push-github"
200+
s.GithubExampleEventSourceEndpointPath = "/webhooks/push-github/"
199201
s.GithubExampleEventSourceTargetPort = "13000"
200202
s.GithubExampleEventSourceServicePort = 13000
201-
s.GithubExampleIngressFileName = "ingress.git-source.yaml"
203+
s.GithubExampleIngressFileName = fmt.Sprintf("%s.ingress.yaml", s.CodefreshDeliveryPipelines)
202204
s.GithubExampleIngressObjectName = "github"
203-
s.GithubExampleSensorFileName = "sensor.git-source.yaml"
204-
s.GithubExampleSensorObjectName = "github"
205+
s.GithubExampleSensorFileName = "push-github.sensor.yaml"
206+
s.GithubExampleSensorObjectName = "push-github"
205207
s.GithubExampleWfTemplateFileName = "workflow-template.hello-world.yaml"
206208
s.GithubExampleEventName = "push"
207209
s.GithubExampleTriggerTemplateName = "hello-world"

0 commit comments

Comments
 (0)