JiraCDflow
JiraCDflow
1. Overview
a) Process Introduction
Process Purpose
Automate the upgrade of SQL, configuration, and code using a workflow approach. Currently implemented for UAT environment automated upgrade process.
Main Logic
Testers enter upgrade data in the release management system. Clicking the publish button triggers image submission + triggers the jiracdflow program's /cicdflow/ API endpoint.
jiracdflow program /cicdflow/ API interaction logic with Jira The API receives request_data from the release system and triggers corresponding operations based on whether the email title field exists in the JSON data:
When email does not exist: This is a first-time upgrade. A Jira ticket is created, and the Jira webhook triggers the jiracdflow program's /cicdflow/jira/ API to run the upgrade logic.
When email exists: This is a UAT iterative upgrade. The Jira ticket data is updated, and the Jira webhook triggers the jiracdflow program's /cicdflow/jira/ API to run the upgrade logic.
jiracdflow program /cicdflow/jira API upgrade logic
New field data is obtained from the JSON data submitted by the release system; old data is retrieved from the database saved during the last upgrade
When sql_info field data is not empty or differs from the last upgrade, the Jira ticket status enters
<Pending SQL Execution>. The sql_info data is submitted to the Archery backend for DBA review and execution (review and execution permissions can be separated; subsequent execution can be delegated to ops or testers). The Jira workflow triggers<Submit SQL>to enter<SQL Executing>status, waiting for SQL execution success to be manually confirmed via<SQL Execution Successful>to proceed to the next step.
When apollo_info or config_info field data is not empty or differs from the last upgrade, the Jira workflow status enters
<CONFIG Executing>, waiting for manual configuration updates and then manually triggering<Config Upgrade Successful>to enter<CODE Executing>status.
When code_info field data is not empty or differs from the last upgrade, the Jira workflow status enters
<CODE Executing>. The program calls cmdb_api to execute the code upgrade operation. Upon successful upgrade, it automatically triggers<Code Upgrade Successful>to enter<UAT Upgrade Complete>status.
b) Prerequisites
Archery Backend Deployment Configuration Deployment host: 172.22.1.69 Deployment path: /opt/Archery-1.9.1/src/docker-compose
Jira Backend Deployment Configuration Deployment host: 172.30.2.51 Deployment path: /opt/py-project/jira-docker
jiracdflow Program Deployment Deployment host: 172.30.2.51 Deployment path: /opt/py-project/jiracdflow
2. Deployment and Configuration Guide
Application startup has no order dependency, but there are dependencies between their API calls
a) API Application: jiracdflow
Application Operations
API Operations
b)数据库审计平台:Archery
开源代码地址:https://github.com/hhyo/Archery 程序使用docker 启动,宿主机需要安装 docker、docker-compose
应用部署
配置与流程
配置相关
实例管理-实例列表 添加 UAT 数据库实例,使用对应库与账号新增
系统管理-配置项管理-系统设置
系统管理-配置项管理-工单审核流配置
系统管理-资源组管理 添加资源组:A18、A19
系统管理-其他配置管理-(用户管理|权限组管理) 添加用户:cdflow、DBA 用户 关联用户到权限组:DBA 组
流程相关
SQL 流程只需关注 SQL上线 功能的步骤 SQL上线 工单目前可以审核执行分离,DBA 审核,其他用户执行 DBA 执行工单时,通过唯一工单名称搜索所有待执行工单,按升级序号顺序执行
<等待审核人审核>状态:SQL 工单初始化提交,等待 DBA 审核。<审核通过>状态:DBA 审核通过,等待执行。<执行有异常>与<人工终止流程>状态:SQL 执行异常或人为终止流程,需要重新提交 SQL 工单。(如果同一升级中异常工单后有其他工单,其他工单暂不执行,等待新工单提交后按顺序继续执行)<已正常结束>状态:SQL 成功人工/自动执行,单个 SQL 正常执行结束。
调整源码显示前台数据
仅调试:docker exec -it archery /bin/bash 修改:使用外部持久化存储挂载覆盖文件的方式,见 docker-compose.yml 重启生效:docker restart archery
c)工作流平台:Jira
应用部署配置
开源代码路径:https://github.com/lyy289065406/jira-docker 程序使用docker 启动,宿主机需要安装 docker、docker-compose
系统配置
baseUrl:修改为与前台访问地址一致

添加电子邮件

添加 webhook:问题类型选择已新建与已更新,JQL 过滤工作流的事件 AC webhook:project = AC and issuetype in (升级) and status in (SQL待执行, SQL执行中, CONFIG执行中,CODE执行中,"开发/运维修改")
QC webhook:project = QC and issuetype in (升级) and status in (SQL待执行, SQL执行中, CONFIG执行中,CODE执行中,"开发/运维修改") 
清理 webhook:delete from ao_4aeacd_webhook_dao;
问题配置
问题类型:新建升级类型,关联问题类型方案到项目。问题类型方案设置 升级 为默认问题

工作流:新建 cdflow 工作流,关联工作流方案到项目

界面:修改界面字段配置,关联界面方案到项目

字段 + 自定义字段:新增字段,将字段关联到问题类型、项目、界面
+ 新增字段配置与字段配置方案,进行关联 
通知方案:新建通知方案,关联项目到通知方案中(通知方案通知组为新增 notice 组)

权限方案:新建权限方案,根据需求设置用户与组对项目操作的权限,关联权限方案到项目中

cdflow 工作流: 转换配置后处理功能:环境更改为 UAT 或 PRO 工作流条件限定组转换状态:DBA 组限定只能转换 SQL 状态等等
项目配置
问题类型:关联 升级 问题类型
工作流:切换工作流到自定义工作流 cdflow
域:关联到自定义字段方案
用户和作用:项目角色管理,暂不需要
权限:关联到自定义权限方案
通知:关联到自定义通知方案
用户管理
新增用户:略
新增组:通知组(用于 Jira 事件通知)、测试组、DBA 组
Reference:
Last updated