WalzoneInterview Prep
📞 Interviewing soon? Practice with a realistic AI mock phone interview — it calls you, then scores you. First 15 min FREE →

DevOps · Guru · question 86 of 100

Can you discuss a time you had to restructure a CI/CD pipeline to accommodate a major change in project requirements or technology stack?

📕 Buy this interview preparation book: 100 DevOps questions & answers — PDF + EPUB for $5

As a DevOps Engineer, I’ve experienced multiple instances where the restructuring of a CI/CD pipeline became crucial due to major changes in project requirements or technology stack. One such example was when working on a project that transitioned from a monolithic architecture to a microservices architecture.

Initially, the project was built as a monolithic application using Java, Maven, and a single Git repository. The CI/CD pipeline was built using Jenkins, which was configured with several stages covering code linting, unit tests, integration tests, and deployment to a staging and production environment using manual triggers.

The decision to transition to a microservices architecture came when the team recognized the benefits such as improved scalability, easier maintenance, and faster development cycles. Multiple, smaller services would each be responsible for their functionality, written in different languages (Java, Python, Node.js) and using different build tools (Maven, Gradle, npm).

This major change in the project required a complete overhaul of our CI/CD pipeline, keeping the following goals in mind:

1. Separate pipelines for each service

2. Flexibility to support different languages and build tools

3. Reduced build times and resource usage

4. Monitoring and reporting on pipeline status

After analyzing several solutions, we decided to switch to GitLab CI/CD and utilize its built-in features like YAML-based pipeline configuration, support for parallel execution and stages, and the ability to use Docker images in different stages.

The new pipeline was structured as follows:

1. **Linting**: In this stage, we used appropriate linters for each microservices’ languages (e.g., Checkstyle for Java, pylint for Python, and ESLint for JavaScript). As the microservices were using different languages, the flexibility to define linting in the .gitlab-ci.yml provided a simpler configuration.

2. **Unit Tests**: This stage ran unit tests for each microservice using the appropriate tools and frameworks (e.g., JUnit for Java, pytest for Python, and Jest for JavaScript).

3. **Integration Tests**: Each microservice ran integration tests against a testing environment using Docker Compose, which isolated the testing environment from the rest of the project. Using service dependencies and ‘waitForServices‘ in the pipeline, we ensured that all required services were up before running tests.

4. **Build & Publish Artifacts**: In this stage, artifacts were built and published to a central artifact repository. For example, Docker images were created for each microservice and pushed to a Docker registry.

5. **Deploy to Staging**: The deployment stage pulled the latest Docker images from the repository and deployed them to a staging environment using tools like Kubernetes or Amazon ECS.

6. **Manual Approval for Production**: This stage required manual intervention to approve the deployment to the production environment. The deployment to production used the same deployment mechanism as the staging environment but with different configurations and environment variables.

7. **Reporting**: Finally, we integrated the pipeline with monitoring and reporting tools to keep the team aware of the pipeline’s health and progress. Examples include sending notifications to a dedicated Slack channel or using tools like Grafana and Prometheus for analyzing pipeline metrics.

The restructuring of the CI/CD pipeline enabled the team to handle the transition to a microservices architecture efficiently, helping to build, test, and deploy each service independently while maintaining a high level of quality and confidence in the production environment. By using GitLab’s flexible pipeline configuration and its support for a wide range of languages and tools, we succeeded in accommodating the major change in our project’s technology stack.

Reading is step one. Saying it out loud is the interview. Our AI interviewer calls your phone and runs a realistic DevOps interview — then scores it.
📞 Practice DevOps — free 15 min
📕 Buy this interview preparation book: 100 DevOps questions & answers — PDF + EPUB for $5

All 100 DevOps questions · All topics