From 5acfab81b733bf9154f02c4612bd63b1acfdc897 Mon Sep 17 00:00:00 2001 From: Noam Gal Date: Tue, 22 Jun 2021 16:01:18 +0300 Subject: [PATCH] CR-4769 - repo install + create git_source (#10) * create default-git-source app + events * update to workflows v3.1.0 * write WorkflowTemplate in git-source folder --- Makefile | 2 +- cmd/commands/runtime.go | 522 ++++++++++++-------- docs/commands/cli-v2_runtime_create.md | 8 +- go.mod | 7 +- go.sum | 65 ++- manifests/argo-events/eventbus.yaml | 2 + manifests/argo-workflows/kustomization.yaml | 2 +- pkg/cdUtils/cdUtils.go | 99 ++++ pkg/eventUtils/eventUtils.go | 223 +++++++++ pkg/store/store.go | 30 +- 10 files changed, 713 insertions(+), 247 deletions(-) create mode 100644 pkg/cdUtils/cdUtils.go create mode 100644 pkg/eventUtils/eventUtils.go diff --git a/Makefile b/Makefile index 31f5e0099..3c4362d91 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -VERSION=v0.0.15 +VERSION=v0.0.16 OUT_DIR=dist YEAR?=$(shell date +"%Y") diff --git a/cmd/commands/runtime.go b/cmd/commands/runtime.go index bf3446be5..192e5d261 100644 --- a/cmd/commands/runtime.go +++ b/cmd/commands/runtime.go @@ -19,6 +19,8 @@ import ( "fmt" "io/ioutil" + "github.com/codefresh-io/cli-v2/pkg/cdUtils" + "github.com/codefresh-io/cli-v2/pkg/eventUtils" "github.com/codefresh-io/cli-v2/pkg/log" "github.com/codefresh-io/cli-v2/pkg/store" "github.com/codefresh-io/cli-v2/pkg/util" @@ -31,27 +33,22 @@ import ( "github.com/argoproj-labs/argocd-autopilot/pkg/kube" apstore "github.com/argoproj-labs/argocd-autopilot/pkg/store" argocdv1alpha1 "github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1" - apicommon "github.com/argoproj/argo-events/pkg/apis/common" - eventsourcereg "github.com/argoproj/argo-events/pkg/apis/eventsource" - eventsourcev1alpha1 "github.com/argoproj/argo-events/pkg/apis/eventsource/v1alpha1" - sensorreg "github.com/argoproj/argo-events/pkg/apis/sensor" - sensorsv1alpha1 "github.com/argoproj/argo-events/pkg/apis/sensor/v1alpha1" + wf "github.com/argoproj/argo-workflows/v3/pkg/apis/workflow" + wfv1alpha1 "github.com/argoproj/argo-workflows/v3/pkg/apis/workflow/v1alpha1" "github.com/ghodss/yaml" "github.com/spf13/cobra" v1 "k8s.io/api/core/v1" rbacv1 "k8s.io/api/rbac/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/util/intstr" ) type ( RuntimeCreateOptions struct { - RuntimeName string - KubeContext string - KubeFactory kube.Factory - installRepo *apcmd.RepoCreateOptions - // gitSrcRepo *apcmd.RepoCreateOptions + RuntimeName string + KubeContext string + KubeFactory kube.Factory + insCreateOpts *apcmd.RepoCreateOptions + gsCreateOpts *apcmd.RepoCreateOptions } ) @@ -73,9 +70,9 @@ func NewRuntimeCommand() *cobra.Command { func NewRuntimeCreateCommand() *cobra.Command { var ( - f kube.Factory - installRepo *apcmd.RepoCreateOptions - //gitSrcRepo *apcmd.RepoCreateOptions + f kube.Factory + insCreateOpts *apcmd.RepoCreateOptions + gsCreateOpts *apcmd.RepoCreateOptions ) cmd := &cobra.Command{ @@ -97,74 +94,124 @@ func NewRuntimeCreateCommand() *cobra.Command { `), RunE: func(cmd *cobra.Command, args []string) error { opts := &RuntimeCreateOptions{ - KubeContext: "", - KubeFactory: f, - installRepo: installRepo, - // gitSrcRepo: gitSrcRepo, + KubeContext: "", + KubeFactory: f, + insCreateOpts: insCreateOpts, + gsCreateOpts: gsCreateOpts, } if len(args) < 1 { log.G().Fatal("must enter runtime name") } opts.RuntimeName = args[0] - installRepo.Public = false + insCreateOpts.Public = false return RunRuntimeCreate(cmd.Context(), opts) }, } - installRepo = apcmd.AddRepoCreateFlags(cmd, "install") - // gitSrcRepo = apcmd.AddRepoCreateFlags(cmd, "git-src") + insCreateOpts = apcmd.AddRepoCreateFlags(cmd, "install") + gsCreateOpts = apcmd.AddRepoCreateFlags(cmd, "git-src") f = kube.AddFlags(cmd.Flags()) return cmd } func RunRuntimeCreate(ctx context.Context, opts *RuntimeCreateOptions) error { - installOpts, err := apcmd.RunRepoCreate(ctx, opts.installRepo) + insCloneOpts, err := apcmd.RunRepoCreate(ctx, opts.insCreateOpts) if err != nil { return err } - installOpts.Progress = ioutil.Discard + // var err error + // installOpts := &git.CloneOptions{ + // Repo: "github.com/noam-codefresh/demo", + // Auth: git.Auth{ + // Password: "", + // }, + // FS: fs.Create(memfs.New()), + // } + // installOpts.Parse() + + insCloneOpts.Progress = ioutil.Discard err = apcmd.RunRepoBootstrap(ctx, &apcmd.RepoBootstrapOptions{ AppSpecifier: store.Get().ArgoCDManifestsURL, Namespace: opts.RuntimeName, KubeContext: opts.KubeContext, KubeFactory: opts.KubeFactory, - CloneOptions: installOpts, + CloneOptions: insCloneOpts, }) if err != nil { return err } err = apcmd.RunProjectCreate(ctx, &apcmd.ProjectCreateOptions{ - CloneOpts: installOpts, + CloneOpts: insCloneOpts, ProjectName: opts.RuntimeName, }) if err != nil { return err } - if err = createApp(ctx, installOpts, opts.RuntimeName, "events", store.Get().ArgoEventsManifestsURL, application.AppTypeKustomize, opts.RuntimeName); err != nil { - return fmt.Errorf("failed to create application events: %w", err) + if err = createApp(ctx, insCloneOpts, opts.RuntimeName, "events", store.Get().ArgoEventsManifestsURL, application.AppTypeKustomize, opts.RuntimeName); err != nil { + return fmt.Errorf("failed to create events application: %w", err) + } + + if err = createApp(ctx, insCloneOpts, opts.RuntimeName, "rollouts", store.Get().ArgoRolloutsManifestsURL, application.AppTypeKustomize, opts.RuntimeName); err != nil { + return fmt.Errorf("failed to create rollouts application: %w", err) } - if err = createApp(ctx, installOpts, opts.RuntimeName, "rollouts", store.Get().ArgoRolloutsManifestsURL, application.AppTypeKustomize, opts.RuntimeName); err != nil { - return fmt.Errorf("failed to create application rollouts: %w", err) + if err = createApp(ctx, insCloneOpts, opts.RuntimeName, "workflows", store.Get().ArgoWorkflowsManifestsURL, application.AppTypeKustomize, opts.RuntimeName); err != nil { + return fmt.Errorf("failed to create workflows application: %w", err) } - if err = createApp(ctx, installOpts, opts.RuntimeName, "workflows", store.Get().ArgoWorkflowsManifestsURL, application.AppTypeKustomize, opts.RuntimeName); err != nil { - return fmt.Errorf("failed to create application workflows: %w", err) + if err = createComponentsReporter(ctx, insCloneOpts, opts); err != nil { + return fmt.Errorf("failed to create components-reporter: %w", err) } - if err = createCodefreshResources(ctx, installOpts, opts); err != nil { - return fmt.Errorf("failed to update project file: %w", err) + if opts.gsCreateOpts.Token == "" { + opts.gsCreateOpts.Token = opts.insCreateOpts.Token + } + + gsCloneOpts, err := apcmd.RunRepoCreate(ctx, opts.gsCreateOpts) + if err != nil { + return err + } + + // gsCloneOpts := &git.CloneOptions{ + // Repo: "github.com/noam-codefresh/git-source", + // Auth: git.Auth{ + // Password: gsCreateOpts.Token, + // }, + // FS: fs.Create(memfs.New()), + // } + // gsCloneOpts.Parse() + + if err = createDemoWorkflowTemplate(ctx, gsCloneOpts, store.Get().GitSourceName, opts.RuntimeName); err != nil { + return err + } + + if err = createGitSource(ctx, insCloneOpts, gsCloneOpts, store.Get().GitSourceName, opts.RuntimeName); err != nil { + return fmt.Errorf("failed to create `%s`: %w", store.Get().GitSourceName, err) } return nil } -func createCodefreshResources(ctx context.Context, cloneOpts *git.CloneOptions, opts *RuntimeCreateOptions) error { +func createApp(ctx context.Context, cloneOpts *git.CloneOptions, projectName, appName, appURL, appType, namespace string) error { + return apcmd.RunAppCreate(ctx, &apcmd.AppCreateOptions{ + CloneOpts: cloneOpts, + AppsCloneOpts: &git.CloneOptions{}, + ProjectName: projectName, + AppOpts: &application.CreateOptions{ + AppName: appName, + AppSpecifier: appURL, + AppType: appType, + DestNamespace: namespace, + }, + }) +} + +func createComponentsReporter(ctx context.Context, cloneOpts *git.CloneOptions, opts *RuntimeCreateOptions) error { tokenSecret, err := getTokenSecret(opts.RuntimeName) if err != nil { return fmt.Errorf("failed to create codefresh token secret: %w", err) @@ -196,7 +243,7 @@ func createCodefreshResources(ctx context.Context, cloneOpts *git.CloneOptions, return err } - if err := createSensor(repofs, resPath, opts.RuntimeName); err != nil { + if err := createSensor(repofs, store.Get().ComponentsReporterName, resPath, opts.RuntimeName, store.Get().ComponentsReporterName); err != nil { return err } @@ -205,20 +252,6 @@ func createCodefreshResources(ctx context.Context, cloneOpts *git.CloneOptions, }) } -func createApp(ctx context.Context, cloneOpts *git.CloneOptions, projectName, appName, appURL, appType, namespace string) error { - return apcmd.RunAppCreate(ctx, &apcmd.AppCreateOptions{ - CloneOpts: cloneOpts, - AppsCloneOpts: &git.CloneOptions{}, - ProjectName: projectName, - AppOpts: &application.CreateOptions{ - AppName: appName, - AppSpecifier: appURL, - AppType: appType, - DestNamespace: namespace, - }, - }) -} - func updateProject(repofs fs.FS, runtimeName string) error { projPath := repofs.Join(apstore.Default.ProjectsDir, runtimeName+".yaml") project, appset, err := getProjectInfoFromFile(repofs, projPath) @@ -233,8 +266,12 @@ func updateProject(repofs fs.FS, runtimeName string) error { appset.Labels = make(map[string]string) } - appset.Spec.Template.Labels[store.Get().CFType] = store.Get().CFComponentType - appset.Labels[store.Get().CFType] = store.Get().CFRuntimeType + if project.ObjectMeta.Labels == nil { + project.ObjectMeta.Labels = make(map[string]string) + } + + appset.Spec.Template.Labels[store.Get().CFType] = "component" + project.ObjectMeta.Labels[store.Get().CFType] = "runtime" return repofs.WriteYamls(projPath, project, appset) } @@ -320,193 +357,240 @@ func createRBAC(repofs fs.FS, path, runtimeName string) error { return repofs.WriteYamls(repofs.Join(path, "rbac.yaml"), serviceAccount, role, roleBinding) } -func createEventSource(repofs fs.FS, path, runtimeName string) error { - eventSource := &eventsourcev1alpha1.EventSource{ - TypeMeta: metav1.TypeMeta{ - Kind: eventsourcereg.Kind, - APIVersion: eventsourcereg.Group + "/v1alpha1", - }, - ObjectMeta: metav1.ObjectMeta{ - Name: store.Get().ComponentsReporterName, - Namespace: runtimeName, - }, - Spec: eventsourcev1alpha1.EventSourceSpec{ - Template: &eventsourcev1alpha1.Template{ - ServiceAccountName: store.Get().ComponentsReporterSA, - }, - Service: &eventsourcev1alpha1.Service{ - Ports: []v1.ServicePort{ +func createEventSource(repofs fs.FS, path, namespace string) error { + eventSource := eventUtils.CreateEventSource(&eventUtils.CreateEventSourceOptions{ + Name: store.Get().ComponentsReporterName, + Namespace: namespace, + ServiceAccountName: store.Get().ComponentsReporterSA, + EventBusName: store.Get().EventBusName, + Resource: map[string]eventUtils.CreateResourceEventSourceOptions{ + "components": { + Group: "argoproj.io", + Version: "v1alpha1", + Resource: "applications", + Namespace: namespace, + Selectors: []eventUtils.CreateSelectorOptions{ { - Port: int32(12000), - TargetPort: intstr.FromInt(12000), + Key: store.Get().CFType, + Operation: "==", + Value: store.Get().CFComponentType, }, }, }, - EventBusName: store.Get().EventBusName, - Resource: map[string]eventsourcev1alpha1.ResourceEventSource{ - "components": { - EventTypes: []eventsourcev1alpha1.ResourceEventType{ - eventsourcev1alpha1.ADD, - eventsourcev1alpha1.UPDATE, - eventsourcev1alpha1.DELETE, - }, - GroupVersionResource: metav1.GroupVersionResource{ - Group: "argoproj.io", - Version: "v1alpha1", - Resource: "applications", - }, - Namespace: runtimeName, - Filter: &eventsourcev1alpha1.ResourceFilter{ - AfterStart: false, - Labels: []eventsourcev1alpha1.Selector{ - { - Key: store.Get().CFType, - Operation: "==", - Value: store.Get().CFComponentType, - }, - }, - }, - }, - "runtime": { - EventTypes: []eventsourcev1alpha1.ResourceEventType{ - eventsourcev1alpha1.ADD, - eventsourcev1alpha1.UPDATE, - eventsourcev1alpha1.DELETE, - }, - GroupVersionResource: metav1.GroupVersionResource{ - Group: "argoproj.io", - Version: "v1alpha1", - Resource: "applicationsets", - }, - Namespace: runtimeName, - Filter: &eventsourcev1alpha1.ResourceFilter{ - AfterStart: false, - Labels: []eventsourcev1alpha1.Selector{ - { - Key: store.Get().CFType, - Operation: "==", - Value: store.Get().CFRuntimeType, - }, - }, + "runtime": { + Group: "argoproj.io", + Version: "v1alpha1", + Resource: "appprojects", + Namespace: namespace, + Selectors: []eventUtils.CreateSelectorOptions{ + { + Key: store.Get().CFType, + Operation: "==", + Value: store.Get().CFRuntimeType, }, }, }, }, - } - + }) return repofs.WriteYamls(repofs.Join(path, "event-source.yaml"), eventSource) } -func createSensor(repofs fs.FS, path, namespace string) error { - sensor := &sensorsv1alpha1.Sensor{ +func createSensor(repofs fs.FS, name, path, namespace, eventSourceName string) error { + sensor := eventUtils.CreateSensor(&eventUtils.CreateSensorOptions{ + Name: name, + Namespace: namespace, + EventSourceName: eventSourceName, + EventBusName: store.Get().EventBusName, + TriggerURL: cfConfig.GetCurrentContext().URL + store.Get().EventReportingEndpoint, + Triggers: []string{ + "components", + "runtime", + }, + }) + return repofs.WriteYamls(repofs.Join(path, "sensor.yaml"), sensor) +} + +func createDemoWorkflowTemplate(ctx context.Context, gsCloneOpts *git.CloneOptions, gsName, runtimeName string) error { + gsRepo, gsFs, err := gsCloneOpts.Clone(ctx) + if err != nil { + return err + } + + gsPath := gsCloneOpts.FS.Join(apstore.Default.AppsDir, gsName, runtimeName) + wfTemplate := &wfv1alpha1.WorkflowTemplate{ TypeMeta: metav1.TypeMeta{ - Kind: sensorreg.Kind, - APIVersion: sensorreg.Group + "/v1alpha1", + Kind: wf.WorkflowTemplateKind, + APIVersion: wfv1alpha1.SchemeGroupVersion.String(), }, ObjectMeta: metav1.ObjectMeta{ - Name: store.Get().ComponentsReporterName, - Namespace: namespace, + Name: "demo-workflow-template", + Namespace: runtimeName, }, - Spec: sensorsv1alpha1.SensorSpec{ - EventBusName: store.Get().EventBusName, - Dependencies: []sensorsv1alpha1.EventDependency{ - { - Name: "components", - EventSourceName: store.Get().ComponentsReporterName, - EventName: "components", - }, - { - Name: "runtime", - EventSourceName: store.Get().ComponentsReporterName, - EventName: "runtime", - }, - }, - Triggers: []sensorsv1alpha1.Trigger{ - { - Template: &sensorsv1alpha1.TriggerTemplate{ - Conditions: "components", - Name: "http-trigger", - HTTP: &sensorsv1alpha1.HTTPTrigger{ - URL: cfConfig.GetCurrentContext().URL + store.Get().EventReportingEndpoint, - Method: "POST", - Headers: map[string]string{ - "Content-Type": "application/json", - }, - SecureHeaders: []*apicommon.SecureHeader{ - { - Name: "Authorization", - ValueFrom: &apicommon.ValueFromSource{ - SecretKeyRef: &v1.SecretKeySelector{ - LocalObjectReference: v1.LocalObjectReference{ - Name: store.Get().CFTokenSecret, - }, - Key: store.Get().CFTokenSecretKey, - }, - }, - }, - }, - Payload: []sensorsv1alpha1.TriggerParameter{ - { - Src: &sensorsv1alpha1.TriggerParameterSource{ - DependencyName: "components", - DataKey: "body", - }, - Dest: "data", - }, - }, - }, - }, - RetryStrategy: &apicommon.Backoff{ - Steps: 3, - Duration: &apicommon.Int64OrString{ - StrVal: "3s", - }, - }, - }, - { - Template: &sensorsv1alpha1.TriggerTemplate{ - Conditions: "runtime", - Name: "http-trigger", - HTTP: &sensorsv1alpha1.HTTPTrigger{ - URL: cfConfig.GetCurrentContext().URL + store.Get().EventReportingEndpoint, - Method: "POST", - Headers: map[string]string{ - "Content-Type": "application/json", - }, - SecureHeaders: []*apicommon.SecureHeader{ - { - Name: "Authorization", - ValueFrom: &apicommon.ValueFromSource{ - SecretKeyRef: &v1.SecretKeySelector{ - LocalObjectReference: v1.LocalObjectReference{ - Name: store.Get().CFTokenSecret, - }, - Key: store.Get().CFTokenSecretKey, - }, - }, - }, - }, - Payload: []sensorsv1alpha1.TriggerParameter{ - { - Src: &sensorsv1alpha1.TriggerParameterSource{ - DependencyName: "runtime", - DataKey: "body", - }, - Dest: "data", - }, - }, - }, - }, - RetryStrategy: &apicommon.Backoff{ - Steps: 3, - Duration: &apicommon.Int64OrString{ - StrVal: "3s", + Spec: wfv1alpha1.WorkflowTemplateSpec{ + WorkflowSpec: wfv1alpha1.WorkflowSpec{ + Entrypoint: "whalesay", + Templates: []wfv1alpha1.Template{ + { + Name: "whalesay", + Container: &v1.Container{ + Image: "docker/whalesay", + Command: []string{"cowsay"}, + Args: []string{"Hello World"}, }, }, }, }, }, } + if err = gsFs.WriteYamls(gsFs.Join(gsPath, "demo-wf-template.yaml"), wfTemplate); err != nil { + return err + } - return repofs.WriteYamls(repofs.Join(path, "sensor.yaml"), sensor) + return gsRepo.Persist(ctx, &git.PushOptions{ + CommitMsg: fmt.Sprintf("Created %s Directory", gsPath), + }) +} + +func createGitSource(ctx context.Context, insCloneOpts *git.CloneOptions, gsCloneOpts *git.CloneOptions, gsName, runtimeName string) error { + var err error + + insRepo, insFs, err := insCloneOpts.Clone(ctx) + if err != nil { + return err + } + + resPath := insFs.Join(apstore.Default.AppsDir, gsName, runtimeName, "resources") + eventSourceName := gsName + "-event-source" + gsSyncName := gsName + "-synchronize" + selectors := []eventUtils.CreateSelectorOptions{ + { + Key: "app.kubernetes.io/instance", + Operation: "==", + Value: gsSyncName, + }, + } + eventSource := eventUtils.CreateEventSource(&eventUtils.CreateEventSourceOptions{ + Name: eventSourceName, + Namespace: runtimeName, + ServiceAccountName: store.Get().ComponentsReporterSA, + EventBusName: store.Get().EventBusName, + Resource: map[string]eventUtils.CreateResourceEventSourceOptions{ + // "clusterWorkflowTemplate": { + // Group: "argoproj.io", + // Version: "v1alpha1", + // Resource: "clusterworkflowtemplates", + // Namespace: runtimeName, + // Selectors: selectors, + // }, + "cronWorkflow": { + Group: "argoproj.io", + Version: "v1alpha1", + Resource: "cronworkflows", + Namespace: runtimeName, + Selectors: selectors, + }, + "workflowTemplate": { + Group: "argoproj.io", + Version: "v1alpha1", + Resource: "workflowtemplates", + Namespace: runtimeName, + Selectors: selectors, + }, + "workflow": { + Group: "argoproj.io", + Version: "v1alpha1", + Resource: "workflows", + Namespace: runtimeName, + Selectors: selectors, + }, + "appProject": { + Group: "argoproj.io", + Version: "v1alpha1", + Resource: "appprojects", + Namespace: runtimeName, + Selectors: selectors, + }, + "application": { + Group: "argoproj.io", + Version: "v1alpha1", + Resource: "applications", + Namespace: runtimeName, + Selectors: selectors, + }, + "eventBus": { + Group: "argoproj.io", + Version: "v1alpha1", + Resource: "eventbus", + Namespace: runtimeName, + Selectors: selectors, + }, + "eventSource": { + Group: "argoproj.io", + Version: "v1alpha1", + Resource: "eventsources", + Namespace: runtimeName, + Selectors: selectors, + }, + "sensor": { + Group: "argoproj.io", + Version: "v1alpha1", + Resource: "sensors", + Namespace: runtimeName, + Selectors: selectors, + }, + }, + }) + if err := insFs.WriteYamls(insFs.Join(resPath, "event-source.yaml"), eventSource); err != nil { + return err + } + + sensor := eventUtils.CreateSensor(&eventUtils.CreateSensorOptions{ + Name: gsName + "-sensor", + Namespace: runtimeName, + EventSourceName: eventSourceName, + EventBusName: store.Get().EventBusName, + TriggerURL: cfConfig.GetCurrentContext().URL + store.Get().EventReportingEndpoint, + Triggers: []string{ + "clusterWorkflowTemplate", + "workflowTemplate", + "workflow", + "appProject", + "application", + "eventBus", + "eventSource", + "sensor", + }, + }) + if err = insFs.WriteYamls(insFs.Join(resPath, "sensor.yaml"), sensor); err != nil { + return err + } + + gsPath := gsCloneOpts.FS.Join(apstore.Default.AppsDir, gsName, runtimeName) + fullGsPath := gsCloneOpts.FS.Join(gsCloneOpts.FS.Root(), gsPath)[1:] + syncApp := cdUtils.CreateApp(&cdUtils.CreateAppOptions{ + Name: gsSyncName, + Namespace: runtimeName, + Project: runtimeName, + SyncWave: 10, + RepoURL: gsCloneOpts.URL(), + Revision: gsCloneOpts.Revision(), + SrcPath: fullGsPath, + }) + if err = insFs.WriteYamls(insFs.Join(resPath, gsName+"-synchronize.yaml"), syncApp); err != nil { + return err + } + + err = insRepo.Persist(ctx, &git.PushOptions{ + CommitMsg: fmt.Sprintf("Created %s Resources", gsName), + }) + if err != nil { + return err + } + + fullResPath := insFs.Join(insFs.Root(), resPath) + if err = createApp(ctx, insCloneOpts, runtimeName, gsName, insCloneOpts.URL()+fullResPath, application.AppTypeDirectory, runtimeName); err != nil { + return fmt.Errorf("failed to create git-source: %w", err) + } + + return nil } diff --git a/docs/commands/cli-v2_runtime_create.md b/docs/commands/cli-v2_runtime_create.md index 730907e94..cf591546f 100644 --- a/docs/commands/cli-v2_runtime_create.md +++ b/docs/commands/cli-v2_runtime_create.md @@ -36,12 +36,18 @@ cli-v2 runtime create [runtime_name] [flags] --client-key string Path to a client key file for TLS --cluster string The name of the kubeconfig cluster to use --context string The name of the kubeconfig context to use + --git-src-git-token string Your git provider api token [GIT_SRC_GIT_TOKEN] + --git-src-host string The git provider address (for on-premise git providers) + --git-src-name string The name of the repository + --git-src-owner string The name of the owner or organization + --git-src-provider string The git provider, one of: github (default "github") + --git-src-public If true, will create the repository as public (default is false) -h, --help help for create --insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure --install-git-token string Your git provider api token [INSTALL_GIT_TOKEN] --install-host string The git provider address (for on-premise git providers) --install-name string The name of the repository - --install-owner string The name of the owner or organiaion + --install-owner string The name of the owner or organization --install-provider string The git provider, one of: github (default "github") --install-public If true, will create the repository as public (default is false) --kubeconfig string Path to the kubeconfig file to use for CLI requests. diff --git a/go.mod b/go.mod index ed5c7b753..14a718d83 100644 --- a/go.mod +++ b/go.mod @@ -4,9 +4,10 @@ go 1.16 require ( github.com/argoproj-labs/applicationset v0.1.0 - github.com/argoproj-labs/argocd-autopilot v0.2.4 + github.com/argoproj-labs/argocd-autopilot v0.2.7 github.com/argoproj/argo-cd/v2 v2.0.3 - github.com/argoproj/argo-events v0.17.1-0.20210527154554-3f05846796c2 + github.com/argoproj/argo-events v1.3.1 + github.com/argoproj/argo-workflows/v3 v3.1.0 github.com/briandowns/spinner v1.13.0 github.com/codefresh-io/go-sdk v0.26.2 github.com/fatih/color v1.12.0 @@ -19,13 +20,13 @@ require ( github.com/spf13/pflag v1.0.5 github.com/spf13/viper v1.7.1 github.com/stretchr/testify v1.7.0 - gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect k8s.io/api v0.21.1 k8s.io/apimachinery v0.21.1 ) replace ( github.com/argoproj-labs/applicationset => github.com/argoproj-labs/applicationset v0.0.0-20210614145856-2c62537a8e5a + github.com/argoproj/argo-events => github.com/argoproj/argo-events v0.17.1-0.20210615165534-d403c441bc1d k8s.io/api => k8s.io/api v0.21.1 k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.21.1 k8s.io/apimachinery => k8s.io/apimachinery v0.21.1 diff --git a/go.sum b/go.sum index 2e95ca174..4fba8aada 100644 --- a/go.sum +++ b/go.sum @@ -11,6 +11,7 @@ cloud.google.com/go v0.51.0/go.mod h1:hWtGJ6gnXH+KgDv+V0zFGDvpi07n3z8ZNj3T1RW0Gc cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= +cloud.google.com/go v0.55.0/go.mod h1:ZHmoY+/lIMNkN2+fBmuTiqZ4inFhvQad8ft7MT8IV5Y= cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= @@ -53,6 +54,7 @@ github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX github.com/Azure/go-autorest v14.2.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= github.com/Azure/go-autorest/autorest v0.9.0/go.mod h1:xyHB1BMZT0cuDHU7I0+g046+BFDTQ8rEZB0s4Yfa6bI= github.com/Azure/go-autorest/autorest v0.9.3/go.mod h1:GsRuLYvwzLjjjRoWEIyMUaYq8GNUx2nRB378IPt/1p0= +github.com/Azure/go-autorest/autorest v0.11.1/go.mod h1:JFgpikqFJ/MleTTxwepExTKnFUKKszPS8UavbQYUMuw= github.com/Azure/go-autorest/autorest v0.11.3/go.mod h1:JFgpikqFJ/MleTTxwepExTKnFUKKszPS8UavbQYUMuw= github.com/Azure/go-autorest/autorest v0.11.12/go.mod h1:eipySxLmqSyC5s5k1CLupqet0PSENBEDP93LQ9a8QYw= github.com/Azure/go-autorest/autorest v0.11.18/go.mod h1:dSiJPy22c3u0OtOKDNttNgqpNFY/GeWa7GH/Pz56QRA= @@ -98,6 +100,7 @@ github.com/Masterminds/goutils v1.1.0/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy86 github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww= github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs= +github.com/Masterminds/sprig v2.22.0+incompatible/go.mod h1:y6hNFY5UBTIWBxnzTeuNhlNS5hqE0NB0E6fgfo2Br3o= github.com/Masterminds/sprig/v3 v3.2.0/go.mod h1:tWhwTbUTndesPNeF0C900vKoq283u6zp4APT9vaF3SI= github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA= github.com/Microsoft/go-winio v0.4.15-0.20190919025122-fc70bd9a86b5/go.mod h1:tTuCMEN+UleMWgg9dVx4Hu52b1bJo+59jBh3ajtinzw= @@ -122,6 +125,7 @@ github.com/Shopify/sarama v1.26.1/go.mod h1:NbSGBSSndYaIhRcBtY9V0U7AyH+x71bG668A github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= github.com/TomOnTime/utfutil v0.0.0-20180511104225-09c41003ee1d h1:WtAMR0fPCOfK7TPGZ8ZpLLY18HRvL7XJ3xcs0wnREgo= github.com/TomOnTime/utfutil v0.0.0-20180511104225-09c41003ee1d/go.mod h1:WML6KOYjeU8N6YyusMjj2qRvaPNUEvrQvaxuFcMRFJY= +github.com/TwinProduction/go-color v0.0.3/go.mod h1:5hWpSyT+mmKPjCwPNEruBW5Dkbs/2PwOuU468ntEXNQ= github.com/UnnoTed/fileb0x v1.1.4/go.mod h1:X59xXT18tdNk/D6j+KZySratBsuKJauMtVuJ9cgOiZs= github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g= github.com/acomagu/bufpipe v1.0.3 h1:fxAGrHZTgQ9w5QqVItgzwj235/uYZYgbXitB+dLupOk= @@ -145,7 +149,9 @@ github.com/alicebob/miniredis v2.5.0+incompatible h1:yBHoLpsyjupjz3NL3MhKMVkR41j github.com/alicebob/miniredis v2.5.0+incompatible/go.mod h1:8HZjEj4yU0dwhYHky+DxYx+6BMjkBbe5ONFIF1MXffk= github.com/alicebob/miniredis/v2 v2.14.2 h1:VeoqKUAsJfT2af61nDE7qhBzqn3J6xjnt9MFAbdrEtg= github.com/alicebob/miniredis/v2 v2.14.2/go.mod h1:gquAfGbzn92jvtrSC69+6zZnwSODVXVpYDRaGhWaL6I= +github.com/aliyun/aliyun-oss-go-sdk v2.1.8+incompatible/go.mod h1:T/Aws4fEfogEE9v+HPhhw+CntffsBHJ8nXQCwKr0/g8= github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8= +github.com/andybalholm/brotli v1.0.1/go.mod h1:loMXtMfwqflxFJPmdbJO0a3KNoPuLBgiu3qAvBg8x/Y= github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239 h1:kFOfPq6dUM1hTo4JG6LR5AXSUEsOjtdm0kw0FtQtMJA= github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= @@ -158,20 +164,23 @@ github.com/ardielle/ardielle-go v1.5.2/go.mod h1:I4hy1n795cUhaVt/ojz83SNVCYIGsAF github.com/ardielle/ardielle-tools v1.5.4/go.mod h1:oZN+JRMnqGiIhrzkRN9l26Cej9dEx4jeNG6A+AdkShk= github.com/argoproj-labs/applicationset v0.0.0-20210614145856-2c62537a8e5a h1:8Nm2KtOu/G7NtoAgucj4TkX8rghzwgFJGXNrAmuz7gc= github.com/argoproj-labs/applicationset v0.0.0-20210614145856-2c62537a8e5a/go.mod h1:5rxggh8ymYXedQDIYylNzIHe6jdshDNasIBCVJuR1iU= -github.com/argoproj-labs/argocd-autopilot v0.2.4 h1:0cP+RxgRqP5jVlLYdJLNajAJIw7ww3zmqYKmLBbt7Cc= -github.com/argoproj-labs/argocd-autopilot v0.2.4/go.mod h1:mFkBpj09ofv0oe4K7LcN3Ds1pAXUEOLum/Lk8KUJXH0= +github.com/argoproj-labs/argocd-autopilot v0.2.7 h1:wUBNIMxqozl5heGSB2AO81Bu6gW90FV3DqvM98B1YOA= +github.com/argoproj-labs/argocd-autopilot v0.2.7/go.mod h1:mFkBpj09ofv0oe4K7LcN3Ds1pAXUEOLum/Lk8KUJXH0= github.com/argoproj/argo-cd v1.8.1/go.mod h1:Vfl7OGgBC83dVWgq58wU6UR3kG864h0dtHEIQ8xqw4s= github.com/argoproj/argo-cd v1.8.7 h1:CkIu8p/gcTY/fOZWM2tHuSCIAV2HggXjJftrT1IIT3k= github.com/argoproj/argo-cd v1.8.7/go.mod h1:tqFZW5Lr9KBCDsvOaE5Fh8M1eJ1ThvR58pyyLv8Zqvs= github.com/argoproj/argo-cd/v2 v2.0.3 h1:9KK9u5wegvBhUQIrK+dfsGiJglPNlzFGoUFM/5iHc9Q= github.com/argoproj/argo-cd/v2 v2.0.3/go.mod h1:eg4iTfTUICd6o6ZpbPElWGcHSHWOsgXIQM13+HzhIYE= -github.com/argoproj/argo-events v0.17.1-0.20210527154554-3f05846796c2 h1:RNkaNnrDaPJ44UNb5ewBHmiUKzZ0llVsoeUHr3xqK+8= -github.com/argoproj/argo-events v0.17.1-0.20210527154554-3f05846796c2/go.mod h1:wI5A0U3Wj9ZvfPn3ioL18Dz29+7aibtlyU9pS0Ry+bg= +github.com/argoproj/argo-events v0.17.1-0.20210615165534-d403c441bc1d h1:pHQHwk2PO3BShSCUwTgqBxIciPPzBkWAv/TuVYeWML0= +github.com/argoproj/argo-events v0.17.1-0.20210615165534-d403c441bc1d/go.mod h1:wI5A0U3Wj9ZvfPn3ioL18Dz29+7aibtlyU9pS0Ry+bg= +github.com/argoproj/argo-workflows/v3 v3.1.0 h1:YrTppFW7VYZsFnDB7/9A0nI3V+VVqozvq2ZE5UMbHa4= +github.com/argoproj/argo-workflows/v3 v3.1.0/go.mod h1:Z8Wc7uDOGw8TRdhqqREHLFE5SAgS0ENqqwaLakv56MU= github.com/argoproj/gitops-engine v0.2.1/go.mod h1:OxXp8YaT73rw9gEBnGBWg55af80nkV/uIjWCbJu1Nw0= github.com/argoproj/gitops-engine v0.2.2/go.mod h1:OxXp8YaT73rw9gEBnGBWg55af80nkV/uIjWCbJu1Nw0= github.com/argoproj/gitops-engine v0.3.2 h1:m5bjOk/bWwMsFBGFpurdK31/hC5UuLMQn0hAd51TlEk= github.com/argoproj/gitops-engine v0.3.2/go.mod h1:IBHhAkqlC+3r/wBWUitWSidQhPzlLoSTWp2htq3dyQk= github.com/argoproj/pkg v0.2.0/go.mod h1:F4TZgInLUEjzsWFB/BTJBsewoEy0ucnKSq6vmQiD/yc= +github.com/argoproj/pkg v0.8.1/go.mod h1:ra+bQPmbVAoEL+gYSKesuigt4m49i3Qa3mE/xQcjCiA= github.com/argoproj/pkg v0.9.0 h1:PfWWYykfcEQdN0g41XLbVh/aonTjD+dPkvDp3hwpLYM= github.com/argoproj/pkg v0.9.0/go.mod h1:ra+bQPmbVAoEL+gYSKesuigt4m49i3Qa3mE/xQcjCiA= github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= @@ -193,6 +202,7 @@ github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN github.com/aws/aws-sdk-go v1.33.16/go.mod h1:5zCpMtNQVjRREroY7sYe8lOMRSxkhG6MZveU8YkpAk0= github.com/aws/aws-sdk-go v1.35.24/go.mod h1:tlPOdRjfxPBpNIwqDj61rmsnA85v9jc0Ps9+muhnW+k= github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g= +github.com/baiyubin/aliyun-sts-go-sdk v0.0.0-20180326062324-cfa1a18b161f/go.mod h1:AuiFmCCPBSrqvVMvuqFuk0qogytodnVFVSN5CeJB8Gc= github.com/beefsack/go-rate v0.0.0-20180408011153-efa7637bb9b6/go.mod h1:6YNgTHLutezwnBvyneBbwvB8C82y3dcoOj5EQJIdGXA= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= @@ -249,6 +259,7 @@ github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE github.com/codefresh-io/go-sdk v0.26.2 h1:nGiLEOXaYGd7DbwKpqeTm1XXVCATayQm/pU3DwA6wqc= github.com/codefresh-io/go-sdk v0.26.2/go.mod h1:0m0ATMmbFzvrc3CwUTB10MGO6hydsZdzLeHCAOyAvyM= github.com/colinmarc/hdfs v1.1.4-0.20180802165501-48eb8d6c34a9/go.mod h1:0DumPviB681UcSuJErAbDIOx6SIaJWj463TymfZG02I= +github.com/colinmarc/hdfs v1.1.4-0.20180805212432-9746310a4d31/go.mod h1:vSBumefK4HA5uiRSwNP+3ofgrEoScpCS2MMWcWXEuQ4= github.com/container-storage-interface/spec v1.3.0/go.mod h1:6URME8mwIBbpVyZV93Ce5St17xBiQJQY67NDsuohiy4= github.com/containerd/cgroups v0.0.0-20200531161412-0dbf7f05ba59/go.mod h1:pA0z1pT8KYB3TCXK/ocprsh7MAkoW8bZVzPdih9snmM= github.com/containerd/console v0.0.0-20180822173158-c12b1e7919c1/go.mod h1:Tj/on1eG8kiEhd0+fhSDzsPAFESxzBBvdyEgyryXffw= @@ -315,6 +326,7 @@ github.com/docker/go-units v0.3.3/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDD github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/docker/spdystream v0.0.0-20181023171402-6480d4af844c/go.mod h1:Qh8CwZgvJUkLughtfhJv5dyTYa91l1fOUCrgjqmcifM= github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE= +github.com/doublerebel/bellows v0.0.0-20160303004610-f177d92a03d3/go.mod h1:v/MTKot4he5oRHGirOYGN4/hEOONNnWtDBLAzllSGMw= github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= @@ -328,8 +340,9 @@ github.com/elazarl/goproxy v0.0.0-20180725130230-947c36da3153 h1:yUdfgN0XgIJw7fo github.com/elazarl/goproxy v0.0.0-20180725130230-947c36da3153/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc= github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs= github.com/emicklei/go-restful v2.9.5+incompatible/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs= -github.com/emicklei/go-restful v2.12.0+incompatible h1:SIvoTSbsMEwuM3dzFirLwKc4BH6VXP5CNf+G1FfJVr4= github.com/emicklei/go-restful v2.12.0+incompatible/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs= +github.com/emicklei/go-restful v2.15.0+incompatible h1:8KpYO/Xl/ZudZs5RNOEhWMBY4hmzlZhhRd9cu+jrZP4= +github.com/emicklei/go-restful v2.15.0+incompatible/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs= github.com/emirpasic/gods v1.12.0 h1:QAUIPSaCu4G+POclxeqb3F+WPpdKqFGlw36+yOzGlrg= github.com/emirpasic/gods v1.12.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3ymbK86o= github.com/emitter-io/go/v2 v2.0.9/go.mod h1:St++epE1u/6ueCVw47xhu4shpkGNxKRVtkWv4Xi33mg= @@ -352,6 +365,7 @@ github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL github.com/fatih/color v1.12.0 h1:mRhaKNwANqRgUBGKmnI5ZxEk7QXmjQeCcuYFMX2bfcc= github.com/fatih/color v1.12.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM= github.com/fatih/structs v1.0.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= +github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= github.com/felixge/httpsnoop v1.0.1 h1:lvB5Jl89CsZtGIWuTcDM1E/vkVs49/Ml7JJe07l8SPQ= github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= @@ -458,6 +472,7 @@ github.com/go-openapi/spec v0.19.3/go.mod h1:FpwSN1ksY1eteniUU7X0N/BgJ7a4WvBFVA8 github.com/go-openapi/spec v0.19.5/go.mod h1:Hm2Jr4jv8G1ciIAo+frC/Ft+rR2kQDh8JHKHb3gWUSk= github.com/go-openapi/spec v0.19.6/go.mod h1:Hm2Jr4jv8G1ciIAo+frC/Ft+rR2kQDh8JHKHb3gWUSk= github.com/go-openapi/spec v0.19.8/go.mod h1:Hm2Jr4jv8G1ciIAo+frC/Ft+rR2kQDh8JHKHb3gWUSk= +github.com/go-openapi/spec v0.20.0/go.mod h1:+81FIL1JwC5P3/Iuuozq3pPE9dXdIEGxFutcFKaVbmU= github.com/go-openapi/spec v0.20.2 h1:pFPUZsiIbZ20kLUcuCGeuQWG735fPMxW7wHF9BWlnQU= github.com/go-openapi/spec v0.20.2/go.mod h1:RW6Xcbs6LOyWLU/mXGdzn2Qc+3aj+ASfI7rvSZh1Vls= github.com/go-openapi/strfmt v0.17.0/go.mod h1:P82hnJI0CXkErkXi8IKjPbNBM6lV6+5pLP5l494TcyU= @@ -474,6 +489,7 @@ github.com/go-openapi/swag v0.19.2/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= github.com/go-openapi/swag v0.19.7/go.mod h1:ao+8BpOPyKdpQz3AOJfbeEVpLmWAvlT1IfTe5McPyhY= github.com/go-openapi/swag v0.19.9/go.mod h1:ao+8BpOPyKdpQz3AOJfbeEVpLmWAvlT1IfTe5McPyhY= +github.com/go-openapi/swag v0.19.12/go.mod h1:eFdyEBkTdoAf/9RXBvj4cr1nH7GD8Kzo5HTt47gr72M= github.com/go-openapi/swag v0.19.13 h1:233UVgMy1DlmCYYfOiFpta6e2urloh+sEs5id6lyzog= github.com/go-openapi/swag v0.19.13/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= github.com/go-openapi/validate v0.18.0/go.mod h1:Uh4HdOzKt19xGIGm1qHf/ofbX1YQ4Y+MYsct2VUrAJ4= @@ -482,6 +498,7 @@ github.com/go-openapi/validate v0.19.3/go.mod h1:90Vh6jjkTn+OT1Eefm0ZixWNFjhtOH7 github.com/go-openapi/validate v0.19.8/go.mod h1:8DJv2CVJQ6kGNpFW6eV9N3JviE1C85nY1c2z52x1Gk4= github.com/go-openapi/validate v0.19.10/go.mod h1:RKEZTUWDkxKQxN2jDT7ZnZi2bhZlbNMAuKvKB+IaGx8= github.com/go-ozzo/ozzo-validation v3.5.0+incompatible/go.mod h1:gsEKFIVnabGBt6mXmxK0MoFy+cZoTJY6mu5Ll3LVLBU= +github.com/go-python/gpython v0.0.3/go.mod h1:bmk0l57W/7Cs67MMnz4U28SoYyvz5NTMYyJvUqytJhs= github.com/go-redis/cache/v8 v8.2.1 h1:G4CtEQDT3JsiERPob1nUL/KTkiC317rAJvHx6GdWjiM= github.com/go-redis/cache/v8 v8.2.1/go.mod h1:8PFGBZrRqG2nToSHw76mSsozxgSKrn3vsZerq/NJtt8= github.com/go-redis/redis v6.15.8+incompatible h1:BKZuG6mCnRj5AOaWJXoCgf6rqTYnYJLe4en2hxT7r9o= @@ -557,6 +574,7 @@ github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= github.com/golang/mock v1.4.4 h1:l75CXGRSwbaYNpl/Z2X1XIIAMSCquvXgpVZDhwEIJsc= github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= +github.com/golang/protobuf v1.1.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -627,10 +645,12 @@ github.com/googleapis/gnostic v0.4.1/go.mod h1:LRhVm6pbyptWbWbuZ38d1eyptfvIytN3i github.com/googleapis/gnostic v0.5.1 h1:A8Yhf6EtqTv9RMsU6MQTyrtV1TjWlR6xU9BsZIwuTCM= github.com/googleapis/gnostic v0.5.1/go.mod h1:6U4PtQXGIEt/Z3h5MAT7FNofLnw9vXk2cUuW7uA/OeU= github.com/gophercloud/gophercloud v0.1.0/go.mod h1:vxM41WHh5uqHVBMZHzuwNOHh8XEoIEcSTewFxm1c5g8= +github.com/gopherjs/gopherjs v0.0.0-20180825215210-0210a2f0f73c/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gopherjs/gopherjs v0.0.0-20181103185306-d547d1d9531e/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gopherjs/gopherjs v0.0.0-20200217142428-fce0ec30dd00 h1:l5lAOZEym3oK3SQ2HBHWsJUfbNBiTXJDeW2QDxw9AQ0= github.com/gopherjs/gopherjs v0.0.0-20200217142428-fce0ec30dd00/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/gopherjs/gopherwasm v1.0.0/go.mod h1:SkZ8z7CWBz5VXbhJel8TxCmAcsQqzgWGR/8nMhyhZSI= github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= github.com/gorilla/handlers v1.4.2/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ= github.com/gorilla/handlers v1.5.0/go.mod h1:t8XrUpc4KVXb7HGyJ4/cEnwQiaxrX/hz1Zv/4g96P1Q= @@ -646,8 +666,9 @@ github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:Fecb github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79 h1:+ngKgrYPPJrOjhax5N+uePQ0Fh1Z7PheYoUI/0nzkPA= github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= -github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4 h1:z53tR0945TRRQO/fLEVPI6SMv7ZflF0TEaTAoU7tOzg= github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= +github.com/grpc-ecosystem/go-grpc-middleware v1.1.0 h1:THDBEeQ9xZ8JEaCLyLQqXMMdRqNr0QAUJTIkQAUtFjg= +github.com/grpc-ecosystem/go-grpc-middleware v1.1.0/go.mod h1:f5nM7jw/oeRSadq3xCzHAvxcr8HZnzsqU6ILg/0NiiE= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= @@ -672,6 +693,7 @@ github.com/hashicorp/go-retryablehttp v0.6.4/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= +github.com/hashicorp/go-uuid v0.0.0-20180228145832-27454136f036/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= @@ -705,6 +727,7 @@ github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH github.com/imdario/mergo v0.3.12 h1:b6R2BslTbIEToALKP7LxUvijTsNI9TAe80pLWN2g/HU= github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= github.com/imkira/go-interpol v1.0.0/go.mod h1:z0h2/2T3XF8kyEPpRgJ3kmNv+C43p+I/CoI+jC3w2iA= +github.com/imkira/go-interpol v1.1.0/go.mod h1:z0h2/2T3XF8kyEPpRgJ3kmNv+C43p+I/CoI+jC3w2iA= github.com/improbable-eng/grpc-web v0.0.0-20181111100011-16092bd1d58a/go.mod h1:6hRR09jOEG81ADP5wCQju1z71g6OL4eEvELdran/3cs= github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= @@ -714,6 +737,7 @@ github.com/jawher/mow.cli v1.0.4/go.mod h1:5hQj2V8g+qYmLUVWqu4Wuja1pI57M83EChYLV github.com/jawher/mow.cli v1.1.0/go.mod h1:aNaQlc7ozF3vw6IJ2dHjp2ZFiA4ozMIYY6PyuRJwlUg= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo= +github.com/jcmturner/gofork v0.0.0-20180107083740-2aebee971930/go.mod h1:MK8+TM0La+2rjBD4jE12Kj1pCCxK7d2LK/UM3ncEo0o= github.com/jcmturner/gofork v1.0.0/go.mod h1:MK8+TM0La+2rjBD4jE12Kj1pCCxK7d2LK/UM3ncEo0o= github.com/jeremywohl/flatten v1.0.1/go.mod h1:4AmD/VxjWcI5SRB0n6szE2A6s2fsNHDLO0nAlMHgfLQ= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= @@ -766,11 +790,14 @@ github.com/klauspost/compress v1.8.2/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0 github.com/klauspost/compress v1.9.5/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= github.com/klauspost/compress v1.9.8/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= github.com/klauspost/compress v1.10.8/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= -github.com/klauspost/compress v1.11.1 h1:bPb7nMRdOZYDrpPMTA3EInUQrdgoBinqUuSwlGdKDdE= github.com/klauspost/compress v1.11.1/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= +github.com/klauspost/compress v1.11.8/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= +github.com/klauspost/compress v1.11.9 h1:5OCMOdde1TCT2sookEuVeEZzA8bmRSFV3AwPDZAG8AA= +github.com/klauspost/compress v1.11.9/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/klauspost/cpuid v1.2.0/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= github.com/klauspost/cpuid v1.2.1/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= github.com/klauspost/cpuid v1.2.3/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= +github.com/klauspost/pgzip v1.2.5/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= @@ -862,6 +889,7 @@ github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFW github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/go-ps v0.0.0-20190716172923-621e5597135b/go.mod h1:r1VsdOzOPt1ZSrGZWFoNhsAedKnEd6r9Np1+5blZCWk= github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= github.com/mitchellh/go-wordwrap v1.0.0 h1:6GlHJ/LTGMrIJbwgdqdl2eEH8o+Exx/0m8ir9Gns0u4= @@ -975,6 +1003,7 @@ github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FI github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/patrickmn/go-cache v2.1.0+incompatible h1:HRMgzkcYKYpi3C8ajMPV8OFXaaRUnok+kx1WdO15EQc= github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ= +github.com/pborman/getopt v0.0.0-20180729010549-6fdd0a2c7117/go.mod h1:85jBQOZwpVEaDAr341tbn15RS4fCAsIst0qp7i8ex1o= github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= github.com/pelletier/go-buffruneio v0.2.0/go.mod h1:JkE26KsDizTr40EUHkXVtNPvgGtbSNq5BcowyYOWdKo= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= @@ -984,6 +1013,7 @@ github.com/pelletier/go-toml v1.8.0/go.mod h1:D6yutnOGMveHEPV7VQOuvI/gXY61bv+9bA github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac= github.com/peterbourgon/diskv v2.0.1+incompatible h1:UBdAOUP5p4RWqPBg048CAvpKN+vxiaj6gdUUzhl4XmI= github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU= +github.com/peterh/liner v1.1.0/go.mod h1:CRroGNssyjTd/qIG2FyxByd2S8JEAZXBl4qUrZf8GS0= github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc= github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pierrec/lz4 v2.4.1+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= @@ -1050,6 +1080,7 @@ github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJ github.com/robfig/cron v1.1.0/go.mod h1:JGuDeoQd7Z6yL4zQhZ3OPEVHB7fL6Ka6skscFHfmt2k= github.com/robfig/cron v1.2.0 h1:ZjScXvvxeQ63Dbyxy76Fj3AT3Ut0aKsyd2/tl3DTMuQ= github.com/robfig/cron v1.2.0/go.mod h1:JGuDeoQd7Z6yL4zQhZ3OPEVHB7fL6Ka6skscFHfmt2k= +github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= @@ -1084,8 +1115,9 @@ github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrf github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE= github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= -github.com/skratchdot/open-golang v0.0.0-20160302144031-75fb7ed4208c h1:fyKiXKO1/I/B6Y2U8T7WdQGWzwehOuGIrljPtt7YTTI= github.com/skratchdot/open-golang v0.0.0-20160302144031-75fb7ed4208c/go.mod h1:sUM3LWHvSMaG192sy56D9F7CNvL7jUJVXoqM1QKLnog= +github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966 h1:JIAuq3EEf9cgbU6AtGPK4CTG3Zf6CKMNqf0MHTggAUA= +github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966/go.mod h1:sUM3LWHvSMaG192sy56D9F7CNvL7jUJVXoqM1QKLnog= github.com/slack-go/slack v0.7.4/go.mod h1:FGqNzJBmxIsZURAxh2a8D21AnOVvvXZvGligs4npPUM= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/assertions v0.0.0-20190116191733-b6c0e53d7304/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= @@ -1154,11 +1186,13 @@ github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69 github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= github.com/thecodeteam/goscaleio v0.1.0/go.mod h1:68sdkZAsK8bvEwBlbQnlLS+xU+hvLYM/iQ8KXej1AwM= github.com/tidwall/gjson v1.6.0/go.mod h1:P256ACg0Mn+j1RXIDXoss50DeIABTYK1PULOJHhxOls= +github.com/tidwall/gjson v1.6.8/go.mod h1:zeFuBCIqD4sN/gmqBzZ4j7Jd6UcA2Fc56x7QFsv+8fI= github.com/tidwall/gjson v1.7.5/go.mod h1:5/xDoumyyDNerp2U36lyolv46b3uF/9Bu6OfyQ9GImk= github.com/tidwall/match v1.0.1/go.mod h1:LujAq0jyVjBy028G1WhWfIzbpQfMO8bBZ6Tyb0+pL9E= github.com/tidwall/match v1.0.3/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= github.com/tidwall/pretty v1.0.1/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= +github.com/tidwall/pretty v1.0.2/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= github.com/tidwall/pretty v1.1.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= github.com/tidwall/sjson v1.1.1/go.mod h1:yvVuSnpEQv5cYIrO+AT6kw4QVfd5SDZoGIS7/5+fZFs= github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= @@ -1174,7 +1208,9 @@ github.com/urfave/cli v1.22.2/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtX github.com/urfave/negroni v1.0.0/go.mod h1:Meg73S6kFm/4PpbYdq35yYWoCZ9mS/YSx+lKnmiohz4= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= github.com/valyala/fasthttp v1.9.0/go.mod h1:FstJa9V+Pj9vQ7OJie2qMHdwemEDaDiSdBnvPM1Su9w= +github.com/valyala/fasthttp v1.22.0/go.mod h1:0mw2RjXGOzxf4NL2jni3gUQ7LfjjUSiG5sskOUUSEpU= github.com/valyala/fasttemplate v0.0.0-20170224212429-dcecefd839c4/go.mod h1:50wTf68f99/Zt14pr046Tgt3Lp2vLyFZKzbFXTOabXw= +github.com/valyala/fasttemplate v1.1.0/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8= github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= github.com/valyala/gozstd v1.7.0/go.mod h1:y5Ew47GLlP37EkTB+B4s7r6A5rdaeB7ftbl9zoYiIPQ= github.com/valyala/tcplisten v0.0.0-20161114210144-ceec8f93295a/go.mod h1:v3UYOV9WzVtRmSR+PDvWpU/qWl4Wa5LApYYX4ZtKbio= @@ -1201,8 +1237,10 @@ github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c/go.mod h1:lB8K/P019DLNhe github.com/xdg/stringprep v0.0.0-20180714160509-73f8eece6fdc/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y= github.com/xdg/stringprep v1.0.0/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y= github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= +github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= github.com/xeipuuv/gojsonschema v1.1.0/go.mod h1:5yf86TLmAcydyeJq5YvxkGPE2fm/u4myDekKRoLuqhs= +github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xlab/treeprint v0.0.0-20181112141820-a009c3971eca h1:1CFlNzQhALwjS9mBAUkycX616GzgsuYUOCHA5+HSlXI= github.com/xlab/treeprint v0.0.0-20181112141820-a009c3971eca/go.mod h1:ce1O1j6UtZfjr22oyGxGLbauSBp2YVXpARAosm7dHBg= @@ -1254,6 +1292,7 @@ go.uber.org/zap v1.8.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= go.uber.org/zap v1.15.0/go.mod h1:Mb2vm2krFEG5DV0W9qcHBYFtp/Wku1cvYaqPsS/WYfc= +golang.org/x/crypto v0.0.0-20180723164146-c126467f60eb/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20180910181607-0e37d006457b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= @@ -1332,6 +1371,7 @@ golang.org/x/mod v0.1.1-0.20191209134235-331c550502dd/go.mod h1:s0Qsj1ACt9ePp/hM golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.1-0.20200828183125-ce943fd02449/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1386,6 +1426,7 @@ golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwY golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210224082022-3d97a244fca7/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210226101413-39120d07d75e/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210326060303-6b1517762897 h1:KrsHThm5nFk34YtATK1LsThyGhGbGe1olrte/HInHvs= golang.org/x/net v0.0.0-20210326060303-6b1517762897/go.mod h1:uSPa2vr4CLtc/ILN5odXGNXS6mhrKVzTaCXzk9m6W3k= @@ -1470,6 +1511,7 @@ golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200217220822-9197077df867/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200317113312-5766fd39f98d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1569,6 +1611,7 @@ golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapK golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200317043434-63da46f3035e/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200505023115-26f46d2f7ef8/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= @@ -1646,6 +1689,7 @@ google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfG google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200317114155-1f3552e48f24/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= @@ -1655,6 +1699,7 @@ google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEY google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200806141610-86f49bd18e98/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201110150050-8816d57aaa9a h1:pOwg4OoaRYScjmR4LlLgdtnyoHYTSAVhhqe5uPdpII8= google.golang.org/genproto v0.0.0-20201110150050-8816d57aaa9a/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= @@ -1677,6 +1722,7 @@ google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.33.1 h1:DGeFlSan2f+WEtCERJ4J9GJWk15TxUi8QGagfI87Xyc= google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= +google.golang.org/grpc/examples v0.0.0-20201226181154-53788aa5dcb4/go.mod h1:Ly7ZA/ARzg8fnPU9TyZIxoz33sEUuWX7txiqs8lPTgE= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -1702,6 +1748,7 @@ gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMy gopkg.in/gcfg.v1 v1.2.0/go.mod h1:yesOnuUOFQAhST5vPY4nbZsb/huCgGGXlipJsBn0b3o= gopkg.in/gcfg.v1 v1.2.3/go.mod h1:yesOnuUOFQAhST5vPY4nbZsb/huCgGGXlipJsBn0b3o= gopkg.in/go-playground/webhooks.v5 v5.11.0/go.mod h1:LZbya/qLVdbqDR1aKrGuWV6qbia2zCYSR5dpom2SInQ= +gopkg.in/go-playground/webhooks.v5 v5.15.0/go.mod h1:LZbya/qLVdbqDR1aKrGuWV6qbia2zCYSR5dpom2SInQ= gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= gopkg.in/ini.v1 v1.41.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= @@ -1717,6 +1764,7 @@ gopkg.in/jcmturner/gokrb5.v7 v7.5.0/go.mod h1:l8VISx+WGYp+Fp7KRbsiUuXTTOnxIc3Tuv gopkg.in/jcmturner/rpc.v0 v0.0.2/go.mod h1:NzMq6cRzR9lipgw7WxRBHNx5N8SifBuaCQsOT1kWY/E= gopkg.in/jcmturner/rpc.v1 v1.1.0/go.mod h1:YIdkC4XfD6GXbzje11McwsDuOlZQSb9W4vfLvuNnlv8= gopkg.in/mcuadros/go-syslog.v2 v2.2.1/go.mod h1:l5LPIyOOyIdQquNg+oU6Z3524YwrcqEm0aKH+5zpt2U= +gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA= gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= gopkg.in/square/go-jose.v2 v2.2.2/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= @@ -1855,3 +1903,4 @@ sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= sigs.k8s.io/yaml v1.2.0 h1:kr/MCeFWJWTwyaHoR9c8EjH9OumOmoF9YGiZd7lFm/Q= sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc= sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU= +upper.io/db.v3 v3.6.3+incompatible/go.mod h1:FgTdD24eBjJAbPKsQSiHUNgXjOR4Lub3u1UMHSIh82Y= diff --git a/manifests/argo-events/eventbus.yaml b/manifests/argo-events/eventbus.yaml index 283562b0d..7d843a716 100644 --- a/manifests/argo-events/eventbus.yaml +++ b/manifests/argo-events/eventbus.yaml @@ -2,6 +2,8 @@ apiVersion: argoproj.io/v1alpha1 kind: EventBus metadata: name: codefresh-eventbus + annotations: + argocd.argoproj.io/sync-wave: "2" spec: nats: native: diff --git a/manifests/argo-workflows/kustomization.yaml b/manifests/argo-workflows/kustomization.yaml index 327e5f378..95babb86e 100644 --- a/manifests/argo-workflows/kustomization.yaml +++ b/manifests/argo-workflows/kustomization.yaml @@ -1,4 +1,4 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: - - https://raw.githubusercontent.com/argoproj/argo-workflows/v3.0.7/manifests/install.yaml + - https://raw.githubusercontent.com/argoproj/argo-workflows/v3.1.0/manifests/install.yaml diff --git a/pkg/cdUtils/cdUtils.go b/pkg/cdUtils/cdUtils.go new file mode 100644 index 000000000..5b6b68258 --- /dev/null +++ b/pkg/cdUtils/cdUtils.go @@ -0,0 +1,99 @@ +// Copyright 2021 The Codefresh Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package cdUtils + +import ( + "fmt" + + "github.com/codefresh-io/cli-v2/pkg/store" + + apstore "github.com/argoproj-labs/argocd-autopilot/pkg/store" + cdv1alpha1 "github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +type ( + CreateAppOptions struct { + Name string + Namespace string + Project string + SyncWave int + RepoURL string + Revision string + SrcPath string + DestServer string + NoFinalizer bool + } +) + +func CreateApp(opts *CreateAppOptions) *cdv1alpha1.Application { + if opts.DestServer == "" { + opts.DestServer = apstore.Default.DestServer + } + + app := &cdv1alpha1.Application{ + TypeMeta: metav1.TypeMeta{ + Kind: cdv1alpha1.ApplicationSchemaGroupVersionKind.Kind, + APIVersion: cdv1alpha1.ApplicationSchemaGroupVersionKind.GroupVersion().String(), + }, + ObjectMeta: metav1.ObjectMeta{ + Namespace: opts.Namespace, + Name: opts.Name, + Annotations: map[string]string{ + "argocd.argoproj.io/sync-wave": fmt.Sprintf("%d", opts.SyncWave), + }, + Labels: map[string]string{ + "app.kubernetes.io/managed-by": store.Get().BinaryName, + "app.kubernetes.io/name": opts.Name, + }, + Finalizers: []string{ + "resources-finalizer.argocd.argoproj.io", + }, + }, + Spec: cdv1alpha1.ApplicationSpec{ + Project: opts.Project, + Source: cdv1alpha1.ApplicationSource{ + RepoURL: opts.RepoURL, + Path: opts.SrcPath, + TargetRevision: opts.Revision, + }, + Destination: cdv1alpha1.ApplicationDestination{ + Server: opts.DestServer, + Namespace: opts.Namespace, + }, + SyncPolicy: &cdv1alpha1.SyncPolicy{ + Automated: &cdv1alpha1.SyncPolicyAutomated{ + SelfHeal: true, + Prune: true, + AllowEmpty: true, + }, + }, + IgnoreDifferences: []cdv1alpha1.ResourceIgnoreDifferences{ + { + Group: cdv1alpha1.ApplicationSchemaGroupVersionKind.Group, + Kind: cdv1alpha1.ApplicationSchemaGroupVersionKind.Kind, + JSONPointers: []string{ + "/status", + }, + }, + }, + }, + } + if opts.NoFinalizer { + app.ObjectMeta.Finalizers = []string{} + } + + return app +} diff --git a/pkg/eventUtils/eventUtils.go b/pkg/eventUtils/eventUtils.go new file mode 100644 index 000000000..4368200b9 --- /dev/null +++ b/pkg/eventUtils/eventUtils.go @@ -0,0 +1,223 @@ +// Copyright 2021 The Codefresh Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package eventUtils + +import ( + "github.com/codefresh-io/cli-v2/pkg/store" + + apicommon "github.com/argoproj/argo-events/pkg/apis/common" + eventsourcereg "github.com/argoproj/argo-events/pkg/apis/eventsource" + eventsourcev1alpha1 "github.com/argoproj/argo-events/pkg/apis/eventsource/v1alpha1" + sensorreg "github.com/argoproj/argo-events/pkg/apis/sensor" + sensorsv1alpha1 "github.com/argoproj/argo-events/pkg/apis/sensor/v1alpha1" + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/util/intstr" +) + +type ( + CreateEventDependencyOptions struct { + Name string + EventSourceName string + EventName string + } + + CreateEventSourceOptions struct { + Name string + Namespace string + ServiceAccountName string + EventBusName string + Resource map[string]CreateResourceEventSourceOptions + } + + CreateResourceEventSourceOptions struct { + Group string + Version string + Resource string + Namespace string + Selectors []CreateSelectorOptions + } + + CreateSelectorOptions struct { + Key string + Operation string + Value string + } + + CreateSensorOptions struct { + Name string + Namespace string + EventSourceName string + EventBusName string + TriggerURL string + Triggers []string + } + + CreateTriggerOptions struct { + Conditions string + URL string + DependencyName string + } +) + +func CreateEventDependency(opts *CreateEventDependencyOptions) *sensorsv1alpha1.EventDependency { + return &sensorsv1alpha1.EventDependency{ + Name: opts.Name, + EventSourceName: opts.EventSourceName, + EventName: opts.EventName, + } +} + +func CreateEventSource(opts *CreateEventSourceOptions) *eventsourcev1alpha1.EventSource { + resource := make(map[string]eventsourcev1alpha1.ResourceEventSource) + for key, res := range opts.Resource { + resource[key] = *CreateResourceEventSource(&res) + } + + return &eventsourcev1alpha1.EventSource{ + TypeMeta: metav1.TypeMeta{ + Kind: eventsourcereg.Kind, + APIVersion: eventsourcereg.Group + "/v1alpha1", + }, + ObjectMeta: metav1.ObjectMeta{ + Name: opts.Name, + Namespace: opts.Namespace, + }, + Spec: eventsourcev1alpha1.EventSourceSpec{ + Template: &eventsourcev1alpha1.Template{ + ServiceAccountName: opts.ServiceAccountName, + }, + Service: &eventsourcev1alpha1.Service{ + Ports: []v1.ServicePort{ + { + Port: int32(12000), + TargetPort: intstr.FromInt(12000), + }, + }, + }, + EventBusName: opts.EventBusName, + Resource: resource, + }, + } +} + +func CreateResourceEventSource(opts *CreateResourceEventSourceOptions) *eventsourcev1alpha1.ResourceEventSource { + selectors := make([]eventsourcev1alpha1.Selector, len(opts.Selectors)) + for i, selector := range opts.Selectors { + selectors[i] = *CreateSelector(&selector) + } + + return &eventsourcev1alpha1.ResourceEventSource{ + EventTypes: []eventsourcev1alpha1.ResourceEventType{ + eventsourcev1alpha1.ADD, + eventsourcev1alpha1.UPDATE, + eventsourcev1alpha1.DELETE, + }, + GroupVersionResource: metav1.GroupVersionResource{ + Group: opts.Group, //"argoproj.io", + Version: opts.Version, //"v1alpha1", + Resource: opts.Resource, + }, + Namespace: opts.Namespace, + Filter: &eventsourcev1alpha1.ResourceFilter{ + Labels: selectors, + }, + } +} + +func CreateSelector(opts *CreateSelectorOptions) *eventsourcev1alpha1.Selector { + return &eventsourcev1alpha1.Selector{ + Key: opts.Key, + Operation: opts.Operation, + Value: opts.Value, + } +} + +func CreateSensor(opts *CreateSensorOptions) *sensorsv1alpha1.Sensor { + dependencies := make([]sensorsv1alpha1.EventDependency, len(opts.Triggers)) + triggers := make([]sensorsv1alpha1.Trigger, len(opts.Triggers)) + for i, trigger := range opts.Triggers { + dependencies[i] = *CreateEventDependency(&CreateEventDependencyOptions{ + Name: trigger, + EventSourceName: opts.EventSourceName, + EventName: trigger, + }) + triggers[i] = *CreateTrigger(&CreateTriggerOptions{ + Conditions: trigger, + URL: opts.TriggerURL, + DependencyName: trigger, + }) + } + + return &sensorsv1alpha1.Sensor{ + TypeMeta: metav1.TypeMeta{ + Kind: sensorreg.Kind, + APIVersion: sensorreg.Group + "/v1alpha1", + }, + ObjectMeta: metav1.ObjectMeta{ + Name: opts.Name, + Namespace: opts.Namespace, + }, + Spec: sensorsv1alpha1.SensorSpec{ + EventBusName: opts.EventBusName, + Dependencies: dependencies, + Triggers: triggers, + }, + } +} + +func CreateTrigger(opts *CreateTriggerOptions) *sensorsv1alpha1.Trigger { + return &sensorsv1alpha1.Trigger{ + Template: &sensorsv1alpha1.TriggerTemplate{ + Conditions: opts.Conditions, + Name: "http-trigger", + HTTP: &sensorsv1alpha1.HTTPTrigger{ + URL: opts.URL, + Method: "POST", + Headers: map[string]string{ + "Content-Type": "application/json", + }, + SecureHeaders: []*apicommon.SecureHeader{ + { + Name: "Authorization", + ValueFrom: &apicommon.ValueFromSource{ + SecretKeyRef: &v1.SecretKeySelector{ + LocalObjectReference: v1.LocalObjectReference{ + Name: store.Get().CFTokenSecret, + }, + Key: store.Get().CFTokenSecretKey, + }, + }, + }, + }, + Payload: []sensorsv1alpha1.TriggerParameter{ + { + Src: &sensorsv1alpha1.TriggerParameterSource{ + DependencyName: opts.DependencyName, + DataKey: "body", + }, + Dest: "data", + }, + }, + }, + }, + RetryStrategy: &apicommon.Backoff{ + Steps: 3, + Duration: &apicommon.Int64OrString{ + StrVal: "3s", + }, + }, + } +} diff --git a/pkg/store/store.go b/pkg/store/store.go index b2051c031..231698670 100644 --- a/pkg/store/store.go +++ b/pkg/store/store.go @@ -42,22 +42,23 @@ type Version struct { } type Store struct { - BinaryName string - DefaultAPI string - Version Version ArgoCDManifestsURL string ArgoEventsManifestsURL string ArgoRolloutsManifestsURL string ArgoWorkflowsManifestsURL string + BinaryName string + CFComponentType string + CFRuntimeType string CFTokenSecret string CFTokenSecretKey string - CFType string - EventReportingEndpoint string - EventBusName string + CFType string ComponentsReporterName string ComponentsReporterSA string - CFComponentType string - CFRuntimeType string + DefaultAPI string + EventBusName string + EventReportingEndpoint string + GitSourceName string + Version Version } // Get returns the global store @@ -66,21 +67,22 @@ func Get() *Store { } func init() { - s.BinaryName = binaryName - s.DefaultAPI = "https://g.codefresh.io" s.ArgoCDManifestsURL = ArgoCDManifestsURL s.ArgoEventsManifestsURL = ArgoEventsManifestsURL s.ArgoRolloutsManifestsURL = ArgoRolloutsManifestsURL s.ArgoWorkflowsManifestsURL = ArgoWorkflowsManifestsURL + s.BinaryName = binaryName + s.CFComponentType = "component" + s.CFRuntimeType = "runtime" s.CFTokenSecret = "codefresh-token" s.CFTokenSecretKey = "token" s.CFType = "codefresh.io/type" - s.EventReportingEndpoint = "/argo/api/events" - s.EventBusName = "codefresh-eventbus" s.ComponentsReporterName = "components-reporter" s.ComponentsReporterSA = "components-reporter-sa" - s.CFComponentType = "component" - s.CFRuntimeType = "runtime" + s.DefaultAPI = "https://g.codefresh.io" + s.EventBusName = "codefresh-eventbus" + s.EventReportingEndpoint = "/argo/api/events" + s.GitSourceName = "default-git-source" initVersion() }