Well, let's go ahead and use Carl to check the info and health and point toward the respective information,
because this image is based on Alpina Linux, but it doesn't come with Kerl.
So for that reason will have to use the Alpine Linux package manager to install Kerl and to create a
fourth block in order to install these dependencies that are not inside an image.
So this command will install Karl, and now after it has deployed to death, we can use Colonel and
this will be the domain name and we're going to search with GRAP or, for example, the pipeline at.
And the same thing will do in the health and point we're going to search for up.
The next step would be to get the domain name in there multiple ways on how we can do that, wanted
to show you a dynamic way on how we can find out a domain name without defining a variable where you
hardcoded domain name.
The information that we are looking for is already presented after deploying the application, and you
will see here that in this Jason format, the HWC like console gets back to us and says which version
has been deployed and which is the domain name?
Its name will be the canonical name for the domain and you will see its production.
That's something we can later change it to something else and then we will not have to update our pipeline.
That will do next is to pass this June five is tracked this domain name from this property name and
set an environment variable that I'm going to use.
Then with Colonel passing, Jason industrializes typically no easy task.
So for that reason, I'm going to use an additional utility which is called JQ, and this is a Seelie
tool which enables us to quickly extract information from Jason.
Of course, in order to use JQ, you first have to install it, so using the Alpine package manager,
I'm going to install JQ.
And then in order to extract this information from here, they're going to do is I'm going to pipe this
information to JQ.
And I'm going to specify that I'm interested in the property name, as you have seen in the response
to this, and I'm going to use a flag called the output.
Now, I want to wrap this entire command and perceived output in a variable, so A.W., WCL, I will
give this to you and the response back then, this chaston response will be sent to JQ and will be part
to extract only the domain name.
Then in order to use the domain name in Kerl, we have to set it as a variable.
So the syntax in order to do that is to use SI name because this is the name of the variable that we
are going to use.
It calls the line and between parenthesis we're going to put this entire expression here.
So C name equals dollar and this is the expression.
So the way to curl Comen will look like is following, I'm going to use HTP because we need to specify
the protocol, know how to use the variable name.
And then put that recording, if you look in placement, is actuator, health and actuator info.
OK.
This will be info and the other end point will be health.
Finally, if we run this the way it is, it will still fail.
And the reason for that is when we do update environment, this comment isn't instant.
It takes a few moments for this new environment to be populated with the new version of the application
and for all the services to be restarted.
Everything that we do in the background still takes a few seconds.
I notice that the sweet point for this is around 45 seconds.
So for that reason, I'm going to use an additional sleep here that waits for 45 seconds before doing
the curl comment.
Sleep is not an ideal way to do that, you can write an additional script that may test this every five
seconds or something like that.
So using a sleep will overall make the pipeline a bit slower.
But for our case is a quick and easy way.
So if you're not super concerned about the pipeline, waiting for 45 seconds to check if the deployment
was successful, then this is absolutely no issue.
So it's going to save this and then we'll look at the pipeline.
Now, looking at a console log from the diploid job would be able to see that everything was completed
successfully.
So we have deployed version number 10 and then we look at the endpoint point.
You would be able to see that this is version number 10 and the status is up.
Everything seems to be working fine.
When you're writing any kind of tests, you always want to make sure that they fail.
So for that reason, I invite you to reduce the sleep or to remove it altogether so that you can see
the error when the version is different from what you would have expected.