Skip to content

Commit

Permalink
Update clusterserviceversion template on bump components
Browse files Browse the repository at this point in the history
The file
`openshift-pipelines-operator-rh.clusterserviceversion.template.yaml`
may contain some reference to component versions. In order to keep
them update, let's use the content of `components.yaml` to populate
it.

To do this, we use a `.tmpl` file and golang `text/template` facilities.

Signed-off-by: Vincent Demeester <vdemeest@redhat.com>
  • Loading branch information
vdemeester committed Mar 25, 2024
1 parent d78370a commit f04b33e
Show file tree
Hide file tree
Showing 5 changed files with 831 additions and 3 deletions.
44 changes: 42 additions & 2 deletions cmd/tool/commands/bump.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,23 @@ package commands

import (
"fmt"
"os"
"path/filepath"
"sort"
"strings"
"text/template"

"github.com/openshift-pipelines/pipelines-as-code/pkg/cli"
"github.com/spf13/cobra"
)

var bugfix bool
var (
bugfix bool
clusterserviceversionTemplates = []string{
"operatorhub/kubernetes/manifests/bases/tektoncd-operator.clusterserviceversion.template.yaml.tmpl",
"operatorhub/openshift/manifests/bases/openshift-pipelines-operator-rh.clusterserviceversion.template.yaml.tmpl",
}
)

func BumpCommand(ioStreams *cli.IOStreams) *cobra.Command {
cmd := &cobra.Command{
Expand Down Expand Up @@ -42,7 +52,10 @@ func bump(filename string, bugfix bool) error {
}
newComponents[name] = newComponent
}
return writeComponents(filename, newComponents)
if err := writeComponents(filename, newComponents); err != nil {
return err
}
return updateClusterserviceversionTemplates(newComponents, clusterserviceversionTemplates)
}

func bumpComponent(name string, c component, bugfix bool) (component, error) {
Expand All @@ -61,3 +74,30 @@ func bumpComponent(name string, c component, bugfix bool) (component, error) {
Version: newVersion,
}, nil
}

func updateClusterserviceversionTemplates(newComponents map[string]component, csvts []string) error {
for _, csvt := range csvts {
tmpl, err := template.ParseFiles(csvt)
if err != nil {
return err
}
template := strings.TrimSuffix(csvt, filepath.Ext(csvt))
f, err := os.Create(template)
if err != nil {
return err
}
defer f.Close()
header := fmt.Sprintf("# THIS FILE IS AUTOGENERATED ! Please update %s instead.\n", filepath.Base(csvt))
if _, err := f.WriteString(header); err != nil {
return err
}
if err := tmpl.Execute(f, mytemplate{Versions: newComponents}); err != nil {
return err
}
}
return nil
}

