reposync/.devops/demo.yml

80 lines
3.2 KiB
YAML

version: 2
name: demo
description: ""
global:
concurrent: 1
trigger:
webhook: gitlink@1.0.0
event:
- ref: push
ruleset-operator: AND
workflow:
- ref: start
name: 开始
task: start
- ref: git_clone_0
name: git clone
task: git_clone@1.2.9
input:
username: ((qinxinqi.gitlink_qinxinqi_username))
password: ((qinxinqi.qinxinqi_passwd))
remote_url: '"https://gitlink.org.cn/qinxinqi/reposync.git"'
ref: '"refs/heads/master"'
commit_id: '""'
depth: 1
needs:
- start
- ref: end
name: 结束
task: end
needs:
- start_issue_sync_service
- ref: docker_image_build_0
name: docker镜像构建
task: docker_image_build@1.6.0
input:
docker_username: ((repo.aliyun_username))
docker_password: ((repo.aliyun_passwd))
image_name: '"crpi-ssgwdft90l0ewcv6.cn-hangzhou.personal.cr.aliyuncs.com/qiuzhenlin/repo"'
image_tag: '"latest"'
registry_address: '"crpi-ssgwdft90l0ewcv6.cn-hangzhou.personal.cr.aliyuncs.com"'
docker_file: '"Dockerfile"'
docker_build_path: '"."'
workspace: git_clone_0.git_path
image_push: true
build_args: '""'
needs:
- git_clone_0
- ref: ssh_cmd_0
name: ssh执行命令
task: ssh_cmd@1.1.1
input:
ssh_pass: ((repo.ssh_passwd))
ssh_ip: '"114.55.175.219"'
ssh_port: '"22"'
ssh_user: '"root"'
ssh_cmd: '"docker stop group_03_01 || true && docker rm group_03_01 || true && docker pull crpi-ssgwdft90l0ewcv6.cn-hangzhou.personal.cr.aliyuncs.com/qiuzhenlin/repo:latest && docker run -d --name group_03_01 --network host -e BOOT_MODE=app -e CEROBOT_MYSQL_HOST=localhost -e CEROBOT_MYSQL_PORT=3306 -e CEROBOT_MYSQL_USER=root -e CEROBOT_MYSQL_PWD=200915qxq -e CEROBOT_MYSQL_DB=reposyncer -e GITLINK_TOKEN=\"\" -e GITLINK_COOKIE=47e59630e29a069a4489476a5489991d50feac84 -e GITHUB_TOKEN=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 -e GITEE_TOKEN=e93fe21b329bb12c3c9c11f590fdd653 -e GITLINK_API_HOST=https://gitlink.org.cn/api/v1 -e GITHUB_API_HOST=https://api.github.com -e GITEE_API_HOST=https://gitee.com/api/v5 crpi-ssgwdft90l0ewcv6.cn-hangzhou.personal.cr.aliyuncs.com/qiuzhenlin/repo:latest && sleep 5 && docker exec group_03_01 git config --global url.\"https://qinxinqi:200915qxq@gitlink.org.cn/\".insteadOf \"https://gitlink.org.cn/\""'
needs:
- docker_image_build_0
- ref: configure_firewall
name: 配置防火墙开放8001端口
task: ssh_cmd@1.1.1
input:
ssh_pass: ((repo.ssh_passwd))
ssh_ip: '"114.55.175.219"'
ssh_port: '"22"'
ssh_user: '"root"'
ssh_cmd: '"echo \"🔥 配置防火墙开放8001端口...\" && iptables -C INPUT -p tcp --dport 8001 -j ACCEPT 2>/dev/null || iptables -I INPUT -p tcp --dport 8001 -j ACCEPT && echo \"✅ 防火墙规则已添加\" && iptables -L -n | grep 8001"'
needs:
- ssh_cmd_0
- ref: start_issue_sync_service
name: 启动Issue同步服务
task: ssh_cmd@1.1.1
input:
ssh_pass: ((repo.ssh_passwd))
ssh_ip: '"114.55.175.219"'
ssh_port: '"22"'
ssh_user: '"root"'
ssh_cmd: '"docker exec -d group_03_01 python3.9 issue_sync_web_simple.py"'
needs:
- configure_firewall