หน้านี้ยังไม่พร้อมใช้งานในภาษาท้องถิ่นของคุณ เรากำลังพยายามอย่างหนักเพื่อเพิ่มเวอร์ชันภาษาอื่น ๆ เพิ่มเติม ขอบคุณสำหรับการสนับสนุนเสมอมา

Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Configuring a Pipeline Build Task

Updated on 2025-01-17 GMT+08:00
  • Scenario 1: If a software package is generated using Jenkins, for example, a JAR package, use the software package deployment scenario in the script. During deployment, the built software package is uploaded to the OBS bucket and the CAE component is upgraded.
  • Scenario 2: If an image package is generated using Jenkins, use the image deployment scenario in the script. During deployment, the built image package is uploaded to the SWR image repository and the CAE component is upgraded.

This section uses the scenario where the instance in Configuring a Pipeline Script is a JAR package as an example.

Creating a GitLab Credential

Use the account and password with the GitLab code repository permission to create a credential in Jenkins for pulling GitLab code.

  1. Enter http://{IP address of the Linux VM where Jenkins is installed}:8080 in the address box of the browser to log in to Jenkins.
  2. Choose Manage Jenkins > Configure System. In Configuration, select Gitlab.
  3. Click Add under Credentials and select Jenkins.
  4. Configure the GitLab account password and click Add to save the configuration.
  5. Choose Manage Jenkins > Manage Credentials to view the configured credentials.

    The unique ID is used in Configuring a Pipeline Script.

Creating a Pipeline Task

  1. Enter http://{IP address of the Linux VM where Jenkins is installed}:8080 in the address box of the browser to log in to Jenkins.
  2. Click New Item.
  3. Enter the task name, for example, test-demo, select Pipeline, and click OK.

Configuring a Build Trigger

There are two build methods:

  1. In Jenkins, click Build Now on the right of the task to trigger the pipeline task.
  2. After the code is submitted through GitLab, the Jenkins build is automatically triggered. In this mode, you can also manually trigger the build.

The second method is used as an example.

  1. Configure the Jenkins build trigger.

    1. Select Build when a change is pushed to GitLab, save the GitLab webhook URL (required when configuring GitLab webhook), and click Advanced in the lower right corner.
    2. Select Filter branches by regex and configure the build task to be triggered after the specified branch is changed. In the example, the branch name is main. Click Generate to generate a secret token and save it. The token will be used for configuring GitLab webhook.

  2. Configure GitLab webhook.

    1. Log in to GitLab and go to the code repository. In this example, the repository name is test-demo.
    2. Choose Settings > Webhooks, and set URL and Secret token to the GitLab webhook URL and secret token obtained in 1.
      Figure 1 Webhooks configuration
    3. Deselect Enable SSL verification for SSL verification and click Add webhook.
      Figure 2 Configuration completed

Configuring a Pipeline Script

A pipeline script is a build command that runs during build. For details about script parameters, see Table 1.

Table 1 Pipeline script parameters

Parameter

Mandatory

Type

Description

git_url

Yes

String

Address of the GitLab code repository.

credentials_id

Yes

String

GitLab credential ID configured using the account password. For details, see Creating a GitLab Credential.

branch_name

Yes

String

Name of the GitLab code repository branch.

maven

Yes

String

Path of the executable file for Maven installation, for example, /root/app/maven/apache-maven-3.8.6/bin/mvn.

deploy_shell

Yes

String

Path for storing the deploy.sh script on the VM where Jenkins is located, for example, /root/jar/deploy.sh. For details, see deploy.sh Description.

build_target_name

Yes

String

Build product name: software package name or image name:version number. This parameter is transferred when the script is executed. In the software package deployment scenario, the value is the software package name. In the image deployment scenario, the value is the built image name:version number.

  1. After the build trigger is configured, select Pipeline script from the drop-down list on the Pipeline tab.
  2. Configure the pipeline script. In the example, the JAR package build scenario is used. The script is as follows:

    node {
        // Define the code repository address.
        def git_url = 'http://100.**.**.207:8090/test/test-demo.git'
        // GitLab credential ID.
        def credentials_id = '133b7c9a-eb6a-4484-84b3-c3509ed63df8'
        // Name of the GitLab code repository branch.
        def branch_name = 'main'
        // Path of the executable file for installing Maven.
        def maven = '/root/app/maven/apache-maven-3.8.6/bin/mvn'
        // Path for storing the deploy.sh script. You need to set the execute permission on the path.
        def deploy_shell = '/root/jar/deploy.sh'
        // (Mandatory) Build product name: software package name or image name. This parameter is transferred when the script is executed.
        def build_target_name = "cae-demo-1.0-SNAPSHOT.jar"
     
        stage('Clone sources') {
            git branch: branch_name, credentialsId: credentials_id, url: git_url
        }
        stage('Build') {
            //Build a JAR package.
            sh "'$maven' clean package -Dmaven.test.failure.ignore=true"
        }
        stage('deploy') {
            // Execute the script and use the build product to upgrade the CAE component. The timeout interval is 5 minutes.
    sh "timeout 300s '$deploy_shell' '$build_target_name'"
        }
    }
    NOTE:
    • During pipeline script running, deploy.sh is invoked. For details about the script, see deploy.sh Description.
    • Set deploy.sh as an executable file.

เราใช้คุกกี้เพื่อปรับปรุงไซต์และประสบการณ์การใช้ของคุณ การเรียกดูเว็บไซต์ของเราต่อแสดงว่าคุณยอมรับนโยบายคุกกี้ของเรา เรียนรู้เพิ่มเติม

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback