Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore upgrade tekton pipelines #1621

Open
wants to merge 21 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
0d05e38
chore: upgrade tekton pipeline to 0.65.3 with dependencies upgrades
JordanGoasdoue Dec 4, 2024
6381244
chore: use pipelinev1beta1 everywhere
JordanGoasdoue Dec 5, 2024
13c4f34
chore: use tektoncd/pipeline/pkg/apis/pipeline/v1
JordanGoasdoue Dec 5, 2024
990f5e4
chore: regenerate crds with make crd-manifests
JordanGoasdoue Dec 5, 2024
1759ded
chore: manually edit zz_generated because controller-gen fails
JordanGoasdoue Dec 5, 2024
cf9c191
chore: adapt Breakpoints tests
JordanGoasdoue Dec 5, 2024
8d481c3
chore: use tekton.dev/v1 everywhere
JordanGoasdoue Dec 5, 2024
cf8b70b
chore: use Timeouts.Pipeline instead of Timeout
JordanGoasdoue Dec 5, 2024
987b08c
chore: replace ArrayOrString with ParamValue
JordanGoasdoue Dec 5, 2024
c50b264
chore: get taskruns from clients instead of pr.Status.TaskRuns
JordanGoasdoue Dec 5, 2024
2541c0b
chore: remove deprecated PipelineResources
JordanGoasdoue Dec 5, 2024
856c48f
chore: adapt PodTemplate
JordanGoasdoue Dec 5, 2024
dc13657
chore: adapt step resources with new computeResources
JordanGoasdoue Dec 6, 2024
ef14dd5
chore: add scheme on Manager config
JordanGoasdoue Dec 5, 2024
05ca533
chore: add taskruns get permission
JordanGoasdoue Dec 6, 2024
4b1d5db
chore: pass tektonClient from param in ConvertPipelineRun
JordanGoasdoue Dec 6, 2024
416054c
chore: add taskrun mock test
JordanGoasdoue Dec 6, 2024
c8372f3
chore: adapt activity pr & tr mocks with pipelinerun v1
JordanGoasdoue Dec 6, 2024
7b83551
chore: adapt controller to v1
JordanGoasdoue Dec 6, 2024
06fb100
chore: use lighthousev1alpha1
JordanGoasdoue Dec 9, 2024
45cc04d
chore: tests are passing
JordanGoasdoue Dec 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 14 additions & 15 deletions .lighthouse/jenkins-x/pullrequest.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: tekton.dev/v1beta1
apiVersion: tekton.dev/v1
kind: PipelineRun
metadata:
creationTimestamp: null
Expand All @@ -7,83 +7,82 @@ spec:
pipelineSpec:
tasks:
- name: from-build-pack
resources: {}
taskSpec:
metadata: {}
stepTemplate:
image: uses:jenkins-x/jx3-pipeline-catalog/tasks/go-plugin/pullrequest.yaml@versionStream
name: ""
resources: {}
computeResources: {}
workingDir: /workspace/source
steps:
- image: uses:jenkins-x/jx3-pipeline-catalog/tasks/git-clone/git-clone-pr.yaml@versionStream
name: ""
resources: {}
computeResources: {}
- name: jx-variables
- name: build-make-linux
resources: {}
computeResources: {}
- name: protect-credentials
securityContext:
runAsUser: 0
resources: {}
computeResources: {}
image: ghcr.io/distroless/busybox
script: |
#!/bin/sh
cp -a /tekton/home/.git-credentials /tekton/home/.git-credentials.bak
- name: build-make-test
resources: {}
computeResources: {}
- name: build-container-build:webhooks
resources: {}
computeResources: {}
script: |
#!/busybox/sh
source .jx/variables.sh
cp /tekton/creds-secrets/tekton-container-registry-auth/.dockerconfigjson /kaniko/.docker/config.json
/kaniko/executor $KANIKO_FLAGS --context=/workspace/source --dockerfile=docker/webhooks/Dockerfile --destination=ghcr.io/jenkins-x/lighthouse-webhooks:$VERSION --build-arg=VERSION=$VERSION
- name: build-container-build:poller
resources: {}
computeResources: {}
script: |
#!/busybox/sh
source .jx/variables.sh
cp /tekton/creds-secrets/tekton-container-registry-auth/.dockerconfigjson /kaniko/.docker/config.json
/kaniko/executor $KANIKO_FLAGS --context=/workspace/source --dockerfile=docker/poller/Dockerfile --destination=ghcr.io/jenkins-x/lighthouse-poller:$VERSION --build-arg=VERSION=$VERSION
- name: build-container-build:keeper
resources: {}
computeResources: {}
script: |
#!/busybox/sh
source .jx/variables.sh
cp /tekton/creds-secrets/tekton-container-registry-auth/.dockerconfigjson /kaniko/.docker/config.json
/kaniko/executor $KANIKO_FLAGS --context=/workspace/source --dockerfile=docker/keeper/Dockerfile --destination=ghcr.io/jenkins-x/lighthouse-keeper:$VERSION --build-arg=VERSION=$VERSION
- name: build-container-build:foghorn
resources: {}
computeResources: {}
script: |
#!/busybox/sh
source .jx/variables.sh
cp /tekton/creds-secrets/tekton-container-registry-auth/.dockerconfigjson /kaniko/.docker/config.json
/kaniko/executor $KANIKO_FLAGS --context=/workspace/source --dockerfile=docker/foghorn/Dockerfile --destination=ghcr.io/jenkins-x/lighthouse-foghorn:$VERSION --build-arg=VERSION=$VERSION
- name: build-container-build:tekton
resources: {}
computeResources: {}
script: |
#!/busybox/sh
source .jx/variables.sh
cp /tekton/creds-secrets/tekton-container-registry-auth/.dockerconfigjson /kaniko/.docker/config.json
/kaniko/executor $KANIKO_FLAGS --context=/workspace/source --dockerfile=docker/tekton/Dockerfile --destination=ghcr.io/jenkins-x/lighthouse-tekton-controller:$VERSION --build-arg=VERSION=$VERSION
- name: build-container-build:jenkins
resources: {}
computeResources: {}
script: |
#!/busybox/sh
source .jx/variables.sh
cp /tekton/creds-secrets/tekton-container-registry-auth/.dockerconfigjson /kaniko/.docker/config.json
/kaniko/executor $KANIKO_FLAGS --context=/workspace/source --dockerfile=docker/jenkins/Dockerfile --destination=ghcr.io/jenkins-x/lighthouse-jenkins-controller:$VERSION --build-arg=VERSION=$VERSION
- name: build-container-build:gc-jobs
resources: {}
computeResources: {}
script: |
#!/busybox/sh
source .jx/variables.sh
cp /tekton/creds-secrets/tekton-container-registry-auth/.dockerconfigjson /kaniko/.docker/config.json
/kaniko/executor $KANIKO_FLAGS --context=/workspace/source --dockerfile=docker/gc/Dockerfile --destination=ghcr.io/jenkins-x/lighthouse-gc-jobs:$VERSION --build-arg=VERSION=$VERSION
- image: ghcr.io/jenkins-x/jx-boot:3.10.131
name: release-chart
resources: {}
computeResources: {}
script: |
#!/usr/bin/env sh
source .jx/variables.sh
Expand Down
35 changes: 17 additions & 18 deletions .lighthouse/jenkins-x/release.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: tekton.dev/v1beta1
apiVersion: tekton.dev/v1
kind: PipelineRun
metadata:
creationTimestamp: null
Expand All @@ -7,77 +7,76 @@ spec:
pipelineSpec:
tasks:
- name: chart
resources: {}
taskSpec:
metadata: {}
stepTemplate:
image: uses:jenkins-x/jx3-pipeline-catalog/tasks/go-plugin/release.yaml@versionStream
name: ""
resources: {}
computeResources: {}
workingDir: /workspace/source
steps:
- image: uses:jenkins-x/jx3-pipeline-catalog/tasks/git-clone/git-clone.yaml@versionStream
name: ""
resources: {}
computeResources: {}
- name: next-version
resources: {}
computeResources: {}
- name: jx-variables
- name: release-binary
resources: {}
computeResources: {}
- name: build-and-push-image:webhooks
resources: {}
computeResources: {}
script: |
#!/busybox/sh
source .jx/variables.sh
cp /tekton/creds-secrets/tekton-container-registry-auth/.dockerconfigjson /kaniko/.docker/config.json
/kaniko/executor $KANIKO_FLAGS --context=/workspace/source --dockerfile=docker/webhooks/Dockerfile --destination=ghcr.io/jenkins-x/lighthouse-webhooks:$VERSION --destination=ghcr.io/jenkins-x/lighthouse-webhooks:latest --build-arg=VERSION=$VERSION
- name: build-and-push-image:poller
resources: {}
computeResources: {}
script: |
#!/busybox/sh
source .jx/variables.sh
cp /tekton/creds-secrets/tekton-container-registry-auth/.dockerconfigjson /kaniko/.docker/config.json
/kaniko/executor $KANIKO_FLAGS --context=/workspace/source --dockerfile=docker/poller/Dockerfile --destination=ghcr.io/jenkins-x/lighthouse-poller:$VERSION --destination=ghcr.io/jenkins-x/lighthouse-poller:latest --build-arg=VERSION=$VERSION
- name: build-and-push-image:keeper
resources: {}
computeResources: {}
script: |
#!/busybox/sh
source .jx/variables.sh
cp /tekton/creds-secrets/tekton-container-registry-auth/.dockerconfigjson /kaniko/.docker/config.json
/kaniko/executor $KANIKO_FLAGS --context=/workspace/source --dockerfile=docker/keeper/Dockerfile --destination=ghcr.io/jenkins-x/lighthouse-keeper:$VERSION --destination=ghcr.io/jenkins-x/lighthouse-keeper:latest --build-arg=VERSION=$VERSION
- name: build-and-push-image:foghorn
resources: {}
computeResources: {}
script: |
#!/busybox/sh
source .jx/variables.sh
cp /tekton/creds-secrets/tekton-container-registry-auth/.dockerconfigjson /kaniko/.docker/config.json
/kaniko/executor $KANIKO_FLAGS --context=/workspace/source --dockerfile=docker/foghorn/Dockerfile --destination=ghcr.io/jenkins-x/lighthouse-foghorn:$VERSION --destination=ghcr.io/jenkins-x/lighthouse-foghorn:latest --build-arg=VERSION=$VERSION
- name: build-and-push-image:tekton
resources: {}
computeResources: {}
script: |
#!/busybox/sh
source .jx/variables.sh
cp /tekton/creds-secrets/tekton-container-registry-auth/.dockerconfigjson /kaniko/.docker/config.json
/kaniko/executor $KANIKO_FLAGS --context=/workspace/source --dockerfile=docker/tekton/Dockerfile --destination=ghcr.io/jenkins-x/lighthouse-tekton-controller:$VERSION --destination=ghcr.io/jenkins-x/lighthouse-tekton-controller:latest --build-arg=VERSION=$VERSION
- name: build-and-push-image:jenkins
resources: {}
computeResources: {}
script: |
#!/busybox/sh
source .jx/variables.sh
cp /tekton/creds-secrets/tekton-container-registry-auth/.dockerconfigjson /kaniko/.docker/config.json
/kaniko/executor $KANIKO_FLAGS --context=/workspace/source --dockerfile=docker/jenkins/Dockerfile --destination=ghcr.io/jenkins-x/lighthouse-jenkins-controller:$VERSION --destination=ghcr.io/jenkins-x/lighthouse-jenkins-controller:latest --build-arg=VERSION=$VERSION
- name: build-and-push-image:gc-jobs
resources: {}
computeResources: {}
script: |
#!/busybox/sh
source .jx/variables.sh
cp /tekton/creds-secrets/tekton-container-registry-auth/.dockerconfigjson /kaniko/.docker/config.json
/kaniko/executor $KANIKO_FLAGS --context=/workspace/source --dockerfile=docker/gc/Dockerfile --destination=ghcr.io/jenkins-x/lighthouse-gc-jobs:$VERSION --destination=ghcr.io/jenkins-x/lighthouse-gc-jobs:latest --build-arg=VERSION=$VERSION
- name: chart-docs
resources: {}
computeResources: {}
- image: ghcr.io/jenkins-x/jx-boot:3.10.131
name: changelog
resources: {}
computeResources: {}
script: |
#!/usr/bin/env sh
source .jx/variables.sh
Expand All @@ -90,9 +89,9 @@ spec:

