How to pass credentials to Jenkins pipeline

Working with sensitive data is a hard thing nowadays. Especially in a DevOps methodology. New tools and ways of solving problems don’t make it easier. Well, for some reasons, DevSecOps came to life. Almost all systems need some type of credentials – password, API tokens, keys, certificates and so on. In Infrastructure as a Code, Configuration as a Code and other approaches like these mentioned, working with git repositories is necessary. But it’s a very bad practice to store credentials in a plain text. I hope that I don’t need to explain why. Luckily, most of the mature tools have Continue reading

Retry failed build in Jenkins

Failing build is not what we want to have in out Jenkins, but it happens sometimes. Not always it means that something “went terribly wrong”, but it can be a temporary problem in communication with the code repository or another, not dangerous error. In such cases, it would be great if the build could be retried in an automated way. It’s possible and very simple to implement with Jenkins. Moreover, we don’t need to create a complex configuration. Everything we need is just a plugin – Retry Failed Builds plugin. There are a lot of helpful plugins in Jenkins, and Continue reading

How to set a constant in Jenkins DSL

Working with the Jenkins DSL configuration is quite easy. But we need to remember about best practices and do some work for ourselves. Just to simplify out live. One of these things is creating good code. We should extract repeating code blocks and use them in different places. Let’s assume, that we want to create granular permissions – Alice has permissions only for Job A, but Bob has permissions for both, Job A and Job B. As you see, we have now two jobs and two users. But we don’t know when we will have to add more users. And Continue reading

Jenkins DSL Authorization Matrix loop

Authorization Matrix is one of my favorite Jenkins functionality. It allows managing permissions per Project what gives enough granularity. But when you have a lot of Projects, you can find Jenkins DSL Plugin very helpful. Especially when you start your adventures with Jenkins, those two plugins can make your life easier. As you use Jenkins, I suppose you are in love with automation. You try to automate and optimize everything. And if you read this post, it’s more than certain that you faced the same problem I had faced in my work. How to create a Jenkins DSL Authorization Matrix Continue reading

Jenkins Job DSL Playground – how it works

Working with Jenkins Job DSL code sometimes is a pain in the neck. Especially if you have very big and complex scripts. You can make a mistake very quickly, so it would be great if there could be a way to test your code before the seed deployment. Of course, you can test your DSL scripts outside of Jenkins, but sometimes you don’t need to run the whole bunch of tests, right? You just want to check only the small part of your code… What if I tell you that you can do that? Ladies and gentleman, let me introduce Continue reading

Jenkins Job DSL Playground Docker image

I have been using Jenkins Job DSL Playground since I realized that DSL is the best option for managing Jenkins jobs. If you have a lot of them, changing anything can be very painful without any automation. Jenkins DSL Plugin allows transforming configuration into the code and store that in the Git repository. But, you know, sometimes changes are very complex and you can make a mistake, hence I needed something that helps me. And I found it – Jenkins Job DSL Playground. It was obvious for me, that I can also use a docker image, but I couldn’t find Continue reading

Jenkins – unable to resolve class utilities.MyUtilities

It’s more than likely, you start trying to import external classes/files if you use Jenkins Job DSL Plugin. When your jobs grow to tens or hundreds of projects, some code will be common in some places. So, you will read the documentation, check the community forums, try to find out the best way to simplify your life. And you find it. You will find very quickly, that you can import classes from external files. Jenkins DSL uses Groovy, and Groovy is based on Java, after all, so it’s not a surprise. After you find that information you will try to Continue reading

Jenkins build priority

Jenkins has many ways of managing the job queues. We can add a static slave node, use the plugin which creates temporary nodes or just add more workers to the existing servers. But sometimes we need something else. We need a possibility to set the priority of the job. It’s not possible with additional workers or nodes, hence we should use the other way. And Priority Sorter Plugin can solve our problem. Very quickly and easy, trust me. From now, Jenkins build priority will not have any secrets! Jenkins build priority? For what?! Let’s assume such situation: We have a Continue reading

Jenkins e-mail notification with Office365

Jenkins is a great tool for automation and building the Continuous Integration and Continuous Delivery/Deployment (whatever you want) systems. But the more jobs you create, the more complicated Jenkins will be. Hence you should have some tools for monitoring whether everything is ok. The most basic way to monitor Jenkins’ jobs is e-mail notification. More and more companies choose Office365 as their e-mail service. Today I will show you how to configure Jenkins e-mail notification with Office365 because it’s not so obvious as you may think. I don’t want to show you how to configure and run Post Build Publisher, Continue reading

Free IT e-books with Jenkins

Maybe some of you know PacktPub – part of the Pack Publishing Limited Company. They publish once a day a free IT e-books, which can be saved and downloaded from the account. Every day one can download another e-book from the very big library. It’s a really really great possibility, but it has one, serious problem. We must remember to take a look at the page every day. Without this, we may miss something interesting. Moreover, manual checking is not what we want to do. You wouldn’t be there if you like doing manual things, which can be done automatically! Continue reading