Home > Enterprise >  Tekton Pipelines: Enable alpha features using released pipelines yaml without the need to store (& m
Tekton Pipelines: Enable alpha features using released pipelines yaml without the need to store (& m

Time:12-16

We'd like to use Tekton experimental features such as the Pipelines In Pipelines feature. We already installed the feature as described in the README via kubectl apply but end up in an error like this:

Pipeline default/buildpacks-test-pipeline can't be Run; it contains Tasks that don't exist: Couldn't retrieve Task "generic-gitlab-set-status": tasks.tekton.dev "generic-gitlab-set-status" not found

In this issue it is stated, that we need to enable Tekton alpha features in our deployment. In the Tekton docs at Customizing the Pipelines Controller behavior all feature flags are described - including the Alpha Features. The docs state we should change the enable-api-fields: field from stable to alpha if we want to use those features.

The recommended way of installing Tekton Pipelines is to use kubectl apply leveraging a remotely served yaml file:

kubectl apply --filename https://storage.googleapis.com/tekton-releases/pipeline/latest/release.yaml

Inside we see the ConfigMap feature-flags (shortened):

apiVersion: v1
kind: ConfigMap
metadata:
  name: feature-flags
  namespace: tekton-pipelines
  labels:
    app.kubernetes.io/instance: default
    app.kubernetes.io/part-of: tekton-pipelines
data:
  ...
  # Setting this flag will determine which gated features are enabled.
  # Acceptable values are "stable" or "alpha".
  enable-api-fields: "stable"
  ...

Is there a way to change the enable-api-fields field to alpha somehow on-the-fly without the need to store (and in the long run maintain) the official Tekton pipeline yaml file?

CodePudding user response:

A simple combination of curl which downloads the file and pipes it into sed, which substitutes the stable to alpha works like a charm - especially since this flag is the only line including stable (except of the commentary line directly above). sed is a common tool to set dynamic values with Kubernetes yaml file.

You may test-drive it adding a grep at the end to see the lines changed with:

curl https://storage.googleapis.com/tekton-releases/pipeline/latest/release.yaml | sed "s#stable#alpha#g" | grep enable-api-fields

Now combining the command with a final kubectl apply -f - (instead of grep) will do what was asked for:

curl https://storage.googleapis.com/tekton-releases/pipeline/latest/release.yaml | sed "s#stable#alpha#g" | kubectl apply -f -

Now the officially released Tekton pipelines yaml is configured to use alpha features on-the-fly - without the need to store and maintain the ConfigMap in a custom git repository for example.

  • Related