使用场景
持续集成和持续交付 (Continuous integration and continuous delivery,CI/CD) 是指通过使用自动化流水线,以短周期、高频率的方式开发和交付软件的过程。CI/CD 在软件开发中很常见,并且对数据工程和数据科学也越来越重要。相比手动流程,通过自动化代码的构建、测试和部署,开发团队能够更可靠地交付版本。
WeData 使用 WeData bundle 功能实现 CI/CD 能力。使用 bundle 将 WeData 上的资源(工作流、任务、资源文件、项目参数、告警规则、事件)描述为源文件,这些文件包可以进行源代码控制,并且您可以使用外部 CI/CD 自动化(例如 GitHub Actions)来触发运行、测试和部署。
功能简介:
将项目内资源配置信息定义为 yml 文件,可通过修改 yml 文件修改资源配置信息。
提供 bundle 相关命令,可实现资源运行、测试、部署等能力。
支持在 bundle 中配置开发和生产项目信息,从而实现开发生产隔离。
可结合外部版本管控系统(如 GitHub、GitLab)实现自动化触发运行、测试、部署的能力。
功能架构

使用 bundle 开发
1. 第一步:安装并登录
1. 安装客户端。
命令行中执行安装命令:
#Install the WeData client (no installation package required, simply run the program).#macOS system installationcurl https://wedata-agent-gz-1257305158.cos.ap-guangzhou.myqcloud.com/bundle/install-script/linux/install.sh |sudo sh -s -- --region 'https://ap-guangzhou.wedata.cloud.tencent.com'#windows system installationcurl.exe -fsSL https://wedata-agent-gz-1257305158.cos.ap-guangzhou.myqcloud.com/bundle/install-script/windows/install.bat -o install.bat && install.bat --region "https://ap-guangzhou.wedata.cloud.tencent.com"
返回 Installation successful 即表示安装成功。

2. 登录客户端。
执行登录命令后将跳转到产品登录界面,完成登录后即可自动完成客户端登录。
wedata auth login
页面出现验证成功即表示客户端登录成功。

2. 第二步:初始化 bundle 包
1. 初始化并配置 bundle 包。
执行初始化 bundle 命令。
wedata bundle init
2. 配置 wedata.yml 文件。
在 wedata.yml 文件的 targets 中,修改开发环境和生产环境对应的项目 url。
mode:development表示开发环境、production表示生产环境。
host:表示某环境对应的项目 url,选择任意带地域信息和项目 ID 信息的 url 即可。
root_path:production 项目可以指定 bundle 包在 WeData Studio 存储的位置。
targets:dev:mode: developmentworkspace:host: https://wedata-studio-fusion.cloud.tencent.com/studio/clone/packages/edit/11336a82-dd7c-4ba6-b3a6-74bda71cc237?ProjectId=2998786495253803008default: trueprod:mode: productionworkspace:host: https://wedata-studio-fusion.cloud.tencent.com/studio/datadev/workflow?ProjectId=2995753587734867968root_path: /Workspace/Users/test5-auto-test1/.bundle/${bundle.name}/${bundle.target}
3. 拉取资源并绑定。
从产品中拉取需要的资源进行绑定,绑定后按需要进行本地开发(修改本地资源yml文件)。
拉取资源:拉取工作流后,会将工作流下的任务也一并拉取到本地 bundle 包中。
wedata bundle generate workflow --existing-workflow-id ${workflow_id} -t dev -p profile_name
绑定资源:
执行下面的命令绑定工作流和任务。
${resource key}:当前资源实体在本地 bundle 包中的唯一 key,在资源对应 yaml 文件下图位置。