type mytemplate struct {
Versions map[string]component
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# THIS FILE IS AUTOGENERATED ! Please update tektoncd-operator.clusterserviceversion.template.yaml.tmpl instead.
apiVersion: operators.coreos.com/v1alpha1
kind: ClusterServiceVersion
metadata:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,249 @@
apiVersion: operators.coreos.com/v1alpha1
kind: ClusterServiceVersion
metadata:
annotations:
alm-examples: '[]'
capabilities: Basic Install
categories: Developer Tools, Integration & Delivery
certified: "false"
description: Tekton Pipelines is a Kubernetes-Native CI/CD solution for building CI/CD pipelines.
operators.operatorframework.io/builder: operator-sdk-v1.7.2
repository: https://github.com/tektoncd/operator
support: The Tetkon Authors
name: tektoncd-operator.v0.0.0-0
namespace: placeholder
spec:
apiservicedefinitions: {}
customresourcedefinitions:
owned:
- description: |
TektonConfig installs Tekton Pipelines, Tekton Triggers and Tekton Dashboard on a cluster. The operator installs
the 3 components on a cluster if an instance of this CRD is created on your cluster with name `config`.
At present, the operator honors only one CustomResource instance with the name `config` to ensure only one set
of the three components (Pipelines, Triggers, Dashboard) exists on a cluster. An instance of this CRD will automatically
create instances of the other CRDs (TektonPipeline, TektonDashboard and TektonTriggers).
displayName: TektonConfig
kind: TektonConfig
name: tektonconfigs.operator.tekton.dev
version: v1alpha1
- description: |
TektonDashboard installs Tekton Dashboard on a cluster. The operator installs Tekton Dashboard on a cluster
if an instance of this CRD is created on your cluster with name `dashboard`. At present, the operator honors only
one CustomResource instance with the name `dashboard` to ensure only one set of Tekton Dashboard exists on a cluster.
displayName: TektonDashboard
kind: TektonDashboard
name: tektondashboards.operator.tekton.dev
version: v1alpha1
- description: |
TektonPipeline installs Tekton Pipelines on a cluster. The operator installs Tekton Pipelines on a cluster
if an instance of this CRD is created on your cluster with name `pipeline`. At present, the operator honors only
one CustomResource instance with the name `pipeline` to ensure only one set of Tekton Pipeline exists on a cluster.
displayName: TektonPipeline
kind: TektonPipeline
name: tektonpipelines.operator.tekton.dev
version: v1alpha1
- description: |
TektonTrigger installs Tekton Triggers on a cluster. The operator installs Tekton Triggers on a cluster
if an instance of this CRD is created on your cluster with name `trigger`. At present, the operator honors only
one CustomResource instance with the name `trigger` to ensure only one set of Tekton Triggers exists on a cluster.
displayName: TektonTriggers
kind: TektonTrigger
name: tektontriggers.operator.tekton.dev
version: v1alpha1
- description: |
TektonHub installs Tekton Hub on a cluster. The operator installs Tekton Hub on a cluster
if an instance of this CRD is created on your cluster with name `hub`. At present, the operator honors only
one CustomResource instance with the name `hub` to ensure only one set of Tekton Hub exists on a cluster.
displayName: TektonHubs
kind: TektonHub
name: tektonhubs.operator.tekton.dev
version: v1alpha1
- description: |
TektonInstallerSet internal CRD used by other component reconcilers to create kubernetes resources from their
release manifests
displayName: TektonInstallerSets
kind: TektonInstallerSet
name: tektoninstallersets.operator.tekton.dev
version: v1alpha1
- description: |
TektonResult installs Tekton Results on a cluster. The operator installs Tekton Results on a cluster
if an instance of this CRD is created on your cluster with name `result`. At present, the operator honors only
one CustomResource instance with the name `result` to ensure only one set of Tekton Results exists on a cluster.
displayName: TektonResults
kind: TektonResult
name: tektonresults.operator.tekton.dev
version: v1alpha1
- description: |
TektonChain installs Tekton Chain on a cluster. The operator installs Tekton Chain on a cluster
if an instance of this CRD is created on your cluster with name `chain`. At present, the operator honors only
one CustomResource instance with the name `chain` to ensure only one set of Tekton Chain exists on a cluster.
displayName: TektonChain
kind: TektonChain
name: tektonchains.operator.tekton.dev
version: v1alpha1
description: |
Tekton is a powerful and flexible open-source framework for creating CI/CD systems, allowing developers to build,
test, and deploy across cloud providers and on-premise systems.

Read more: https://tekton.dev/docs/

Tekconcd Operator makes is easy to install and maintain Tekton Pipelines, Tekton Dashboard and Tekton Triggers on
you cluster.

Note: This operator creates an intance of this on install (with name: cluster). So additional steps

## Tekton Pipeline

The Tekton Pipelines project provides k8s-style resources for declaring CI/CD-style pipelines.

Tekton Pipelines are Cloud Native:

Run on Kubernetes
Have Kubernetes clusters as a first class type
Use containers as their building blocks
Tekton Pipelines are Decoupled:

One Pipeline can be used to deploy to any k8s cluster
The Tasks which make up a Pipeline can easily be run in isolation
Resources such as git repos can easily be swapped between runs
Tekton Pipelines are Typed:

The concept of typed resources means that for a resource such as an Image, implementations can easily be swapped out (e.g. building with kaniko v.s. buildkit)

## Tekton Dashboard

Tekton Dashboard is a general purpose, web-based UI for Tekton Pipelines and Tekton triggers resources.

It allows users to manage and view Tekton resource creation, execution, and completion.

Among other things, the Tekton Dashboard supports:

Filtering resources by label
Realtime view of PipelineRun and TaskRun logs
View resource details and YAML
Show resources for the whole cluster or limit visibility to a particular namespace
Import resources directly from a git repository
Adding functionality through extensions, like automatically triggering pipelines on git events (GitHub and GitLab supported)

## Tekton Triggers

Triggers is a Kubernetes Custom Resource Definition (CRD) controller that allows you to extract information from events payloads (a "trigger") to create Kubernetes resources.
displayName: Tektoncd Operator
icon:
- base64data: |
iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAABGdBTUEAALGPC/xhBQAAACBjSFJN
AAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABmJLR0QA/wD/AP+gvaeTAAAA
B3RJTUUH5AgaCxsNlQdXyAAAELFJREFUWMOV13eUFeXdB/DfU6bdfu/u3V122aWJSIcoxVhSsBFj
QUVPTF4SxUhR0QhY0XBEMegbI4mEEIPGQgyKRvcVECkRMAQEFJDeYRfv1tvvnZmnvn+oKRrJ+j1n
zpS/Puc7z+85M+j9JR/CeTcOR2/MWT2Oe+JGhHTJJHqvifXfQjHro1MfnSxd+/xEsDACAIDDS9YA
DTmodOB4SLRnorIzbVpBSzjVsbxVU1EoHzoh+86bDp8nd+s0QMmkrVpbB0qPXcC5HMy5TEjbfhf3
6rkYPI81/HI2fFVQ47x1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q8A
QqjrwP+UFx94EZ6Z+2e4/OrzvlUo+LcIQEkBBFwumS9AYcs8ZoUDmzvS7liXq5gmlGpKDU9oqTE5
GIkF5hcK3rEN6+/q8lB8Mf8PWkOAASzHdQQAAAAldEVYdGRhdGU6Y3JlYXRlADIwMjAtMDgtMjZU
MTE6Mjc6MTMrMDA6MDCF+wIcAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDIwLTA4LTI2VDExOjI3OjEz
KzAwOjAw9Ka6oAAAAABJRU5ErkJggg==
mediatype: image/png
install:
spec:
deployments: null
strategy: ""
installModes:
- supported: false
type: OwnNamespace
- supported: false
type: SingleNamespace
- supported: false
type: MultiNamespace
- supported: true
type: AllNamespaces
keywords:
- tekton
- tektoncd
- build
- pipeline
- cicd
links:
- name: Tekton Documentation
url: https://tekton.dev/
- name: Tekton Pipeline
url: https://github.com/tektoncd/pipeline
- name: Tekton Dashboard
url: https://github.com/tektoncd/dashboard
- name: Tekton Triggers
url: https://github.com/tektoncd/triggers
maintainers:
- email: tekton-dev@googlegroups.com
name: The Tekton Authors
maturity: alpha
provider:
name: The Tekton Authors
version: 0.0.0-0
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# THIS FILE IS AUTOGENERATED ! Please update openshift-pipelines-operator-rh.clusterserviceversion.template.yaml.tmpl instead.
apiVersion: operators.coreos.com/v1alpha1
kind: ClusterServiceVersion
metadata:
Expand Down Expand Up @@ -286,7 +287,7 @@ spec:
- Tekton Pipelines: v0.58.0
- Tekton Triggers: v0.26.1
- Pipelines as Code: 0.24.3
- Pipelines as Code: v0.24.5
- Tekton Chains: v0.20.1
- Tekton Hub (tech-preview): v1.16.0
- Tekton Results (tech-preview): v0.9.2
Expand Down
Loading

0 comments on commit f04b33e

Please sign in to comment.