{"id":43052498,"url":"https://github.com/cloud-native-toolkit/cdk8s-pipelines","last_synced_at":"2026-01-31T10:38:04.737Z","repository":{"id":187313843,"uuid":"676607101","full_name":"cloud-native-toolkit/cdk8s-pipelines","owner":"cloud-native-toolkit","description":"A module that includes Tekton Pipeline constructs for use with cdk8s.","archived":false,"fork":false,"pushed_at":"2024-08-13T18:07:44.000Z","size":574,"stargazers_count":3,"open_issues_count":1,"forks_count":0,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-10-06T20:50:03.738Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cloud-native-toolkit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-08-09T15:31:07.000Z","updated_at":"2025-07-25T18:56:34.000Z","dependencies_parsed_at":"2023-09-28T01:20:55.101Z","dependency_job_id":"ba9c50ce-e944-4835-b9d9-bc15ff0ea2dc","html_url":"https://github.com/cloud-native-toolkit/cdk8s-pipelines","commit_stats":{"total_commits":66,"total_committers":3,"mean_commits":22.0,"dds":0.3787878787878788,"last_synced_commit":"51d0e8d6a6dabd967ffd9a3aec4b1382dd2b025e"},"previous_names":["cloud-native-toolkit/cdk8s-pipelines"],"tags_count":19,"template":false,"template_full_name":null,"purl":"pkg:github/cloud-native-toolkit/cdk8s-pipelines","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloud-native-toolkit%2Fcdk8s-pipelines","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloud-native-toolkit%2Fcdk8s-pipelines/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloud-native-toolkit%2Fcdk8s-pipelines/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloud-native-toolkit%2Fcdk8s-pipelines/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cloud-native-toolkit","download_url":"https://codeload.github.com/cloud-native-toolkit/cdk8s-pipelines/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloud-native-toolkit%2Fcdk8s-pipelines/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28938831,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-31T10:18:23.202Z","status":"ssl_error","status_checked_at":"2026-01-31T10:18:22.693Z","response_time":128,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-31T10:38:04.671Z","updated_at":"2026-01-31T10:38:04.729Z","avatar_url":"https://github.com/cloud-native-toolkit.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CDK8s Pipelines\n\nThis is a construct for creating [Pipelines](https://tekton.dev/docs/getting-started/pipelines/)\nusing [cdk8s](https://cdk8s.io/docs/latest/).\n\nIn Cloud Development Kit (CDK) terminology, a _construct_ is a code object (class\nor application) that can be _synthesized_ to output. In AWS's CDK, that output\nis CloudFormation. Here, in a cdk8s construct, that output is YAML that can be\napplied on a Kubernetes or OpenShift cluster. Constructs can be used in other\nconstructs, just like how code classes can by used by other classes.\n\nThis library allows you to create your own Tekton pipeline constructs, which can\nthen in turn be synthesized into Task, Pipeline, and PipelineRun YAML.\n\n## Installing prerequisites\n\nThe commands here will use `npx`, using Node 18.x and NPM 9.x. You will also \nneed `yarn` 1.x (1.22.21 was used here) installed.\n\n## Using the library to create your own pipeline constructs\n\nThe `projen` command was used to create this construct library and is the easiest\nway to create a new construct. The documentation here will show how to use `projen`\nto generate your pipeline construct.\n\n### Creating your project\n\nTo create your pipeline project, run the following command, where `my-pipeline-project`\nis the name you want to give your project's directory:\n\n```bash\n$ mkdir my-pipeline-project\n$ cd my-pipeline-project\n$ npx projen new cdk8s-app-ts\n```\n\nThis will generate a TypeScript project with the cdk8s `constructs` libraries\nwith the correct structure. \n\n\u003e ***Why TypeScript and not some other language (e.g., Python)? Because TypeScript can be used to generate all the others.***\n\nThe command will also initialize a git repository and make an initial commit.\n\n\n### Adding this library to your project\n\nWhen using `projen`, modify the _.projenrc.ts_ file to add the libraries\nand then run the `npx projen` command--with no additional arguments--to\nre-generate the _package.json_ and _yarn.lock_ files and any other files\nin the project. When using `projen`, only modify the _.projenrc.ts_ file\nand the files in the _src_ folder.\n\nModify the _.projenrc.ts_ file and add the following lines to `deps` JSON\nelement:\n\n```typescript\nconst project = new cdk8s.Cdk8sTypeScriptApp({\n  // snipped, leave content as-is...\n  deps: [\n    'cdk8s-pipelines',\n    'cdk8s-pipelines-lib',\n  ],\n  // snipped, leave content as-is...\n});\n```\n\nSave the file after you have made the additions and then run the `npx projen`\ncommand to re-generate the project files.\n\n### Modifying the main Chart\n\nThe _src/main.ts_ file contains the main code that you will modify for your \nPipeline construct. Like any other TypeScript project, you can create classes\nand functions in other files and import them for use.\n\nBy default, the template includes a class called `MyChart` that extends from\nthe cdk8s core `Chart` class. You can rename this class to something a bit\nmore meaningful, such as `InstallXYZPipelineChart`.\n\nThe `constructor` function contains the code that will create the chart. Here,\nreplace the sample code with something that looks like this:\n\n```typescript\nexport class MyChart extends Chart {\n  constructor(scope: Construct, id: string, props: ChartProps = { }) {\n    super(scope, id, props);\n\n    const pipelineParam = new ParameterBuilder('repo-url');\n\n    new PipelineBuilder(this, 'clone-build-push')\n      .withDescription('This pipeline closes a repository, builds a Docker image, etc.')\n      .withStringParam(pipelineParam)\n      .withTask(new TaskBuilder(this, 'git-clone')\n        .withName('fetch-source')\n        .withWorkspace(new WorkspaceBuilder('output').withBinding('task-output'))\n        .withStringParam(new ParameterBuilder('url')\n          .withValue(fromPipelineParam(pipelineParam))\n          .withDescription('the URL for the thing')))\n      .buildPipeline();\n  }\n}\n```\n\nStart with the imports shown here and add as needed:\n\n```typescript\nimport { App, Chart, ChartProps } from 'cdk8s';\nimport { ParameterBuilder, PipelineBuilder, TaskBuilder, WorkspaceBuilder } from 'cdk8s-pipelines';\nimport { Construct } from 'constructs';\n```\n\n## Testing your pipeline locally\n\nOnce you have added code to create the pipeline, use the `npx projen build`\ncommand to compile the TypeScript code and run the `cdk8s synth` command to\ncreate the YAML output. The file will be written to the _dist_ folder and named\n_chart-id.yml_, where _chart-id_ the string value passed to your class \nthat extends `Chart`. For example, in this code:\n\n```typescript\nconst app = new App();\nnew MyChart(app, 'my-install-pipeline');\napp.synth();\n```\n\nThe output file after running `npx projen build` will be _dist/my-install-pipeline.yml_. \n\nApply this file to a Kubernetes or OpenShift cluster using `oc apply -f dist/my-install-pipeline.yml`,\nsubstituting the name of your output file in the command. If using OpenShift \nContainer Platform (OCP), you must have the OpenShift Pipelines operator installed.\nIf using Kubernetes, make sure you have [Tekton installed](https://tekton.dev/docs/installation/).\n\n## Examples\n\nShown here is an example of using one of the primitive Tekton objects--a \n[Pipeline](https://tekton.dev/docs/pipelines/) using cdk8s-pipelines. \n\n```typescript\nconst pipeline = new Pipeline(this, 'my-pipeline');\n```\n\n### Pipeline objects and builders\n\nTekton [Pipelines](https://tekton.dev/docs/pipelines/),\n[Tasks](https://tekton.dev/docs/pipelines/tasks/),\n[Workspaces](https://tekton.dev/docs/pipelines/tasks/#specifying-workspaces),\n[Parameters](https://tekton.dev/docs/pipelines/tasks/#specifying-parameters),\nand other resources refer to one another within a pipeline. For example, a \nTask may have a `params` that a value that is `$(params.foo)`, meaning it uses\nthe `param` named `foo` at the pipeline level within the task.\n\nIt is a goal of the _builders_ within this library to simplify that\ncross-referencing during the process of defining a Pipeline and its `tasks`,\n`workspaces`, and `params`.\n\nTherefore, within this library there are objects that strictly define the\nstructure of the construct itself and can be `synth()`'ed to create the \nKubernetes resources. You are free to use the constructs and define all the \ncross-references yourself. For example, here is a `Pipeline` that defines all \nresources to create a Pipeline that closely matches the \n[example here](https://tekton.dev/docs/how-to-guides/kaniko-build-push/):\n\n```typescript\nnew Pipeline(this, 'clone-build-push', {\n  metadata: {\n    name: 'clone-build-push',\n  },\n  spec: {\n    description: 'This pipeline closes a repository, builds a Docker image, etc.',\n    params: [\n      {\n        name: 'repo-url',\n        type: 'string',\n      },\n    ],\n    workspaces: [\n      {\n        name: 'shared-data',\n      },\n    ],\n    tasks: [\n      {\n        name: 'fetch-source',\n        taskRef: {\n          name: 'git-clone',\n        },\n        workspaces: [\n          {\n            name: 'output',\n            workspace: 'shared-data',\n          },\n        ],\n        params: [\n          {\n            name: 'url',\n            value: '$(params.repo-url)',\n          },\n        ],\n      },\n    ],\n  },\n});\n```\n\nAlternatively, using the _builders_ (e.g., `PipelineBuilder`) for the resources\nprovides a fluid syntax that you can use to add the resources with cross-references\nmade for you automatically. Here is the same construct, but defined using the \n`PipelineBuilder`.\n\n```typescript\nconst param = new ParameterBuilder('repo-url');\n\nnew PipelineBuilder(this, 'clone-build-push')\n    .withDescription('This pipeline closes a repository, builds a Docker image, etc.')\n    .withStringParam(param)\n    .withTask(new TaskBuilder(this, 'task-id')\n        .withName('fetch-source')\n        .referencingTask('git-clone')\n        .withWorkspace(new WorkspaceBuilder('output').withBinding('shared-data'))\n        .withStringParam(new ParameterBuilder('url').withValue(fromPipelineParam(param))))\n    .buildPipeline();\n```\n\nThe `build` method on the builders will validate the parameters and, if the \nobject is valid, will create the construct, making sure to add `workspace`\nand `param` resources to the Task as well as the \n\nAny resources that the `task` requires that needs to be defined at the `pipeline` level.\n\n## Related projects\n\nThis is the core project with the basic Pipeline constructs. There are other \nconstructs that use this construct to develop richer pipelines and tasks that\nare based on tasks available in [Tekton Hub](https://hub.tekton.dev/).\n\n* [cdk8s-pipelines-lib](https://github.com/cloud-native-toolkit/cdk8s-pipelines-lib) - A library of \nconstructs that allows you to easily create Tekton pipelines that use tasks from\nTekton Hub and also provides some basic, reusable pipelines.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloud-native-toolkit%2Fcdk8s-pipelines","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcloud-native-toolkit%2Fcdk8s-pipelines","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloud-native-toolkit%2Fcdk8s-pipelines/lists"}