View on GitHub

testFlask-tekton

Tekton Pipeline for the testFlask Repo

testFlask-tekton

Sample Tekton Pipeline for a Flask Python Application

Application will show how we can use Tekton to deploy/test a flask application running on openshift, the Application being used is testFlask
Environment variables used in Commands have samples in the sample_env file.
So this example assumes a pipeline scenario where there is a running production application represented by our Production Project and at build time we deploy the same exact infrastructure in our devlopment project and test the code, when all satisfied we promote our dev image to production which is automatically deployed based on a trigger from our imagestream.

Prerequisites:

Steps to Run via Kustomize

Prerequisite Infrastructure

Please note this section is not maintained and is pulled from other repos.

Gatekeeper Enforcement

With the use of the Gatekeeper/OPA you can create policies to enforce/inform of cluster violations.There are sample policies to show an example of enforcing with tekton.Please make sure to install the gatekeeper operator first.

Note: Might need to run it 2x as API has to create CRD for contraint

Make sure all tekton pipelines have an ACS Policy Checking Task

oc kustomize ./cicd/overlays/secure/acs/policy-tekton-checking | oc create -f -

Make sure all tekton pipelines have an ACS Policy Scanning Task

oc kustomize ./cicd/overlays/secure/acs/policy-tekton-scanning | oc create -f -

Make sure all tekton pipelines have the appropriate apiVersions

oc kustomize ./cicd/overlays/secure/policy-tekton-api-version/ | oc create -f -

Make sure all tekton pipelines have a max failure timeout set.

oc kustomize ./cicd/overlays/secure/policy-tekton-timeout-set | oc create -f -

Make sure all tetkon pipeline resolvers only use approved git registries

oc kustomize ./cicd/overlays/secure/policy-tekton-allowed-git-resolver | oc create -f -

Make sure all tetkon pipeline resolvers only use approved bundle repos

oc kustomize ./cicd/overlays/secure/policy-tekton-allowed-bundle-resolver | oc create -f -

After the above constraints are created, you should not longer be able to run the non-secure pipeline creation above but you should be able to run the secure version.