jx changelog create --verbose --header-file=hack/changelog-header.md --version=$VERSION --rev=$PULL_BASE_SHA --output-markdown=changelog.md --prerelease
- name: release-chart
resources: {}
computeResources: {}
- name: upload-binaries
resources: {}
computeResources: {}
script: |
#!/bin/bash
source .jx/variables.sh
Expand All @@ -103,7 +102,7 @@ spec:
git tag -fa v$VERSION -m "Release version $VERSION"
git push --force origin v$VERSION
- name: promote-release
resources: {}
computeResources: {}
podTemplate: {}
serviceAccountName: tekton-bot
timeout: 240h0m0s
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ verify-code-unchanged:

CONTROLLER_GEN := $(GOPATH)/bin/controller-gen
$(CONTROLLER_GEN):
$(GO) install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.4.0
$(GO) install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.16.5

crd-manifests: $(CONTROLLER_GEN)
$(CONTROLLER_GEN) crd:maxDescLen=0 paths="./pkg/apis/lighthouse/v1alpha1/..." output:crd:artifacts:config=crds
Expand Down
1 change: 1 addition & 0 deletions charts/lighthouse/templates/tekton-controller-role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ rules:
- tekton.dev
resources:
- pipelines
- taskruns
verbs:
- get
- apiGroups:
Expand Down
17 changes: 15 additions & 2 deletions cmd/foghorn/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@ import (
"github.com/jenkins-x/lighthouse/pkg/foghorn"
"github.com/jenkins-x/lighthouse/pkg/logrusutil"
"github.com/sirupsen/logrus"
pipelinev1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1"
"k8s.io/apimachinery/pkg/runtime"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/cache"
"sigs.k8s.io/controller-runtime/pkg/manager"
)

