Implementing NFES Web CI/CD Pipeline with GitDev: Stages, Steps, and Configuration
This article explains how Ctrip’s NFES framework adopts a GitDev CI/CD pipeline—detailing the Install, Verify, and SonarAndImage stages, their constituent steps, and the .gitlab-ci.yml configuration—to streamline web development, improve code quality, and accelerate delivery of front‑end projects.
The NFES framework used in Ctrip’s web development faces challenges such as environment inconsistencies, lack of QA processes, fragmented build steps, and version confusion. To address these, a CI/CD solution based on GitDev pipelines was introduced.
The pipeline consists of three sequential stages: Install, Verify, and SonarAndImage. Each stage contains multiple steps that can run in parallel where appropriate.
Install Stage includes a single step that installs project dependencies and caches the resulting node_modules for later reuse, reducing redundant installations across commits.
Verify Stage comprises three steps—Lint, Test, and Build. Lint uses ESLint with recommended rules, generating an eslint-report.json artifact. Test runs unit and UI tests (Jest, Mocha, Puppeteer) and produces coverage reports; failures can block subsequent steps. Build constructs web resources, leveraging cached dependencies and a pre‑installed NFES build image to speed up compilation.
SonarAndImage Stage finalizes the pipeline. The Sonar step aggregates results from Lint and Test, uploading them to SonarQube for quality dashboards. The Image step packages the build artifacts into a Docker image, pushes it to a registry, and prepares it for deployment.
The execution order is controlled via a .gitlab-ci.yml file placed at the repository root. This file defines environment variables, stages, step dependencies, caching policies, and branch‑specific triggers. An example configuration is shown below:
# Configure base image
image: xxxxxxxxx
# Define variables
variables:
PROXY: http://proxy
HTTP_PROXY: $PROXY
# Define stage order
stages:
- Install
- Verify
# ... other stages
# Example of a step configuration
Test:
stage: Verify
artifacts:
paths:
- reports/
exclude:
- .git
- .git/**
when: always
cache:
key: keyName
paths:
- node_modules
policy: pull
allow_failure: true
dependencies:
- Install
script:
- cd /testFolder
- node index
only:
- master
# ... further configurationIn daily practice, Ctrip provides reusable CI/CD templates that generate the necessary .gitlab-ci.yml automatically, allowing teams to focus on development rather than pipeline details.
The adoption of this CI/CD workflow has centralized process management, offered transparent resource and image building, and significantly improved development efficiency across NFES projects.
Additionally, the article includes a brief recruitment notice for Ctrip’s Platform R&D Center, inviting candidates to apply via email.
Ctrip Technology
Official Ctrip Technology account, sharing and discussing growth.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.