Skip to content

Latest commit

 

History

History
62 lines (40 loc) · 2.84 KB

File metadata and controls

62 lines (40 loc) · 2.84 KB

CI Build with Kaniko, Manifest, and Open PR

This pipeline is slightly more complex than the previuos example. This example assumes that you read and understood the previous one.

  1. After building the image, the pipeline then generates the SonataFlow manifest based on your project and the built image
  2. Next, the pipeline prepares a PR to update the config repository with SonataFlow manifests
  3. Finally, it opens the PR in the target repo.

The idea is to update the application status in a Kubernetes cluster.

Prereqs

See main prereqs.

Create a secret to hold your ssh credentials. For security reasons, you may create a new SSH key and configure in your Github account.

# Make sure to keep the file as https://github.com/tektoncd/catalog/blob/main/task/git-cli/0.4/README.md#using-ssh-credentials
kubectl create secret generic ssh-github --from-file=${HOME}/.ssh

Create a secret to hold a Github token to open PRs in your organization:

# Generate a Github Token with permissions to open PRs, see more at https://github.com/tektoncd/catalog/blob/main/task/github-open-pr/0.2/README.md
kubectl create secret generic github-token --from-literal=token=<YOUR-TOKEN-HERE>

Install required Tasks

See main Install required Tasks, additionally you must install:

kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/git-cli/0.4/git-cli.yaml
kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/github-open-pr/0.2/github-open-pr.yaml

Pipeline Instalation

To install the pipeline in the target namespace just run the following command from this directory:

kubectl apply -f sonataflow-kaniko-genman-pipeline.yaml

You can see the pipeline installed in the Tekton Dashboard.

Run the Pipeline

Besides the required inputs from the previous example, you need:

  • repo-config-url: the configuration Github repository. E.g. where you keep the kubernetes manifests to update the cluster state.
  • github-token-secret: the Secret that holds the Github Token to open a PR.
  • github-user and github-email: the Github user and e-mail that owns the token and that will open the PR.

Edit to change with your data, then you can then create the PipelineRun manifest:

kubectl create -f sonataflow-kaniko-genman-pipeline-run.yaml

You may fire a new run anytime by just creating new runs using this manifest. You may also change the parameters to run your own project.