Naming Steps and Using Multi-Line Commands
In this lesson we will work on the jenkins-x.yml file and discuss how to name the steps and use multi-line commands.
A quick look at the pipeline
Let’s take a quick look at the pipeline we have so far.
cd go-demo-6cat jenkins-x.yml
buildPack: gopipelineConfig:pipelines:pullRequest:build:preSteps:- command: make unittestpromote:steps:- command: ADDRESS=`jx get preview --current 2>&1` make functest
We’re extending the go
pipeline defined as a build pack by adding two steps. We’re executing unit tests (make unittest
) before the build steps, and we added functional tests as a step after those pre-defined for the promote
lifecycle. Both of those steps have issues we might want to fix.
So far, I have tried my best to hide a big problem with the execution of functional tests in our pipelines. They are executed after promotion, but there is no guarantee that our application is fully operational before we run the tests. If you create a pull request right now, without modifying the pipeline, you are likely going to experience failure. A pipeline run triggered by the creation of a pull request will fail because the functional tests are executed not when the application in a preview environment is fully up-and-running but after the “deploy” instruction is sent to Kubernetes. As you probably already know, when we execute kubectl apply
, Kube API responds with the acknowledgment that it received the instruction, not with the confirmation that the actual state converged to the desired one.
There are quite a few ways to ensure that an application is rolled out before we run tests against it. We’re using Helm so you might be thinking that --wait
should be enough. Usually, that ...