wedata bundle deployment bind task ${resource key} ${task_id} -t dev -p profile_namewedata bundle deployment bind workflow ${resource key} ${workflow_id} -t dev -p profile_name
3. 第三步:验证、运行并部署
执行验证命令,部署前验证 bundle 包是否存在异常问题。
执行运行命令,运行任务进行验证。
执行部署命令,完成部署。
wedata bundle validate -t devwedata bundle run task ${resource key} -t dev -p profile_namewedata bundle deploy -t dev
实践教程(与 GitLab 联动实现自动触发流水线部署)
1. 第一步:安装并登录
1. 安装客户端。
命令行中执行安装命令。
#Install the WeData client (no installation package required, simply run the program).#macOS system installationcurl https://wedata-agent-gz-1257305158.cos.ap-guangzhou.myqcloud.com/bundle/install-script/linux/install.sh |sudo sh -s -- --region 'https://ap-guangzhou.wedata.cloud.tencent.com'#windows system installationcurl.exe -fsSL https://wedata-agent-gz-1257305158.cos.ap-guangzhou.myqcloud.com/bundle/install-script/windows/install.bat -o install.bat && install.bat --region "https://ap-guangzhou.wedata.cloud.tencent.com"
返回 Installation successful 即表示安装成功。

2. 登录客户端。
执行登录命令后将跳转到产品登录界面,完成登录后即可自动完成客户端登录。
wedata auth login
页面出现验证成功即表示客户端登录成功。

2. 第二步:初始化 bundle 包
1. 初始化并配置 bundle 包。
执行初始化 bundle 命令
wedata bundle init
2. 配置 wedata.yml 文件。
在 wedata.yml 文件的 targets 中,修改开发环境和生产环境对应的项目 url。
mode:development 表示开发环境、production 表示生产环境。
host:表示某环境对应的项目 url,选择任意带地域信息和项目 ID 信息的 url 即可。
root_path:production 项目可以指定 bundle 包在 WeData Studio 存储的位置。
targets:dev:mode: developmentworkspace:host: https://wedata-studio-fusion.cloud.tencent.com/studio/clone/packages/edit/11336a82-dd7c-4ba6-b3a6-74bda71cc237?ProjectId=2998786495253803008default: trueprod:mode: productionworkspace:host: https://wedata-studio-fusion.cloud.tencent.com/studio/datadev/workflow?ProjectId=2995753587734867968root_path: /Workspace/Users/test5-auto-test1/.bundle/${bundle.name}/${bundle.target}
3. 第三步:绑定 git 仓库,构建流水线
1. 构建 git 仓库,使用 git 仓库工具,将本地仓库与远端 git 仓库进行绑定。
构建远端 git 仓库,仓库包含两个分支,一个是 dev 分支,一个是 prod 分支。
这里使用的是 ugit 工具,客户也可以使用其他工具进行本地和远端仓库的绑定。

