Jenkins is the way to drink coffee all day

Hook Automation

Submitted By Jenkins User Alex Kondrashov

Saving time and fixing an Azure bug with Jenkins pipeline.

Company: CET, https://home.cet.ac.il/; Project website: https://ebag.cet.ac.il/

Industry:  Education

Programming Language: Python, Power-shell

Platform: Linux, Windows

Version Control System: GitHub

Build Tool: Maven

Team Members: Dennis, Team Lead; Robert, DevOps

Community Support: Spoke with colleagues and peers

Proactive developer solves integration problem with Jenkins.

Background:  I work for the Center for Educational Technology (CET) in Israel on a team that supports the development of state-of-the-art textbooks and digital content. As a DevOps practitioner, it’s essential for me to discover smarter and faster ways of implementing all things DevOps. It’s also important to share what we learn with the community. Let me tell you about a solution I discovered for updating a hook configuration in Azure Development via an API script for PowerShell. 

Goals: Global change multiple hooks in Azure Development with Jenkins.

“For now, we have a solution in Jenkins to change parameters in all of our hooks.”
Alex Kondrashov, DevOps

Solution & Results:  We have about 250 hooks in Azure Dev at the moment. When developers “checkin” their code, the hook automatically runs the job, and Jenkins deploys the code to the servers.

After the last update to Jenkins, all hooks stopped working. We needed to change the basic password to a token because of security measures. For this, we had two solutions for change: 

  1. To do it manually, which would take about 8 hours, or
  2. Write a script with an Azure API to automate password change

Knowing that a token can live one year, I started to work on an API solution. However, I found a bug in Azure API after the ‘changed password to token hooks’ didn’t work and opened a Microsoft support ticket. After one month of talking to support agents, they told me that “changing the password is not possible via the Rest API.” Frustrated, I tried one more solution: I changed the basic user password to the same token. And it started to work!

I hope this helps someone avoid what I went through. I was happy that using Jenkins pipeline:

  • offered a solution for fix Bug on Azure Dev
  • helped me change all parameters in settings Azure hooks
  • saved me a full day of work!

Like what you see? Share your Jenkins user story today.

Jenkins® is a CD Foundation project and a registered trademark of Software in the Public Interest, Inc. Copyright Jenkins 2020