diff --git a/recommendations.md b/recommendations.md index 074ded3e..777d4a54 100644 --- a/recommendations.md +++ b/recommendations.md @@ -174,49 +174,22 @@ maintain it in-line. Because you have already avoided interpolation in the script, there is no real need for the script to be in-lined into the Task. -Use a ConfigMap for your script, and mount the configmap in the task. -Use a single _command:_ that executes your script (optionally with -environment variables and with parameters): +As with all configuration and code that you write as part of software +development, it is important to treat the Tasks and embedded scripts +with the same care you use for your other code. +Scripts should be maintained such that they can be versioned and tested; +therefore as a script grows beyond a few simple lines, you should store +the script in version control, and use tests and code review to maintain +it over time. At this point you may want to consider switching from a +language which does not naturally support tasking, such as bash, to one +that does, such as Python. -``` - volumes: - - name: scripts - configMap: - name: my-task-scripts - defaultMode: 0755 - steps: - - name: foo - image: myimage - volumeMounts: - - name: scripts - mountPath: /mnt/scripts - volume - command: - - /mnt/scripts/my-command.sh -``` - -This allows you to create and update your configmap from a real -script. An external script-file allows you to edit it stand-alone as -a proper script file, rather than in-lined into a tekton task yaml -file. This gives you better completion, syntax checking, and many -other benefits. You can even run the script locally. - - -``` -#!/bin/bash -# my-command.sh -echo "${PARAM_ONE-Hello world}" -``` - -To create the configmap: - -``` -kubectl create configmap my-task-scripts --from-file=my-command.sh -``` - -For bonus points, use a kustomize generator to create your task; this -allows you simple "kubectl apply -k". +At this point, the best option we have to offer is to build and publish +an image which contains your tested, versioned script, and use that image +from within your Task. This may seem like a big ask, but another way of +looking at it is that your script has graduated from just being a script +to being a tool. ## Test and verify your task code