type options struct {
Expand Down Expand Up @@ -38,7 +41,10 @@ func main() {

scheme := runtime.NewScheme()
if err := lighthousev1alpha1.AddToScheme(scheme); err != nil {
logrus.WithError(err).Fatal("Failed to register scheme")
logrus.WithError(err).Fatal("Failed to register lighthousev1alpha1 scheme")
}
if err := pipelinev1.AddToScheme(scheme); err != nil {
logrus.WithError(err).Fatal("Failed to register tektoncd-pipelinev1 scheme")
}

o := gatherOptions(flag.NewFlagSet(os.Args[0], flag.ExitOnError), os.Args[1:]...)
Expand All @@ -51,7 +57,14 @@ func main() {
logrus.WithError(err).Fatal("Could not create kubeconfig")
}

mgr, err := ctrl.NewManager(cfg, ctrl.Options{Scheme: scheme, Namespace: o.namespace})
mgr, err := ctrl.NewManager(cfg, manager.Options{
Cache: cache.Options{
DefaultNamespaces: map[string]cache.Config{
o.namespace: {},
},
},
Scheme: scheme,
})
if err != nil {
logrus.WithError(err).Fatal("Unable to start manager")
}
Expand Down
26 changes: 20 additions & 6 deletions cmd/tektoncontroller/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ import (
"github.com/jenkins-x/lighthouse/pkg/interrupts"
"github.com/jenkins-x/lighthouse/pkg/logrusutil"
"github.com/sirupsen/logrus"
pipelinev1beta1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1"
pipelinev1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1"
"k8s.io/apimachinery/pkg/runtime"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/cache"
"sigs.k8s.io/controller-runtime/pkg/manager"
)

type options struct {
Expand Down Expand Up @@ -45,10 +47,10 @@ func main() {

scheme := runtime.NewScheme()
if err := lighthousev1alpha1.AddToScheme(scheme); err != nil {
logrus.WithError(err).Fatal("Failed to register scheme")
logrus.WithError(err).Fatal("Failed to register lighthousev1alpha1 scheme")
}
if err := pipelinev1beta1.AddToScheme(scheme); err != nil {
logrus.WithError(err).Fatal("Failed to register scheme")
if err := pipelinev1.AddToScheme(scheme); err != nil {
logrus.WithError(err).Fatal("Failed to register tektoncd-pipelinev1 scheme")
}

o := gatherOptions(flag.NewFlagSet(os.Args[0], flag.ExitOnError), os.Args[1:]...)
Expand All @@ -61,12 +63,24 @@ func main() {
logrus.WithError(err).Fatal("Could not create kubeconfig")
}

mgr, err := ctrl.NewManager(cfg, ctrl.Options{Scheme: scheme, Namespace: o.namespace})
mgr, err := ctrl.NewManager(cfg, manager.Options{
Cache: cache.Options{
DefaultNamespaces: map[string]cache.Config{
o.namespace: {},
},
},
Scheme: scheme,
})
if err != nil {
logrus.WithError(err).Fatal("Unable to start manager")
}

lhJobReconciler := tektonengine.NewLighthouseJobReconciler(mgr.GetClient(), mgr.GetAPIReader(), mgr.GetScheme(), o.dashboardURL, o.dashboardTemplate, o.namespace)
tektonclient, _, _, _, err := clients.GetAPIClients()
if err != nil {
logrus.WithError(err).Fatal(err, "failed to get api clients")
}

lhJobReconciler := tektonengine.NewLighthouseJobReconciler(mgr.GetClient(), mgr.GetAPIReader(), mgr.GetScheme(), tektonclient, o.dashboardURL, o.dashboardTemplate, o.namespace)
if err = lhJobReconciler.SetupWithManager(mgr); err != nil {
logrus.WithError(err).Fatal("Unable to create controller")
}
Expand Down
24 changes: 11 additions & 13 deletions crds/lighthouse.jenkins.io_lighthousebreakpoints.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@

---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.4.0
creationTimestamp: null
controller-gen.kubebuilder.io/version: v0.16.5
name: lighthousebreakpoints.lighthouse.jenkins.io
spec:
group: lighthouse.jenkins.io
Expand All @@ -32,10 +30,16 @@ spec:
properties:
debug:
properties:
breakpoint:
items:
type: string
type: array
breakpoints:
properties:
beforeSteps:
items:
type: string
type: array
x-kubernetes-list-type: atomic
onFailure:
type: string
type: object
type: object
filter:
properties:
Expand All @@ -56,9 +60,3 @@ spec:
type: object
served: true
storage: true
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
Loading
Loading