# Catalog new CI ## Table of Contents 1. [GOALS](#org6773b68) 2. [Pipeline generation](#org9f2b88f) 3. [Notes](#org1aeeace) 4. [Testing locally](#orgb711c75) 5. [Future](#orgb6896cc) <a id="org6773b68"></a> ## GOALS - Bring Tekton as a code use cases. - PR Based testing of pipelines-catalog changes. - Pure tekton pipeline, less shell scripting. - Let Tekton/K8 do the multiplexing, fix it if it doesn't scale.' - Figure out how our tools scales to large pipeline. - Branch out openshift/pipelines-catalog from openshift/tekton-catalog CI - See how bad is it to deal with very large pipeline yaml <a id="org9f2b88f"></a> ## Pipeline generation - Each catalog entry as a \`[step.yaml](https://github.com/chmouel/pipelines-catalog/blob/new-ci/task/buildah-pr/0.1/tests/run.yaml)\` and optionally a \`[persistentvolume.yaml](https://github.com/chmouel/pipelines-catalog/blob/new-ci/task/s2i-dotnet-1/0.1/tests/pv.yaml)\` or \`[resources.yaml](https://github.com/chmouel/pipelines-catalog/blob/new-ci/task/buildah-pr/0.1/tests/resource.yaml)\` - Some [prestep](https://github.com/chmouel/pipelines-catalog/blob/new-ci/openshift/gen/prestep.yaml) before running the catalog pipeline can be specified. This has something task like this : - yaml-lint - kubectl dry run &#x2013; syntax check basically - check-generated-yaml - make sure we have regenerated the make generated if we did a change. - A [script](https://github.com/chmouel/pipelines-catalog/blob/new-ci/openshift/gen/generate-pipeline-catalog.py) pull out all of the steps detect the persistentvolume or resources and build a **Pipeline** and **PipelineRun**. - The script add a **runAfter: precheck** to all tasks to make sure we run the catalog task after the precheck, This goes along with the [prestep](https://github.com/chmouel/pipelines-catalog/blob/new-ci/openshift/gen/prestep.yaml) steps. - With the help of a template it construct all of this and output it to stdout, generally you would use the [Makefile](https://github.com/chmouel/pipelines-catalog/blob/8c49edd782a77e38e05671860b8988312d8e043b/Makefile#L7) target **make generate** which would output it in *.tekton/pipelines.yaml* where the user commits it. - [pipeline.yaml](https://github.com/chmouel/pipelines-catalog/blob/new-ci/.tekton/pipeline.yaml) has everything in there including the tasks, this can maybe optimized in the future - Tekton-asa-code kicks in and [report it](https://github.com/openshift/pipelines-catalog/pull/62/checks) <a id="org1aeeace"></a> ## Notes - Takes around 15mn to run, compared to ~45mn for pipelines-catalog tests (with multiplexing). - Needed to add a prerun step in tekton-asa-code **tekton.yaml** because of vincents change which is not compatible with stable operator. - Logs can get very big, tkac is currently using github directly to show the log there, which is limited to 5mb (i think). I now show a link to the tekton-asa-code pipelinerun instead when logs is getting too big. - When logs are bigs, the openshift console thingy gets all crazy. [Requested a RFC](https://issues.redhat.com/browse/ODC-5307) for adding a raw logs link which would help. - Some of the generation we do in pipeline as a code bugs out the console, we logged an [jira for that](https://issues.redhat.com/browse/ODC-5306). - This requests a lot of PVC, since we can't use a shared one for writting (or maybe we can?). If we have too many run we run out of PVC due of PSI limitations. - tkn pr logs with large number of taskruns can get very slow, logged a bug about it [here](https://github.com/tektoncd/cli/issues/1278). - Sometime buildah/vfs would just timeout forever. - This maybe a bit hard to debug for users, since we do a very large pipeline but since it is a generated pipeline.yaml it's easy to run on your personal OS cluster to debug. <a id="orgb711c75"></a> # Testing locally - If we want to test locally we could simply apply .tekton/pipeline.yaml but not quite since there is some variable that are substited by tekton as a code to be replaced, I am using this command line to do this : ```shell % kubectl -n pipelines-catalog apply -f <(sed -e 's,{{namespace}},pipelines-catalog,g' -e 's,{{repo_url}},https://github.com/chmouel/pipelines-catalog,' -e 's,{{revision}},"new-ci",' .tekton/pipeline.yaml) ``` The variables are : - namespace: is the target namespace where you are apply the template (**pipelines-catalog** in the example) - repourl: your pipelines-catalog repo fork url where you have pushed your change (<https://github.com/chmouel/pipelines-catalog> in example) - revision: your branch where you have pushed yoru change change (**new-ci** in example) <a id="orgb6896cc"></a> # Future - Merge it. - Nightly job with tkaac which is not supported. - How to have multiple OS version target (PSI cloud tests). - Logging and investigation.