Skip to content

Commit

Permalink
feat: embed tkn tasks in func binary (knative#2396)
Browse files Browse the repository at this point in the history
* feat: embed tkn tasks in func binary

Embed Tekton tasks for direct on cluster build.

Signed-off-by: Matej Vašek <[email protected]>

* feat: embed tkn tasks in func binary

Embed Tekton tasks for PaC build.

Signed-off-by: Matej Vašek <[email protected]>

* feat: added tkn-tasks sub-command

This new command prints tektons tasks in form of multi-document yaml,
these tekton tasks may requird to be installed for some advanced
functionality.

Signed-off-by: Matej Vašek <[email protected]>

* chore: remove unused files

Signed-off-by: Matej Vašek <[email protected]>

* feat: make deployer image settable via linker

Signed-off-by: Matej Vašek <[email protected]>

---------

Signed-off-by: Matej Vašek <[email protected]>
  • Loading branch information
matejvasek authored Jun 26, 2024
1 parent 3ef5608 commit 3e8dc4d
Show file tree
Hide file tree
Showing 9 changed files with 255 additions and 236 deletions.
7 changes: 0 additions & 7 deletions cmd/environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import (
"knative.dev/func/pkg/config"
"knative.dev/func/pkg/functions"
"knative.dev/func/pkg/k8s"
"knative.dev/func/pkg/pipelines/tekton"
)

var format string = "json"
Expand Down Expand Up @@ -67,7 +66,6 @@ type Environment struct {
Templates map[string][]string
Environment []string
Cluster string
TektonTasks map[string]string
Defaults config.Global
Function *functions.Function `json:",omitempty" yaml:",omitempty"`
Instance *functions.Instance `json:",omitempty" yaml:",omitempty"`
Expand Down Expand Up @@ -137,11 +135,6 @@ func runEnvironment(cmd *cobra.Command, newClient ClientFactory, v *Version) (er
Environment: envs,
Cluster: host,
Defaults: defaults,
TektonTasks: map[string]string{
"func-buildpack": tekton.BuildpackTaskURL,
"func-s2i": tekton.S2ITaskURL,
"func-deploy": tekton.DeployTaskURL,
},
}

function, instance := describeFuncInformation(cmd.Context(), newClient, cfg)
Expand Down
1 change: 1 addition & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ Learn more about Knative at: https://knative.dev`, cfg.Name),
Commands: []*cobra.Command{
NewCompletionCmd(),
NewVersionCmd(cfg.Version),
NewTektonClusterTasksCmd(),
},
},
}
Expand Down
27 changes: 27 additions & 0 deletions cmd/tkn_tasks.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package cmd

import (
"fmt"

"github.com/spf13/cobra"

"knative.dev/func/pkg/pipelines/tekton"
)

func NewTektonClusterTasksCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "tkn-tasks",
Short: "List tekton cluster tasks as multi-document yaml",
Long: `This command prints tekton tekton task embed in the func binary.
Some advanced functionality like OpenShift's Web Console build my require installation of these tasks.
Installation: func tkn-tasks | kubectl apply -f -
`,
Hidden: true,
RunE: func(cmd *cobra.Command, args []string) error {
_, err := fmt.Fprintln(cmd.OutOrStdout(), tekton.GetClusterTasks())
return err
},
}

return cmd
}
3 changes: 3 additions & 0 deletions docs/generator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ func ignoreConfigEnv() (done func()) {
// string to the file name, and recursively calls itself for each subcommand.
func processSubCommands(c *cobra.Command, parent string, opts TemplateOptions) error {
for _, cc := range c.Commands() {
if cc.Hidden {
continue
}
name := cc.Name()
if name == "help" {
continue
Expand Down

This file was deleted.

136 changes: 0 additions & 136 deletions pkg/pipelines/resources/tekton/task/func-s2i/0.1/func-s2i.yaml

This file was deleted.

Loading

0 comments on commit 3e8dc4d

Please sign in to comment.