/
Frontend CI/CD Pipeline: Dependency Management Update

Frontend CI/CD Pipeline: Dependency Management Update

Overview

Previously, we were caching node_modules and using it in the next CI/CD pipeline run for frontend application deployment. Now, we have transitioned to using a Docker image that contains the latest node_modules, eliminating the need for caching.

Key Changes

  1. Static Node Modules Image: Instead of caching dependencies, we now use a prebuilt Docker image containing node_modules.

  2. No Automatic Dependency Updates: Since the image is static, any new package or dependency added to package.json will not be available unless explicitly updated in the Docker image.

  3. Dependency Updates Require DevOps Intervention: Developers must request DevOps to update the image when adding new dependencies to avoid build failures.

Process for Adding New Dependencies

Step 1: Update package.json

  • Add the required package(s) using npm install package-name --save or yarn add package-name.

  • Ensure the changes are committed and pushed to the repository.

Step 2: Notify DevOps Team

  • Raise a request to the DevOps team to update the Docker image.

  • Provide details of the new package(s) added.

  • Example message:

    "Added xyz-library in package.json. Please update the frontend dependencies Docker image to include this."

Step 3: Wait for the Updated Image

  • DevOps will build and push the updated image.

  • Once the updated image is available, the CI/CD pipeline will use it for the next deployment.

Impact and Considerations

  • Improved Build Consistency: Using a static image ensures consistent builds and avoids issues related to changing dependencies.

  • Delayed Availability of New Packages: Developers need to plan ahead and request updates before requiring new dependencies.

  • No More Cache-Related Issues: Eliminates problems related to outdated or inconsistent dependency caching.

Best Practices

  • Batch Dependency Updates: If multiple packages need to be added, request updates in batches to minimize DevOps workload.

  • Regular Image Refresh: Schedule periodic updates of the dependency image to keep up with security patches and performance improvements.

  • Verify Dependencies Before Requesting: Double-check if the package is necessary and ensure it's correctly added to package.json.

For any issues related to dependency updates or build failures, reach out to the DevOps team for assistance.

 

Sample DevOps task: https://auperator.atlassian.net/browse/DEVOPS-2475

Related content