npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

cdk8s-pipelines-lib

v0.0.12

Published

Library of common Tekton pipeline patterns and Tekton hub tasks as cdk8s constructs.

Downloads

413

Readme

build

View on Construct Hub

Pipeline Library of cdk8s Constructs

This is a library of several "pattern" pipelines that are intended to be basic and therefore easily reusable.

Additionally, using the TaskBuilder, each Task (see Tasks) from Tekton Hub can be found in this library as a construct.

Using tasks from Tekton Hub

The following is an example chart that uses a Tekton Hub Task for an OpenShift client.

import { App, Chart, ChartProps } from 'cdk8s';
import { ParameterBuilder, PipelineBuilder } from 'cdk8s-pipelines';
import { openshift_client } from 'cdk8s-pipelines-lib';
import { Construct } from 'constructs';

export class MyChart extends Chart {
  constructor(scope: Construct, id: string, props: ChartProps = {}) {
    super(scope, id, props);

    const projectName = 'my-project';

    const createProject = openshift_client(this, 'create-project')
      .withStringParam(new ParameterBuilder('SCRIPT')
        .withValue(`oc create ${projectName}`));

    new PipelineBuilder(this, 'create-some-namespace')
      .withDescription('Creates a namespace and then does some other stuff')
      .withTask(createProject)
      // ... more tasks go here
      .buildPipeline({ includeDependencies: true });
  }
}
const app = new App();
new MyChart(app, 'hello');
app.synth();

The result of this code will include the dependent tasks. The output will look like this:

apiVersion: tekton.dev/v1
kind: Task
metadata:
  name: openshift-client
spec:
  description: null
  workspaces:
    - name: manifest-dir
      description: The workspace which contains kubernetes manifests which we want to apply on the cluster.
    - name: kubeconfig-dir
      description: The workspace which contains the the kubeconfig file if in case we want to run the oc command on another cluster.
  params:
    - name: SCRIPT
      description: ""
      default: null
    - name: VERSION
      description: The OpenShift Version to use
      default: "4.7"
  steps:
    - name: oc
      image: quay.io/openshift/origin-cli:$(params.VERSION)
      script: |
        #!/usr/bin/env bash

        [[ "$(workspaces.manifest-dir.bound)" == "true" ]] && \
        cd $(workspaces.manifest-dir.path)

        [[ "$(workspaces.kubeconfig-dir.bound)" == "true" ]] && \
        [[ -f $(workspaces.kubeconfig-dir.path)/kubeconfig ]] && \
        export KUBECONFIG=$(workspaces.kubeconfig-dir.path)/kubeconfig

        $(params.SCRIPT)
      workingDir: null
      env: null
---
apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
  name: create-some-namespace
spec:
  description: Creates a namespace and then does some other stuff
  params:
    - name: VERSION
      type: string
  workspaces:
    - name: manifest-dir
      description: The workspace which contains kubernetes manifests which we want to apply on the cluster.
    - name: kubeconfig-dir
      description: The workspace which contains the the kubeconfig file if in case we want to run the oc command on another cluster.
  tasks:
    - name: create-project
      taskRef:
        name: openshift-client
      params:
        - name: SCRIPT
          value: oc create my-project
        - name: VERSION
          value: $(params.VERSION)
      workspaces:
        - name: manifest-dir
          workspace: manifest-dir
        - name: kubeconfig-dir
          workspace: kubeconfig-dir

Using in a build

The goal of using cdk8s-pipeline and cdk8s-pipeline-lib should be to produce YAML artifacts in a build process that are included in the release of a project. As an example, see this example AWS CDK project, which demonstrates how to include the output created by the CDK synth() in the output of the build as a versioned release.