このページは、お客様の言語ではご利用いただけません。Huawei Cloudは、より多くの言語バージョンを追加するために懸命に取り組んでいます。ご協力ありがとうございました。

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

Pipeline Contexts

Updated on 2025-01-22 GMT+08:00

Contexts are a way to access information about pipeline runs, sources, variables, and jobs. Each context is an object that contains various attributes. The following table lists pipeline contexts.

Table 1 Pipeline contexts

Context

Type

Description

pipeline

object

Information about the pipeline run.

sources

object

Information about the pipeline sources in each pipeline run.

env

object

Information about the custom parameters in each pipeline run.

jobs

object

Information about jobs that have reached the final states in each pipeline run.

Context Reference Format

${{ <context>.<attribute_name> }}

context indicates the pipeline context, attribute_name indicates the attribute.

Contexts Attributes

Table 2 Context attributes

Context

Attribute

Type

Description

Example

pipeline context

pipeline

object

Information about the pipeline run. This object contains the following attributes: project_id, pipeline_id, run_number, timestamp, trigger_type, and run_id.

  • Content example

    The following example shows the pipeline context information contained in a manually executed pipeline.

    {
        "project_id": "6428c2e2b4b64affa14ec80896695c49",
        "pipeline_id": "f9981060660249a3856f46c2c402f244",
        "run_number": "168",
        "timestamp": "20231016000004",
        "trigger_type": "Manual",
        "run_id": "c2f507f93510459190b543e47f6c9bec"
    }
  • Usage example

    To obtain the triggering mode of the current pipeline, you can use the following syntax:

    ${{ pipeline.trigger_type }}

pipeline.project_id

string

ID of the project to which the current pipeline belongs. This string is the same as the predefined parameter PROJECT_ID.

pipeline.pipeline_id

string

Current pipeline ID. This string is the same as the predefined parameter PIPELINE_ID.

pipeline.run_number

string

Pipeline execution number. This string is the same as the predefined parameter PIPELINE_NUMBER.

pipeline.timestamp

string

Pipeline execution timestamp. This string is the same as the predefined parameter TIMESTAMP. The format is yyyyMMddHHmmss. For example, 20211222124301.

pipeline.trigger_type

string

Pipeline triggering type. This string is the same as the predefined parameter PIPELINE_TRIGGER_TYPE.

pipeline.run_id

string

Pipeline execution ID. This string is the same as the predefined parameter PIPELINE_RUN_ID.

sources context

sources

object

Information about the pipeline sources in each pipeline run. This object contains the following attributes: alias, repo_name, commit_id, commit_id_short, commit_message, repo_url, repo_type, repo_name, ssh_repo_url, tag, merge_id, source_branch, and target_branch.

  • Content example

    The following example shows the sources context information contained in a manually executed pipeline with a single code source. The alias of pipeline source is my_repo.

    {
        "my_repo": {
            "commit_id": "dedb73bb9abfdaab7d810f2616bae9d2b6632ecc",
            "commit_id_short": "dedb73bb",
            "commit_message": "maven0529 update pipeline0615.yml",
            "repo_url": "https://example.com/clsyz00001/maven0529.git",
            "repo_type": "codehub",
            "repo_name": "maven0529",
            "ssh_repo_url": "git@example.com:clsyz00001/maven0529.git",
            "target_branch": "master"
        }
    }
  • Usage example

    To obtain the running branch of the pipeline, you can use the following syntax:

    ${{ sources.my_repo.target_branch }}

sources.<alias>

object

Information about the pipeline source which has an alias.

sources.<repo_name>

object

Information about the pipeline source which does not have an alias but only a repository name. It contains the same information as that in sources.<alias>.

sources.<alias>.commit_id

string

The last commit ID before execution. This string is the same as the predefined parameter COMMIT_ID.

sources.<alias>.commit_id_short

string

The first 8 characters of the last commit ID before execution. This string is the same as the predefined parameter COMMIT_ID_SHORT.

sources.<alias>.commit_message

string

The commit information from the last code commit before the pipeline execution.

sources.<alias>.repo_url

string

Code repository address (HTTPS). This string is the same as the predefined parameter REPO_URL.

sources.<alias>.repo_type

string

Type of the code repository. For example, codehub, gitlab, github, gitee, and general_git.

sources.<alias>.repo_name

string

Name of the code repository.

sources.<alias>.ssh_repo_url

string

Code repository address (SSH).

sources.<alias>.tag

string

Tag name when the tag is triggered.

sources.<alias>.merge_id

string

Merge request ID when the merge request is triggered.

sources.<alias>.source_branch

string

Source branch name when the merge request is triggered.

sources.<alias>.target_branch

string

If the merge request is triggered, this string indicates the name of the target branch. Otherwise, this string indicates the name of the running branch.

env context

name

string

Name of a custom parameter.

  • Content example

    The following example shows the env context information in a run, which includes two custom parameters.

    {
        "var_1": "val1",
        "var_2": "val2"
    }
  • Usage example

    To obtain the value of the custom parameter var_1, you can use the following syntax:

    ${{ env.var_1 }}

value

string

Value of a custom parameter.

jobs context

jobs

object

Information about jobs in a pipeline. This object contains the following attributes: job_id, status, outputs, output_name, metrics, and metric_name.

  • Content example

    The following example shows the jobs context information in a run. There are two successfully executed jobs. The output of the check_job job is two metrics, and the output of the demo_job job is two general outputs.

    {
        "check_job": {
            "status": "COMPLETED",
            "metrics": {
                "critical": "0",
                "major": "0"
            }
        },
        "demo_job": {
            "status": "COMPLETED",
            "outputs": {
                "output1": "val1",
                "output2": "val2"
            }
        }
    }
  • Usage example

    To obtain the value of output1 of demo_job, you can use the following syntax:

    ${{ jobs.demo_job.outputs.output1 }}

jobs.<job_id>

object

Information about the job with a specified ID.

jobs.<job_id>.status

string

Job execution result. The value can be INIT, QUEUED, RUNNING, CANCELED, COMPLETED, FAILED, PAUSED, IGNORED, SUSPEND, or UNSELECTED.

jobs.<job_id>.outputs

object

The running value, as a key-value pair.

jobs.<job_id>.outputs.<output_name>

string

The running value name.

jobs.<job_id>.metrics

object

The running metrics of a job. For example, the number of code check issues and the test pass rate.

jobs.<job_id>.metrics.<metric_name>

string

The running metric name of a job.

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback