Accessing z/OS from your Tekton Pipeline

Andrew Smithson
Zowe
Published in
2 min readJul 25, 2022

{Core} Having a build pipeline for your projects makes it easy to quickly integrate new features or roll out a bug fix in a repeatable way. Recently I’ve been building pipelines in Tekton as it’s sat really well alongside some other Kubernetes based projects.

For each of the steps in the pipeline there are a range of Tasks available on the hub but if it turns out there isn’t one it’s pretty straightforward to build your own.

This is what I had to do when I needed to copy some files from my build to a zFS directory. None of the existing Tasks were the right fit, and having used The Open Mainframe Project’s Zowe CLI before for this type of thing it seemed like a good idea to integrate the two.

Building an Image

As a Tekton Task runs in a Pod, the first thing to do was to create a container image containing the CLI tooling. This turned out to be a fairly straightforward build file

The only configuration required is to turn off the use of secure storage which doesn’t play nicely in a non-interactive environment. This is achieved by putting config in the imperative.json file.

Creating the Task

As a Tekton Task is a Kubernetes native construct it is defined via a yaml file.

This can be installed into the cluster with a ‘kubectl apply -f zowe.yaml’ and then TaskRuns can be created to actually do things.

Creating a TaskRun

The above TaskRun will list all the currently running jobs. This is specified in the command in the params section. To hold the credentials for accessing the mainframe a Secret is created with the configuration files which is then mounted in at runtime.

The secret can be created using the following command in the zosmf profiles directory:

kubernetes create secret generic zowe-profile \
--from-file=profile.yaml=profile.yaml \
--from-file=zosmf_meta.yaml=zosmf_meta.yaml

Alternatively the configuration could be added as command line parameters.

With all this in place it’s now possible to integrate Zowe CLI commands into a pipeline and get that automated and repeatable interaction with z/OS.

If you’re interested in using the Zowe Task then all the source is available here https://github.com/crshnburn/zowe-tekton

Finding out more

If you enjoyed this blog, check out more at the Zowe blogs site. Zowe will also be featured in several sessions at Open Mainframe Summit, hosted virtually or in-person in Philadelphia, PA, on September 21–22. Register here.

Or, ask a question and join the conversation on the Open Mainframe Project Slack Channel #Zowe-dev, #Zowe-user or #Zowe-onboarding. If this is your first time using the slack channel register here.

--

--

Andrew Smithson
Zowe
Writer for

Software Engineer, Gamer, Musician and everything in between. All opinions are my own.