GSoC25-tekton-plugin
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Note Insights Sharing URL Help
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Write
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    # Jenkins + Tekton Integration on Kind Cluster ## E2E Tests for Tekton Client Plugin ### What E2E Tests Look Like E2E tests for a Tekton Client Plugin should validate the complete user workflow: 1. **Plugin Installation & Configurationn** - Install plugin via Jenkins UI, configure Kubernetes connection 2. **Pipeline DSL Usage** - Use plugin-specific syntax like `tektonTask{}` and `tektonPipeline{}` in Jenkinsfiles 3. **Complete Workflows** - Test full CI/CD pipelines : Git Commit → Jenkins Pipeline → Tekton Tasks → Build → Test → Deploy → Verify ### How to Automate Them 1. **Custom Jenkins Docker Image**: Build Jenkins with the plugin baked in (jenkinsci/tekton-client-plugin:latest) 2. **Kind Cluster Setup**: Use helm/kind-action to create dedicated test cluster 3. **Helm-based Jenkins Install**: Deploy Jenkins using Helm chart with custom image and disabled plugin installation 4. **Tekton Installation**: Install Tekton via kubectl from official release YAML 5. **CLI Tools Setup**: Install tkn (Tekton CLI) and jcli (Jenkins CLI) for programmatic testing 6. **Image Loading**: Use kind load docker-image to make custom Jenkins image available in cluster ## Overview This guide demonstrates how to set up Jenkins and Tekton on a Kind (Kubernetes in Docker) cluster, configure their integration, and implement comprehensive testing strategies including Integration Tests and End-to-End (E2E) Tests. **Key Components:** - **Kind Cluster**: Local Kubernetes cluster for development/testing - **Tekton Pipelines**: Cloud-native CI/CD framework running on Kubernetes - **Jenkins**: CI/CD automation server with Kubernetes agent support - **Tekton Client Plugin**: (Conceptual) Jenkins plugin for Tekton integration ## Architecture Overview ``` ┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐ │ Developer │───▶│ Jenkins │───▶│ Tekton │ │ │ │ │ │ │ │ • Commits code │ │ • Triggers │ │ • Executes │ │ • Creates PR │ │ • Orchestrates │ │ • Tasks │ │ • Monitors │ │ • Monitors │ │ • Pipelines │ └─────────────────┘ └──────────────────┘ └─────────────────┘ │ │ │ Kubernetes API │ └─────────────────────────┘ ``` ## Prerequisites - Docker installed and running - Kind CLI installed - kubectl CLI installed - Helm CLI installed - Basic understanding of Kubernetes, Jenkins, and CI/CD concepts ## Setup Instructions ### 1. Create Kind Cluster **Create single-node control-plane cluster:** ```bash kind create cluster --name jenkins-tekton ``` This creates a minimal Kubernetes cluster with optimized settings for local development, including adequate pod limits and resource reservations for running Jenkins and Tekton workloads. **Verify cluster:** ```bash kubectl cluster-info kubectl get nodes ``` ### 2. Install Tekton Pipelines **Install Tekton core components:** ```bash kubectl apply -f https://storage.googleapis.com/tekton-releases/pipeline/latest/release.yaml ``` **Wait for Tekton to be ready:** ```bash kubectl wait --for=condition=Ready pod -l app=tekton-pipelines-controller -n tekton-pipelines --timeout=300s kubectl wait --for=condition=Ready pod -l app=tekton-pipelines-webhook -n tekton-pipelines --timeout=300s ``` **Verify Tekton installation:** ```bash kubectl get pods -n tekton-pipelines kubectl api-resources | grep tekton ``` ### 3. Install Jenkins with Kubernetes Plugin **Add Jenkins Helm repository:** ```bash helm repo add jenkins https://charts.jenkins.io helm repo update ``` **Install Jenkins with Kubernetes support:** ```bash helm install jenkins jenkins/jenkins \ --namespace jenkins --create-namespace \ --set controller.serviceType=NodePort \ --set controller.nodePort=32000 \ --set controller.installPlugins[0]=kubernetes:latest \ --set controller.installPlugins[1]=workflow-aggregator:latest ``` **Get Jenkins admin password:** ```bash kubectl exec --namespace jenkins -it svc/jenkins -c jenkins -- /bin/cat /run/secrets/additional/chart-admin-password && echo ``` **Access Jenkins:** - URL: http://localhost:32000 - Username: admin - Password: (from command above) ### 4. Configure RBAC for Jenkins-Tekton Integration **Create ClusterRole with comprehensive permissions:** Create a ClusterRole named `jenkins-tekton` that grants full access to: - Core Kubernetes resources (pods, services, configmaps, secrets, namespaces) - Pod execution capabilities (pods/exec, pods/log) for running commands inside containers - Application resources (deployments, statefulsets, daemonsets) - All Tekton custom resources (tasks, pipelines, taskruns, pipelineruns, triggers) This broad permission set enables Jenkins to manage the complete lifecycle of Tekton resources across namespaces. **Bind ClusterRole to Jenkins ServiceAccount:** Create a ClusterRoleBinding that associates the `jenkins-tekton` ClusterRole with the Jenkins ServiceAccount in the jenkins namespace. This binding enables Jenkins pods to authenticate with the Kubernetes API and perform Tekton operations cluster-wide. **Verify RBAC permissions:** ```bash kubectl auth can-i create tasks --as=system:serviceaccount:jenkins:jenkins kubectl auth can-i exec pods --as=system:serviceaccount:jenkins:jenkins -n jenkins ``` ### 5. Create Test Namespaces **Create dedicated namespaces for testing:** ```bash kubectl create namespace integration-tests kubectl create namespace e2e-tests ``` **Label namespaces for organization:** ```bash kubectl label namespace integration-tests test-type=integration kubectl label namespace e2e-tests test-type=e2e ``` ## How Jenkins and Tekton Connect ### Connection Mechanism 1. **Kubernetes API**: Jenkins communicates with Tekton through the Kubernetes API server 2. **Custom Resources**: Jenkins creates/manages Tekton CRDs (Tasks, TaskRuns, Pipelines, PipelineRuns) 3. **RBAC**: ServiceAccount-based authentication enables secure cross-namespace operations 4. **Workspaces**: Shared storage (PVCs) allows data flow between Jenkins and Tekton execution ### Integration Flow ``` Jenkins Pipeline → kubectl commands → Kubernetes API → Tekton Controller → Pod Execution ``` **Example Integration:** ```groovy // Jenkins creates Tekton Task sh 'kubectl apply -f tekton-task.yaml' // Jenkins triggers TaskRun sh 'kubectl apply -f tekton-taskrun.yaml' // Jenkins monitors execution sh 'kubectl wait --for=condition=Succeeded taskrun/my-task -n jenkins --timeout=300s' // Jenkins retrieves results sh 'kubectl logs -l tekton.dev/taskRun=my-task -n jenkins' ``` ## Testing Strategy Implementation ### Integration Tests **Purpose**: Verify technical connectivity and basic functionality between Jenkins and Tekton components. **Scope**: Component-level interactions, API accessibility, resource CRUD operations. **Implementation Overview:** Integration tests use Jenkins pipelines with Kubernetes agents to validate: 1. **Kubernetes API connectivity** - Verify Jenkins can communicate with cluster 2. **Tekton API discovery** - Confirm Tekton CRDs are accessible via kubectl 3. **Resource creation** - Create simple Tekton Tasks in test namespaces 4. **Resource verification** - Validate created resources exist and are properly configured 5. **TaskRun execution** - Execute tasks and monitor completion status 6. **RBAC validation** - Ensure Jenkins has necessary permissions across namespaces Tests use lightweight Alpine containers with kubectl, git, and curl tools installed. Each test validates a specific integration point between Jenkins and Tekton, providing fast feedback on technical connectivity issues. ### End-to-End (E2E) Tests **Purpose**: Validate complete user workflows from code commit to production deployment. **Scope**: Full CI/CD pipeline simulation, multi-stage workflows, real-world scenarios. **Implementation Overview:** E2E tests simulate complete CI/CD workflows using the tektoncd/catalog repository as a realistic codebase. The implementation includes: 1. **Multi-stage Pipeline Creation**: - Build task that compiles source code and generates artifacts - Test task that validates build artifacts and runs quality checks - Deploy task that simulates production deployment with artifact verification 2. **Workspace Management**: - Shared PersistentVolumeClaim for data flow between pipeline stages - Proper workspace mounting and artifact persistence 3. **Complete Workflow Execution**: - PipelineRun creation with proper task dependencies (build → test → deploy) - Real-time monitoring using kubectl wait commands - Comprehensive result validation and reporting 4. **Production Simulation**: - Uses realistic Git repository (tektoncd/catalog) for source code - Implements proper error handling and exit codes - Validates deployment artifacts and application readiness E2E tests provide confidence that the entire integration works end-to-end, simulating real developer workflows from code commit to production deployment. ## Test Results and Learnings ### Implemented Integration Tests 1. **Kubernetes Connectivity Test**: Verified Jenkins can communicate with K8s API 2. **Tekton API Discovery Test**: Confirmed Tekton CRDs are accessible 3. **Resource CRUD Operations Test**: Successfully created, read, updated, deleted Tekton resources 4. **TaskRun Execution Test**: Validated end-to-end task execution flow 5. **RBAC Permissions Test**: Verified Jenkins ServiceAccount has required permissions ### Implemented E2E Tests 1. **Complete CI/CD Pipeline**: Multi-stage pipeline with build → test → deploy flow 2. **Workspace Management**: Shared data flow between pipeline stages 3. **Production Simulation**: Real deployment scenario testing ## Cleanup **Remove test resources:** ```bash kubectl delete namespace integration-tests e2e-tests ``` **Remove Jenkins:** ```bash helm uninstall jenkins -n jenkins kubectl delete namespace jenkins ``` **Remove Tekton:** ```bash kubectl delete -f https://storage.googleapis.com/tekton-releases/pipeline/latest/release.yaml ``` **Delete Kind cluster:** ```bash kind delete cluster --name jenkins-tekton ```

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully