Skip to content

Commit 760757a

Browse files
fixing gitsource (#49)
1 parent ddf1d72 commit 760757a

File tree

5 files changed

+7
-147
lines changed

5 files changed

+7
-147
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.51
1+
VERSION=v0.0.52
22
OUT_DIR=dist
33
YEAR?=$(shell date +"%Y")
44

cmd/commands/runtime.go

Lines changed: 2 additions & 142 deletions
Original file line numberDiff line numberDiff line change
@@ -803,155 +803,15 @@ func createDemoWorkflowTemplate(ctx context.Context, gsCloneOpts *git.CloneOptio
803803
}
804804

805805
func createGitSource(ctx context.Context, insCloneOpts *git.CloneOptions, gsCloneOpts *git.CloneOptions, gsName, runtimeName, cfBaseURL string) error {
806-
var err error
807-
808-
insRepo, insFs, err := insCloneOpts.GetRepo(ctx)
809-
if err != nil {
810-
return err
811-
}
812-
813-
resPath := insFs.Join(apstore.Default.AppsDir, gsName, runtimeName, "resources")
814-
eventSourceName := gsName + "-event-source"
815-
gsSyncName := gsName + "-synchronize"
816-
selectors := []eventsutil.CreateSelectorOptions{
817-
{
818-
Key: "app.kubernetes.io/instance",
819-
Operation: "==",
820-
Value: gsSyncName,
821-
},
822-
}
823-
eventSource := eventsutil.CreateEventSource(&eventsutil.CreateEventSourceOptions{
824-
Name: eventSourceName,
825-
Namespace: runtimeName,
826-
ServiceAccountName: store.Get().CodefreshSA,
827-
EventBusName: store.Get().EventBusName,
828-
Resource: map[string]eventsutil.CreateResourceEventSourceOptions{
829-
// "clusterWorkflowTemplate": {
830-
// Group: "argoproj.io",
831-
// Version: "v1alpha1",
832-
// Resource: "clusterworkflowtemplates",
833-
// Namespace: runtimeName,
834-
// Selectors: selectors,
835-
// },
836-
"cronWorkflow": {
837-
Group: "argoproj.io",
838-
Version: "v1alpha1",
839-
Resource: "cronworkflows",
840-
Namespace: runtimeName,
841-
Selectors: selectors,
842-
},
843-
"workflowTemplate": {
844-
Group: "argoproj.io",
845-
Version: "v1alpha1",
846-
Resource: "workflowtemplates",
847-
Namespace: runtimeName,
848-
Selectors: selectors,
849-
},
850-
"workflow": {
851-
Group: "argoproj.io",
852-
Version: "v1alpha1",
853-
Resource: "workflows",
854-
Namespace: runtimeName,
855-
Selectors: selectors,
856-
},
857-
"appProject": {
858-
Group: "argoproj.io",
859-
Version: "v1alpha1",
860-
Resource: "appprojects",
861-
Namespace: runtimeName,
862-
Selectors: selectors,
863-
},
864-
"application": {
865-
Group: "argoproj.io",
866-
Version: "v1alpha1",
867-
Resource: "applications",
868-
Namespace: runtimeName,
869-
Selectors: selectors,
870-
},
871-
"eventBus": {
872-
Group: "argoproj.io",
873-
Version: "v1alpha1",
874-
Resource: "eventbus",
875-
Namespace: runtimeName,
876-
Selectors: selectors,
877-
},
878-
"eventSource": {
879-
Group: "argoproj.io",
880-
Version: "v1alpha1",
881-
Resource: "eventsources",
882-
Namespace: runtimeName,
883-
Selectors: selectors,
884-
},
885-
"sensor": {
886-
Group: "argoproj.io",
887-
Version: "v1alpha1",
888-
Resource: "sensors",
889-
Namespace: runtimeName,
890-
Selectors: selectors,
891-
},
892-
"rollout": {
893-
Group: "argoproj.io",
894-
Version: "v1alpha1",
895-
Resource: "rollouts",
896-
Namespace: runtimeName,
897-
Selectors: selectors,
898-
},
899-
},
900-
})
901-
if err := insFs.WriteYamls(insFs.Join(resPath, "event-source.yaml"), eventSource); err != nil {
902-
return err
903-
}
904-
905-
sensor := eventsutil.CreateSensor(&eventsutil.CreateSensorOptions{
906-
Name: gsName + "-sensor",
907-
Namespace: runtimeName,
908-
EventSourceName: eventSourceName,
909-
EventBusName: store.Get().EventBusName,
910-
TriggerURL: cfBaseURL + store.Get().EventReportingEndpoint,
911-
Triggers: []string{
912-
// "clusterWorkflowTemplate",
913-
"workflowTemplate",
914-
"workflow",
915-
"appProject",
916-
"application",
917-
"eventBus",
918-
"eventSource",
919-
"sensor",
920-
"rollout",
921-
},
922-
})
923-
if err = insFs.WriteYamls(insFs.Join(resPath, "sensor.yaml"), sensor); err != nil {
924-
return err
925-
}
926-
927806
gsPath := gsCloneOpts.FS.Join(apstore.Default.AppsDir, gsName, runtimeName)
928807
fullGsPath := gsCloneOpts.FS.Join(gsCloneOpts.FS.Root(), gsPath)[1:]
929-
syncApp := cdutil.CreateApp(&cdutil.CreateAppOptions{
930-
Name: gsSyncName,
931-
Namespace: runtimeName,
932-
Project: runtimeName,
933-
SyncWave: 10,
934-
RepoURL: gsCloneOpts.URL(),
935-
Revision: gsCloneOpts.Revision(),
936-
SrcPath: fullGsPath,
937-
})
938-
if err = insFs.WriteYamls(insFs.Join(resPath, gsName+"-synchronize.yaml"), syncApp); err != nil {
939-
return err
940-
}
941-
942-
_, err = insRepo.Persist(ctx, &git.PushOptions{
943-
CommitMsg: fmt.Sprintf("Created %s Resources", gsName),
944-
})
945-
if err != nil {
946-
return err
947-
}
948808

949809
appDef := &runtime.AppDef{
950810
Name: gsName,
951811
Type: application.AppTypeDirectory,
952-
URL: insCloneOpts.URL() + insFs.Join(insFs.Root(), resPath),
812+
URL: gsCloneOpts.URL() + fullGsPath,
953813
}
954-
if err = appDef.CreateApp(ctx, nil, insCloneOpts, runtimeName, store.Get().CFGitSourceType, nil); err != nil {
814+
if err := appDef.CreateApp(ctx, nil, insCloneOpts, runtimeName, store.Get().CFGitSourceType, nil); err != nil {
955815
return fmt.Errorf("failed to create git-source: %w", err)
956816
}
957817

docs/releases/release_notes.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
### Linux
99
```bash
1010
# download and extract the binary
11-
curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.0.51/cf-linux-amd64.tar.gz | tar zx
11+
curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.0.52/cf-linux-amd64.tar.gz | tar zx
1212

1313
# move the binary to your $PATH
1414
mv ./cf-linux-amd64 /usr/local/bin/cf
@@ -20,7 +20,7 @@ cf version
2020
### Mac
2121
```bash
2222
# download and extract the binary
23-
curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.0.51/cf-darwin-amd64.tar.gz | tar zx
23+
curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.0.52/cf-darwin-amd64.tar.gz | tar zx
2424

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

manifests/argo-cd/kustomization.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ configMapGenerator:
1414
- name: argocd-cm
1515
behavior: merge
1616
literals:
17-
- "timeout.reconciliation=10s"
17+
- "timeout.reconciliation=20s"
1818
- "accounts.admin=apiKey,login" # need to be able to generate apikey for generic eventsource
1919
- name: argocd-cmd-params-cm
2020
behavior: merge

manifests/runtime.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ metadata:
55
namespace: "{{ namespace }}"
66
spec:
77
defVersion: 1.0.0
8-
version: 0.0.51
8+
version: 0.0.52
99
bootstrapSpecifier: github.com/codefresh-io/cli-v2/manifests/argo-cd
1010
components:
1111
- name: events

0 commit comments

Comments
 (0)