• Product Introduction
  • Quick Start
    • Importing a Git Repository
    • Starting From a Template
    • Direct Upload
    • Start with AI
  • Framework Guide
    • Frontends
      • Vite
      • React
      • Vue
      • Other Frameworks
    • Backends
    • Full-stack
      • Next.js
      • Nuxt
      • Astro
      • React Router
      • SvelteKit
      • TanStack Start
      • Vike
    • Custom 404 Page
  • Project Guide
    • Project Management
    • edgeone.json
    • Configuring Cache
    • Error Codes
  • Build Guide
  • Deployment Guide
    • Overview
    • Create Deploys
    • Manage Deploys
    • Deploy Button
    • Using Github Actions
    • Using Gitlab CI/CD
    • Using CNB Plugin
    • Using IDE PlugIn
    • Using CodeBuddy IDE
  • Domain Management
    • Overview
    • Custom Domain
    • HTTPS Configuration
      • Overview
      • Apply for Free Certificate
      • Using Managed SSL Certificate
    • Configure DNS CNAME Record
  • Observability
    • Overview
    • Metric Analysis
    • Log Analysis
  • Pages Functions
    • Overview
    • Edge Functions
    • Cloud Functions
      • Overview
      • Node Functions
  • Middleware
  • KV Storage
  • Edge AI
  • API Token
  • EdgeOne CLI
  • Pages MCP
  • Message Notification
  • Integration Guide
    • AI
      • Dialogue Large Models Integration
      • Large Models for Images Integration
    • Database
      • Supabase Integration
      • Pages KV Integration
    • Ecommerce
      • Shopify Integration
      • WooCommerce Integration
    • Payment
      • Stripe Integration
      • Integrating Paddle
    • CMS
      • WordPress Integration
      • Contentful Integration
      • Sanity Integration
      • Payload Integration
    • Authentication
      • Supabase Integration
      • Clerk Integration
  • Best Practices
    • Using General Large Model to Quickly Build AI Application
    • Use the DeepSeek model to quickly build a conversational AI site
    • Building an Ecommerce Platform with Shopify
    • Building a SaaS Site Using Supabase and Stripe
    • Building a Company Brand Site Quickly
    • How to Quickly Build a Blog Site
  • Migration Guides
    • Migrating from Vercel to EdgeOne Pages
    • Migrating from Cloudflare Pages to EdgeOne Pages
    • Migrating from Netlify to EdgeOne Pages
  • Troubleshooting
  • FAQs
  • Contact Us
  • Release Notes

Using Gitlab CI/CD

With this section guide, you can use GitLab CI/CD for automated build and deploy project to EdgeOne Pages.

Configure GitLab CI/CD Variables

1. Enter the GitLab warehouse page, click in the left menu Settings > CI/CD.
2. Unfold the Variables part and click Add variable.
3. Configure the following variables:
Key: EDGEONE_API_TOKEN
Value: API Token retrieved from EdgeOne Pages console
Type: Variable
Flags: Check Mask variable (hide variable value) and Protect variable (Option, only for protected branch usage)
Refer to the document API Token for EDGEONE_API_TOKEN retrieval.

Create a GitLab CI/CD Configuration File

Create a file named .gitlab-ci.yml in the root directory of your GitLab repository and add the following content:
stages:
- deploy

variables:
PROJECT_NAME: "my-project" # change to your project name

# Cache node_modules to speed up builds (Option)
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- node_modules/

# Scenario 1: Deploy preview URL before code merge (Preview)
# Trigger when a Merge Request is generated
deploy-preview:
image: node:22.11.0 # Select a suitable Node.js version
stage: deploy
only:
- merge_requests
script:
- npm install
- npm run build
- npx edgeone pages deploy -n $PROJECT_NAME -t $EDGEONE_API_TOKEN -e preview

# Scenario 2: Deploy trunk code change (Production)
# Trigger when code is pushed to the main branch
deploy-production:
image: node:22.11.0 # Select a suitable Node.js version
stage: deploy
only:
- main
script:
- npm install
- npm run build
- npx edgeone pages deploy -n $PROJECT_NAME -t $EDGEONE_API_TOKEN -e production

Configuration Instructions

EdgeOne CLI Deployment Command

npx edgeone pages deploy -n <project name> -t <API_TOKEN> -e <environment>
Parameter
Description
-n <project name>
EdgeOne Pages project name. If the project does not exist, it will automatically create one.
-t <API_TOKEN>
EdgeOne Pages API Token
-e <environment>
Deployment environment, selectable preview (Preview) or production (Production)

Deployment Scenario Description

Scenario
Trigger Condition
Environment Parameter
Description
preview deployment
Merge Request
-e preview
Each time an MR is generated, an independent preview URL is created for code review to view the effect
production deployment
push to the main branch
-e production
After code merge, automatic deployment to the production environment is used for official release, with high traffic and stability requirements.

Workflow

After the configuration is complete, GitLab CI/CD will automatically execute the following process:

Preview Environment (Merge Request)

1. Trigger Condition: Automatically trigger when creating or updating a Merge Request.
2. Execution Process: Dependency installation → Build project → Deploy to preview environment
3. Result: Generate a preview URL, which can be viewed in the MR to see the effect.

Production Environment (Main Branch)

1. Trigger Condition: Automatically trigger when code is pushed to the main branch.
2. Execution Process: Dependency installation → Build project → Deploy to production environment
3. Result: Update the production environment site

View Deployment Result

1. On the GitLab warehouse page, click Build > Pipelines in the left menu to view the pipeline status.
2. Click on the pipeline to view stage execution details.
3. After successful deployment, access the EdgeOne Pages console to view the deployed project and access domain.

FAQs

Q: Pipeline Execution Failed with a Permission Error Notification?

A: Please check whether the EDGEONE_API_TOKEN variable is configured correctly and ensure the TOKEN is not expired.

Q: How to Deploy to an Existing Project?

A: Just specify the existing project name with the -n parameter in the deployment command, and EdgeOne Pages will auto-update the project deployment.

References

ai-agent
You can ask me like
How to Get Started with EdgeOne Pages?