2. 配置流水线文件,并放在 git 仓库中。
编写流水线触发文件,逻辑为若向 dev 分支 push 则执行验证和部署到 dev 环境的 bundle 命令,若向 prod 分支合并则执行验证和部署到 prod 环境的 bundle 命令。
注意:
这里为系统推荐触发逻辑,您也可以按需定义所需环境及触发流水线逻辑。
对应命令如下:
dev 环境对应命令:
wedata bundle validate -t devwedata bundle deploy -t dev
prod 环境对应命令:
wedata bundle validate -t prodwedata bundle deploy -t prod
git 流水线触发文件:将当前文件放在 git 仓库的第一层目录下。
注意:
该内容需按照注释进行修改,且不同的 GitLab 版本可能存在差异,需按情况进行修改和调整才能使用。
stages:- build# The build logic of the dev branchbuild_dev:stage: buildtags:- docker #CICD machine label, modify as neededscript:- |set -exapk add --no-cache curl sudocurl https://wedata-agent-sg-1257305158.cos.ap-singapore.myqcloud.com/bundle/install-script/linux/install.sh |sudo sh -s -- --region 'https://api-ap-singapore.wedata.tencentcloud.com'#Download the client script; it needs to be modified to suit different environments.# Create configuration fileconfig_file="$HOME/.wedatacfg"if [ ! -f "$config_file" ]; thenecho "The configuration file does not exist; create a new configuration file..."echo "host =https://ap-singapore.wedata.cloud.tencent.com/studio/datadev/workflow?ProjectId=2430455587205529600" > "$config_file"#It needs to be modified to any wedata URL in the current environment.echo "secret_id =******" >> "$config_file"#current user's secret_idecho "secret_key =******" >> "$config_file"#current user's secret_keyecho "region =ap-singapore" >> "$config_file"#Modify to the corresponding areaecho "is_intl =false" >> "$config_file"echo "The content is as follows:"cat "$config_file"elseecho "Current configuration details:"cat "$config_file"ficd wedata-cicd-test/cicd_bjjr/v_vyuyudu_bjjr/# Path to the corresponding bundleecho "This is the build logic for the dev branch."wedata bundle validate -t devecho "Start pushing to the dev environment:"wedata bundle deploy -t devonly:- dev #Change to the git branch name# The construction logic of the prod branchbuild_prod:stage: buildtags:- dockerscript:- |set -exapk add --no-cache curl sudocurl https://wedata-agent-sg-1257305158.cos.ap-singapore.myqcloud.com/bundle/install-script/linux/install.sh |sudo sh -s -- --region 'https://api-ap-singapore.wedata.tencentcloud.com'#Download the client script; you'll need to modify it to suit different environments.# Create configuration fileconfig_file="$HOME/.wedatacfg"if [ ! -f "$config_file" ]; thenecho "The configuration file does not exist; create a new configuration file..."echo "host =https://ap-singapore.wedata.cloud.tencent.com/studio/datadev/workflow?ProjectId=2430455587205529600" > "$config_file"#It needs to be modified to any wedata URL in the current environment.echo "secret_id =******" >> "$config_file"echo "secret_key =******" >> "$config_file"echo "region =ap-singapore" >> "$config_file"echo "is_intl =false" >> "$config_file"echo "The content is as follows:"cat "$config_file"elseecho "Current configuration details:"cat "$config_file"ficd wedata-cicd-test/cicd_bjjr/v_vyuyudu_bjjr/echo "This is the build logic for the prod branch."wedata bundle validate -t prodecho "Start pushing to the prod environment:"wedata bundle deploy -t prodonly:- merge_requests # Triggered for merge scenarios- prod # Triggered on the prod branch
4. 第四步:dev 环境开发并提交
本地编辑器上修改 bundle 包内容来进行开发,开发完后使用 ugit 提交到 dev 分支。
提交后将自动触发流水线并将修改内容部署到 dev 环境对应的项目中。

5. 第五步:合并到 prod 分支
将 dev 分支的变动合并到 prod 分支,并自动触发流水线将修改内容部署到 prod 环境对应的项目中。



