Basically I'm trying to create a pipeline on my local Jenkins, create an image and then send to Docker Hub. Then I'll deploy this image on our local Kubernetes(Server IP:10.10.10.4).
So Jenkins pipeline script is below;
docker build -t test123/demo:$BUILD_NUMBER .
docker login --username=testuser --password=testpass
docker push test123/demo:$BUILD_NUMBER
ssh -tt root@10.10.10.4 'kubectl apply -f hybris-deployment.yaml'
So the problem is; I can tag succesfully images with $BUILD_NUMBER and push to Docker hub. Then I have to use this $BUILD_NUMBER in the Kubernetes server's YAML file and deploy it.
But I can't pass this $BUILD_NUMBER to the Kubernetes server. Somehow I should send this build number with the ssh command and use it in the YAML file as a tag.
Any idea how can I do that? Thanks!