-
Notifications
You must be signed in to change notification settings - Fork 0
142 lines (133 loc) · 6.23 KB
/
standard-V5-arm64.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
name: standard-V5-Arm64
on:
workflow_dispatch:
inputs:
branch:
description: 'branch'
required: true
default: 'enterprise-2306'
version:
description: 'version'
default: 'enterprise-2306-arm64'
required: true
runner_token:
description: 'runner_token'
required: true
env:
VERSION: ${{ github.event.inputs.version }}
DOMESTIC_DOCKER_USERNAME: zhangq@goodrain
DOMESTIC_DOCKER_PASSWORD: ${{ secrets.DOMESTIC_DOCKER_PASSWORD }}
DOMESTIC_BASE_NAME: registry.ap-southeast-1.aliyuncs.com
DOMESTIC_NAMESPACE: goodrain-ee
BUILD_ARCH: arm64
jobs:
create-ecs:
strategy:
matrix:
server: [ runner1, runner2,runner3, runner4,runner5, runner6 ]
runs-on: 'ubuntu-22.04'
steps:
- name: Download and extract aliyun-cli
run: |
wget https://aliyuncli.alicdn.com/aliyun-cli-linux-latest-amd64.tgz
sudo tar -zxvf aliyun-cli-linux-latest-amd64.tgz -C /usr/bin/
aliyun configure set --profile akProfile --mode AK --region ap-southeast-1 --access-key-id ${{ secrets.ZQ_ALI_AKI }} --access-key-secret ${{ secrets.ZQ_ALI_AKS }}
instanceIds=($(aliyun ecs DescribeInstanceStatus --region ap-southeast-1 --PageSize 50 --RegionId 'ap-southeast-1' | jq -r '.InstanceStatuses.InstanceStatus | map(.InstanceId)[]'))
if [ ${#instanceIds[@]} -gt 5 ]; then
echo "已经有${#instanceIds[@]}台服务器,不再进行创建"
exit 0
fi
create=$(aliyun ecs RunInstances --region ap-southeast-1 --RegionId 'ap-southeast-1' --ImageId 'ubuntu_22_04_arm64_20G_alibase_20230712.vhd' --InstanceType 'ecs.c6r.xlarge' --SecurityGroupId 'sg-t4n8sj6bpvaxfe3s47po' --VSwitchId 'vsw-t4nsosaaw6fw28vpjd2n7' --SystemDisk.Category cloud_essd --Description '打包arm64发布' --InstanceChargeType PostPaid --CreditSpecification Unlimited --InternetChargeType PayByTraffic --PasswordInherit false --Password '${{ secrets.ECS_PWD }}' --UniqueSuffix true --InternetMaxBandwidthOut 100 --InternetMaxBandwidthIn 100 --SystemDisk.Size 50 --SpotStrategy SpotAsPriceGo --SpotDuration 1)
instanceId=$(echo "$create" | jq -r '.InstanceIdSets.InstanceIdSet[0]')
echo "创建服务器成功,实例ID为 $instanceId,等待5秒后开始查询公网IP"
sleep 5
# 查询服务器信息
info=$(aliyun ecs DescribeInstanceAttribute --region ap-southeast-1 --InstanceId "$instanceId")
publishIp=$(echo "$info" | jq -r '.PublicIpAddress.IpAddress[0]')
echo "查询公网IP为 $publishIp,等待60s后执行github runner"
echo "PUBLISH_IP=$publishIp" >> $GITHUB_ENV
sleep 60
- name: SSH To Server And Run Github Action Script
if: contains(env.PUBLISH_IP, '.')
uses: appleboy/ssh-action@master
with:
host: ${{ env.PUBLISH_IP }}
username: root
password: ${{ secrets.ECS_PWD }}
port: 22
script: |
export GH_TOKEN="${{ github.event.inputs.runner_token }}" && curl https://get.rainbond.com/runner-enterprise.sh | bash
build-allinone:
needs: create-ecs
runs-on: self-hosted
steps:
- name: Build the Docker image
env:
BUILD_RBD_APP_UI: false
ALLINONE: true
ROUTE_MODE: history
run: |
git clone -b ${{ github.event.inputs.branch }} --depth=1 https://pull-code:gr123465!!@git.goodrain.com/goodrain/rainbond-ui-cloud.git && cd rainbond-ui-cloud
chmod +x ./build.sh && ./build.sh
docker build -t rainbond/rainbond-ui:$VERSION .
- name: Pull code and Build allinone image
env:
TRAVIS_PULL_REQUEST: false
ADAPTOR_BRANCH: enterprise-2023
run: |
git clone -b ${{ github.event.inputs.branch }} --depth=1 https://pull-code:gr123465!!@git.goodrain.com/goodrain/rainbond-console-cloud.git && cd rainbond-console-cloud
chmod +x ./release.sh
./release.sh allinone
build-rainbond-region:
needs: create-ecs
runs-on: self-hosted
strategy:
matrix:
component: [api, chaos, gateway, monitor, mq, webcli, worker, eventlog, init-probe, mesh-data-panel, node, resource-proxy]
steps:
- name: Pull code and Build the Docker image
env:
DISABLE_GOPROXY: true
run: |
git clone -b ${{ github.event.inputs.branch }} --depth=1 https://pull-code:gr123465!!@git.goodrain.com/goodrain/rainbond.git && cd rainbond
chmod +x ./release.sh
./release.sh ${{ matrix.component }} push
build-rainbond-region-grctl-shell:
needs: create-ecs
runs-on: self-hosted
steps:
- name: Pull code and Build the Docker image
env:
DISABLE_GOPROXY: true
run: |
git clone -b ${{ github.event.inputs.branch }} --depth=1 https://pull-code:gr123465!!@git.goodrain.com/goodrain/rainbond.git && cd rainbond
chmod +x ./release.sh
./release.sh grctl push
./release.sh shell push
build-operator:
needs: create-ecs
runs-on: self-hosted
steps:
- name: Build and push
run: |
git clone -b main --depth=1 https://github.com/goodrain/rainbond-operator.git && cd rainbond-operator
chmod +x ./release.sh
./release.sh
close-ecs:
needs:
- build-allinone
- build-rainbond-region
- build-rainbond-region-grctl-shell
- build-operator
runs-on: 'ubuntu-22.04'
steps:
- name: Download and extract aliyun-cli
run: |
wget https://aliyuncli.alicdn.com/aliyun-cli-linux-latest-amd64.tgz
sudo tar -zxvf aliyun-cli-linux-latest-amd64.tgz -C /usr/bin/
aliyun configure set --profile akProfile --mode AK --region ap-southeast-1 --access-key-id ${{ secrets.ZQ_ALI_AKI }} --access-key-secret ${{ secrets.ZQ_ALI_AKS }}
instanceIds=($(aliyun ecs DescribeInstanceStatus --region ap-southeast-1 --PageSize 50 --RegionId 'ap-southeast-1' | jq -r '.InstanceStatuses.InstanceStatus | map(.InstanceId)[]'))
for id in "${instanceIds[@]}"; do
echo "开始释放云服务器: $id"
aliyun ecs DeleteInstance --region ap-southeast-1 --InstanceId "$id" --Force true --TerminateSubscription true
done