bundle 包定义
1. wedata.yml
用于定义 bundle 基础信息和 target 信息,包含内容为:
bundle 基础信息:名称、uuid、客户端版本。
include:包含文件路径,及bundle包含的资源范围,resources/*/*.yml表示 resource 下所有 yaml 文件,客户可自行定义 bundle 包的资源范围。
target:用于定义目标项目,可按需定义不同环境对应的项目。
mode:development 表示开发环境、production 表示生产环境。
host:表示某环境对应的项目 url,选择任意带地域信息和项目 ID 信息的 url 即可。
root_path:production 项目可以指定 bundle 包在 WeData Studio 存储的位置。
variables:定义在 bundle 中需要使用的参数,常用场景是不同环境对应的配置信息不同,可通过在不同环境定义不同的参数值来解决这个问题。
# This is a Wedata asset bundle definitionbundle:name: wedataBundleDemouuid: e1e95042-9e18-4806-a2e6-8de5e535881cwedata_cli_version: '0.18.*'# allow any Wedata CLI version between 0.218.0 and 1.0.0, inclusive# wedata_cli_version: '>= 0.218.0, <= 1.0.0'# Paths to match based on root directoryinclude:- resources/*/*.yml# Deploy synchronizes default+include folders that are not filtered by exclude rules, using Glob patternsync:include:- "resources/**"- "src/**"- "tests/**"exclude:- "tests/README.md"targets:dev:# The default target uses 'mode: development' to create a development copy.# - Deployed resources get prefixed with '[dev my_user_name]'# - Any job schedules and triggers are paused by default.mode: development# Specify the environment configuration for the current bundledefault: truevariables: #You can define different environment variables heretest_worker_group_id: "20241120210318772642"cluster_id: "123"workspace:# projectAddrhost: https://ap-beijing.wedata.cloud.tencent.com/studio/datadev/workflow?ProjectId=1460726726769418240# root_path: ~/.bundle/${bundle.name}/${bundle.target}# ~/ also represents the user's personal path, equivalent to root_path: /Workspace/Users/${workspace.current_user.userName}/.bundle/${bundle.name}/${bundle.target}# Note: root_path must start with '~/' or contain the current username to ensure uniqueness when using 'mode: development'prod:mode: productionvariables: #You can define different environment variables heretest_worker_group_id: "2024112021031872222"cluster_id: "111"workspace:# projectAddrhost: https://ap-beijing.wedata.cloud.tencent.com/studio/datadev/workflow?ProjectId=1460726726769418240# We explicitly deploy to /Workspace/Users/asherxu@tencent.com to make sure we only have a single copy.root_path: /Workspace/Users/demo@tencent.com/.bundle/${bundle.name}/${bundle.target}# Global custom variables, usage definition: ${var.<variable_name>}variables:test_worker_group_id:description: defaultGroupIDdefault: "20241120210318772644"type: stringcluster_id:description: defaultClusterIDdefault: "234"type: string
2. 资源实体
bundle 包中可包含的资源类型有:工作流、任务、资源文件、项目参数、告警规则、事件,下面将介绍不同资源在 bundle 中如何配置。
大部分配置与创建实体对应的 OpenAPI 中定义的入参名称完全相同,可参考 OpenAPI 中的定义。
2.1 工作流
resources:workflows:workflowResourceKey:name: workflowName# Wedata remote directoryremoteDirPath: /默认文件夹/temp/# Task ownerownerName: ownername# Workflow descriptionworkflowDesc: workflowDesc# Workflow type, cycle: cycle manual: manualworkflowType: cycle# Workflow parametersworkflowParams:paramDs: []# Scheduling cycleworkflowSchedulerConfiguration:# Time zonescheduleTimeZone: "UTC+8"# Scheduling cycle time unit: day, hourcycleStep: "1"# Task dependency: parallel, unordered serial, ordered serialselfDepend: "serial"# Effective start timestartTime: "2024-01-29 00:00:00"# Effective end timeendTime: "2099-12-31 23:59:59"# Workflow dependency, yes or nodependencyWorkflow: "no"# Delay 50 minutes from 00:00 every daydelayTime: 50# Specified runtimetaskAction: "taskAction"# Execution time left closed intervalexecutionStartTime: "00:00"# Execution time right closed intervalexecutionEndTime: "23:59"# crontabExpression cron expressioncrontabExpression: "0 0 3 * * ? *"# cycleTypecycleType: "DAY_CYCLE"
2.2 任务
不同任务类型配置项不同,以下为一个 shell 任务的示例。其他任务类型可参考对应 OpenAPI。
特殊说明:For-each 节点、离线集成任务的脚本模式和 Notebook 节点当前版本暂不支持。
resources:tasks:taskResourceKey:# Task namename: taskName# Wedata remote directoryremoteDirPath: Default/temp/# Task scriptfilePath: "../../src/task/testJDBC.sql"# Task basic attributestaskBaseAttribute:# Task type nametaskTypeName: shell# Fill in the actual workflow nameworkflowName: test_workflow# Task descriptiontaskDescription: taskDesc# Task owner nameownerName: ownerName# Task configurationtaskConfiguration:# Resource group nameresourceGroupName: test_worker_name# Specifiable running nodebrokerIp: "192.37.23.123"# Task extension property configuration listtaskExtConfigurationList:- paramKey: "specLabelConfItems" # Referenced resources, need clear documentationparamValue: "[{\\"filePath\\": \\"/asherxu/ConstellationUDF.jar\\"}, {\\"filePath\\": \\"/dw/test.zip\\"}]"- paramKey: "source_service"paramValue: "Data source name"- paramKey: "python_type"paramValue: "python3"- paramKey: "data_cluster"paramValue: "engine data cluster name"# Cluster namedataClusterName: "clusterName"# yarnQueue engine queue nameyarnQueue: "default"# Source data source name for integration tasksourceServiceName: "sourceServiceName"# Target data source name for integration tasktargetServiceName: "targetServiceName"# Scheduling parameterstaskSchedulingParameterList:- paramKey: extraInfo # Parameter nameParamValue: testVal # Parameter value# Task scheduling configurationtaskSchedulerConfiguration:# Cycle typecycleType: DAY_CYCLE# Time zonescheduleTimeZone: UTC+8# Effective datestartTime: "2025-08-26 00:00:00"# End dateendTime: "2099-12-31 23:59:59"# Execution time left closed intervalexecutionStartTime: "00:00"# Execution time right closed intervalexecutionEndTime: "23:59"# Scheduling type: 0 normal scheduling 1 dry run schedulingscheduleRunType: 0# Self-dependencyselfDepend: "serial"# Upstream dependency arrayupstreamDependencyConfigList:- taskName: "Task name"# Main dependency configurationmainCyclicConfig: "DAY"# Secondary dependency configurationsubordinateCyclicConfig: "CURRENT_DAY"# Offset in interval or list modeoffset: "0,1"# Dependency execution strategydependencyStrategy:- pollingNullStrategy: EXECUTING # Waiting for upstream task instance strategy: EXECUTING (execute); WAITING (wait)taskDependencyExecutingStrategies:- "PARENT_TIMEOUT"# Downstream task dependency on parent instance execution timeoutTaskDependencyExecutingTimeoutValue: "1"# Event listener listeventListenerList:- eventName: "test_auto111" # Event nameeventSubType: "DAY"propertiesList:- paramKey: "paramKey"paramValue: "paramValue"eventBroadcastType: "BROADCAST"# Task scheduling priority (low, middle, high)runPriority: low# Retry strategy retry wait time, unit minutes: default: 5retryWait: 5# Retry strategy maximum attempts, default: 4maxRetryAttempts: 4# Timeout handling strategy runtime timeout (unit: minutes) default is -1ExecutionTTL: -1# Timeout handling strategy total waiting time timeout (unit: minutes) default is -1waitExecutionTotalTTL: -1# Rerun & backfill configuration, default is ALLallowRedoType: ALLparamTaskOutLst:- paramKey: "paramKey"paramValue: "paramValue"paramTaskInList:- paramKey: "paramKey"# Parameter descriptionparamDesc: "paramDesc"# Parent task namefromTaskName: "taskName"# fromParamKey parent task parameter keyfromParamKey: "fromParamKey"initStrategy: "T_PLUS_0"
2.3 资源文件
resources:resourceFiles:resourceFileResourceKey:name: resourceFileName# Wedata remote directoryremoteDirPath: /fd1/test/# Parameter namefilePath: ../../src/resourceFile/datastudio-service-5.2.0.1.jar# COS bucket namebucketName: wedata-cos# COS bucket regioncosRegion: ap-shanghai
2.4 项目参数
resources:projectParams:paramResourceKey:# Parameter name keyname: paramName# Parameter descriptionparamDescription: paramDescription# Debug run valueparamDefineTest: dryRunVal# Cycle scheduling valueparamDefine: scheduleRunVal
2.5 告警规则
resources:alarms:alarmResourceKey:# Alarm namename: alarmName# Alarm rule descriptiondescription: description# List of monitored object business names (task names)monitorObjectNames:- taskName1- taskName2# Monitor type: task, workflow, projectmonitorObjectType: task# Alarm type: 1.failure alarm, 2.timeout alarm, 3.success alarm, 4.baseline breach, 5.baseline warning, 6.baseline task failure, 7.alarm monitoring, alarm type code list (default 1.failure alarm)alarmTypes:- failAlarmalarmGroups:- alarmRecipientType: Task Owner # Alarm recipient type: 1.specified personnel, 2.task owner, 3.duty roster (default 1.specified personnel)# Alarm level, 1.normal, 2.important, 3.urgent (default 1.normal)alarmLevel: normal# Alarm escalation user namesalarmEscalationRecipientNames:- asherxu@tencent.com# Alarm escalation intervalalarmEscalationInterval: 86400# Alarm user namesalarmRecipientNames:- asherxu@tencent.com# Alarm methods: 1.email, 2.SMS, 3.WeChat, 4.voice, 5.WeCom, 6.Http, 7.WeCom group, 8.Feishu group (default 1.email)alarmWays:webHooks:alarmWay: "Teams"webHooks: "http://open/group"# Alarm notification frequencynotificationFatigue:# Notification count (3 times)notifyCount: 3# Notification interval, in minutesnotifyInterval: 5# Do not disturb timequietIntervals:- daysOfWeek: [ 1, 2 ] # Days of weekstartTime: 02:00:00 # Start time, precise to hour, minute, secondendTime: 06:00:00 # End time, precise to hour, minute, second- daysOfWeek: [ 3 ] # Days of weekstartTime: 01:00:00 # Start time, precise to hour, minute, secondendTime: 05:00:00 # End time, precise to hour, minute, second# Alarm rule detailsalarmRuleDetail:# Failure trigger timing 1 - First failure trigger 2 - All retries completed trigger (default)trigger: 1# Rerun/backfill failure trigger timing 1 - First failure trigger 2 - All retries completed trigger (default)dataBackfillOrRerunTrigger: 1# Timeout configuration detailstimeOutExtInfo:- ruleType: 1 # Timeout strategy: 1.estimated runtime, 2.estimated completion time, 3.estimated scheduling time, 4.not completed within cycle, 5.total waiting time, 6.waiting runtimetype: 1 # Timeout value type 1.specified value (default) 2.average valuehour: 1 # Timeout specified value hours (default 0)min: 30 # Timeout specified value minutes (default 1)scheduleTimeZone: UTC+7 # Configured timezone, defaults to project timezone# Backfill/rerun timeout configuration detailsdataBackfillOrRerunTimeOutExtInfo:- ruleType: 1 # Timeout strategy: 1.estimated runtime, 2.estimated completion time, 3.estimated scheduling time, 4.not completed within cycle, 5.total waiting time, 6.waiting runtimetype: 1 # Timeout value type 1.specified value (default) 2.average valuehour: 1 # Timeout specified value hours (default 0)min: 30 # Timeout specified value minutes (default 1)scheduleTimeZone: UTC+7 # Configured timezone, defaults to project timezone# Project fluctuation alarm configuration detailsprojectInstanceStatisticsAlarmInfoList:alarmType: projectFailureInstanceUpwardFluctuationAlarm # Failed instance upward fluctuation alarm, successful instance downward fluctuation alarminstanceThresholdCountPercent: 10 # Percentage of failed instances for the dayinstanceThresholdCount: 20 # Total threshold: daily failed instances, daily cumulative instances, daily failed instances upward fluctuation, cumulative instances fluctuation thresholdinstanceCount: 20 # Daily cumulative instances, daily failed instances downward fluctuationstabilizeStatisticsCycle: 3 # Stability statistics cycle (anti-jitter configuration statistics cycle count)isCumulate: false # Whether to calculate cumulatively, false: consecutive, true: cumulativestabilizeThreshold: 3 # Stability count threshold (anti-jitter configuration statistics cycle count)reconciliationExtInfo:- ruleType: reconciliationFailuremismatchCount: 1hour: 1min: 30
2.6 事件
resources:events:eventResourceKey:name: eventName# Types include: MIN, HOUR, DAYeventSubType: MIN# Optional, if not filled, use default userownerName: asherxu# Event descriptiondescription: "description"# Event time to livetimeToLive: 1# Time to live unit: DAY, MINtimeUnit: DAYS# Event type: GENERAL, TIME_SERIESeventType: "TIME_SERIES"# Event broadcast type: SINGLE, BROADCASTeventBroadcastType: "BROADCAST"# Time formatdimensionFormat: "yyyymmdd"
3. src 文件
用于存储任务的代码信息和资源文件上传包。可在当前文件中进行任务代码变更或资源文件上传包变更。
bundle 命令
1. 安装&卸载客户端
1. 安装客户端。
功能:本地安装 WeData 客户端。
命令:
#Install the WeData client (no installation package required, simply run the program).#macOS system installationcurl https://wedata-agent-gz-1257305158.cos.ap-guangzhou.myqcloud.com/bundle/install-script/linux/install.sh |sudo sh -s -- --region 'https://ap-guangzhou.wedata.cloud.tencent.com'#windows system installationcurl.exe -fsSL https://wedata-agent-gz-1257305158.cos.ap-guangzhou.myqcloud.com/bundle/install-script/windows/install.bat -o install.bat && install.bat --region "https://ap-guangzhou.wedata.cloud.tencent.com"
2. 卸载客户端。
功能:本地卸载 WeData 客户端。
命令:
#Uninstall WeData client#macOS system uninstallationcurl https://wedata-agent-gz-1257305158.cos.ap-guangzhou.myqcloud.com/bundle/install-script/linux/install.sh |sudo sh -s -- --uninstall#windows system uninstallationcurl.exe -fsSL https://wedata-agent-gz-1257305158.cos.ap-guangzhou.myqcloud.com/bundle/install-script/windows/install.bat -o install.bat && install.bat --uninstall
3. 升级为最新版本。
功能:将当前安装的客户端版本升级为最高版本。
命令:
#Upgrade the currently installed client version to the latest version.sudo sh install.sh --upgrade#Update to the latest version#Singapore area#macOS system upgradecurl https://wedata-agent-sg-1257305158.cos.ap-singapore.myqcloud.com/bundle/install-script/linux/install.sh |sudo sh -s -- --upgrade --region 'https://api-ap-singapore.wedata.tencentcloud.com'#windows system upgratecurl.exe -fsSL https://wedata-agent-sg-1257305158.cos.ap-singapore.myqcloud.com/bundle/install-script/windows/install.bat -o install.bat && install.bat --upgrade --region "https://api-ap-singapore.wedata.tencentcloud.com"
4. 获取安装版本。
功能:获取当前安装的 WeData 客户端版本。
命令:
#Get the currently installed client versionwedata -vwedata--version
2. 登录
支持两种客户端登录方式:跳转产品登录验证、使用固定密钥登录。
1. 跳转产品登录验证。
第一步:本地终端输入登录页面,${workspace-url} 替换为需要登录账号下的任意项目内链接,链接中需要包含地域和项目 ID 信息。
#Both commands can be used to log in.wedata auth login --host '${workspace-url}'wedata auth login
第二步:定义登录 profile,输入登录项目 url 信息。
Please enter the new configuration file name (directly enter to use the current configuration): 这里输入 profile 名称。
Please enter the WeData project address: 若在命令中未指定项目 url,则需要在这里指定 url。
第三步:跳转到产品并登录。
完善登录命令信息后,若未在产品上登录则会跳转到登录页,您需完成登录。若已登录,则进入第三步。
第四步:首次登录需前往 访问管理 进行授权。
若为首次登录,需要按照页面指引前往访问管理模块进行授权。授权完毕后请返回登录页面并刷新页面重新验证。
2. 使用固定密钥登录。
可在访问管理中获取当前账号的 secret_id 和 secret_key ,可在 git 等产品上进行配置实现固定密钥登录。
说明:
使用跳转产品登录验证的方式,登录状态保留时间为12小时,超过12小时需重新登录。使用固定密钥方式,登录状态保留时间为永久。
3. 初始化
1. bundle init
功能:初始化一个 bundle 包,初始化的 bundle 包包含 wedata.yml 文件和资源文件。wedata.yml 文件包含 bundle 包的基础信息、target(用于定义不同环境对应项目)等信息。初始化资源可自行选择,可选工作流、任务、资源文件、项目参数、告警规则、事件,若选择则系统将默认初始化对应资源,您可按需修改资源配置。
命令:
#Initialize a bundlewedata bundle init
2. bundle generate
功能:将项目中已经创建好的资源拉取到本地 bundle 包中。仅将资源拉取到本地,并不代表跟远端资源有绑定关系,若需有绑定关系则需执行绑定命令。
说明:若通过 git 绑定方式创建的任务,则 generate 时只获取配置,不获取代码内容,代码内容改动依赖客户指定的 git 路径。
-t:目标环境。
-p:指定执行命令的profile。
#Bundle initialization related commandswedata bundle generate task --existing-task-id ${task_id} -t dev/prod -p profile_namewedata bundle generate workflow --existing-workflow-id ${workflow_id} -t dev/prod -p profile_namewedata bundle generate event --existing-event-id ${event_id} -t dev/prod -p profile_namewedata bundle generate alarm --existing-alarm-id ${alarm_id} -t dev/prod -p profile_namewedata bundle generate resourceFile --existing-resourceFile-id ${resourceFile_id} -t dev/prod -p profile_namewedata bundle generate projectParam --existing-projectParam-name ${projectParam_name} -t dev/prod -p profile_name
4. 绑定与解绑
1. bundle deployment bind
功能:将 generate 的资源与当前 bundle 包绑定,绑定后,在本地修改的能力将同步到远端。
-t:目标环境。
-p:指定执行命令的 profile。
命令:
#Resources are bound to local bundleswedata bundle deployment bind task ${resource key} ${task_id} -t dev/prod -p profile_namewedata bundle deployment bind workflow ${resource key} ${workflow_id} -t dev/prod -p profile_namewedata bundle deployment bind event ${resource key} ${event_id} -t dev/prod -p profile_namewedata bundle deployment bind alarm ${resource key} ${alarm_id} -t dev/prod -p profile_namewedata bundle deployment bind resourceFile ${resource key} ${resourceFile_id} -t dev/prod -p profile_namewedata bundle deployment bind projectParam ${resource key} ${projectParam_name} -t dev/prod -p profile_name
2. bundle deployment unbind
功能:解除资源与本地 bundle 包的绑定关系。
-t:目标环境。
-p:指定执行命令的 profile。
命令:
#Unbind resources from local bundlewedata bundle deployment unbind task ${resource key} -t dev/prod -p profile_namewedata bundle deployment unbind workflow ${resource key} -t dev/prod -p profile_namewedata bundle deployment unbind event ${resource key} -t dev/prod -p profile_namewedata bundle deployment unbind alarm ${resource key} -t dev/prod -p profile_namewedata bundle deployment unbind resourceFile ${resource key} -t dev/prod -p profile_namewedata bundle deployment unbind wedataStudio ${resource key} -t dev/prod -p profile_namewedata bundle deployment unbind projectParam ${resource key} -t dev/prod -p profile_name
5. 运行
功能:运行某个任务或某个工作流下的所有任务,执行运行情况和结果可在编排空间中查看。
-t:目标环境。
-p:指定执行命令的 profile。
命令:
wedata bundle run task ${resource key} -t dev/prod -p profile_name #Run a specific taskwedata bundle run workflow ${resource key} -t dev/prod -p profile_name #Run a specific workflow
6. 验证
功能:验证 bundle 包及其资源配置是否存在问题。可在部署前提前验证,提前发现问题并处理问题。
-t:目标环境。
-p:指定执行命令的 profile。
wedata bundle validate -t dev/prod -p profile_name #Verify bundle and resource configuration
7. 部署
功能:将 bundle包中的内容部署到目标环境。
-t:目标环境。
-p:指定执行命令的 profile。
-s:变更是否提交到调度。值为 true/false,true 表示提交到调度,false 表示仅保存编排空间保存版本。
命令:
wedata bundle deploy -t dev/prod -p profile_name -s true # Deploy the contents of the bundle to the corresponding environment
8. 销毁
功能:删除远端绑定的任务,并删除在远端存储的 bundle 包及资源信息。
-t:目标环境。
-p:指定执行命令的 profile。
命令:
wedata bundle destroy -t dev/prod -p profile_name #Destroy the contents deployed via bundle in the corresponding environment.
9. 总结
功能:获取当前 bundle 包中包含的资源信息。
-t:目标环境。
命令:
wedata bundle summary #Summary of the current package binding task status
10. 帮助
功能:获取帮助信息,即 bundle 命令的使用规则和帮助信息。
命令:
wedata bundle -help # Display command help information