Skip to content

Commit

Permalink
feat: add arm64 action
Browse files Browse the repository at this point in the history
Signed-off-by: Qi Zhang <smallqi1@163.com>
  • Loading branch information
zzzhangqi committed May 13, 2024
1 parent fd3ead7 commit 9beaf09
Show file tree
Hide file tree
Showing 4 changed files with 251 additions and 209 deletions.
143 changes: 143 additions & 0 deletions .github/workflows/standard-V5-arm64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
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
ECS: ecs.c6r.xlarge

jobs:
create-ecs:
strategy:
matrix:
server: [ runner1, runner2,runner3, runner4,runner5, runner6 ]
runs-on: self-hosted
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 '${{ vars.ECS }}' --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://rainbond-script.oss-cn-hangzhou.aliyuncs.com/runner.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
10 changes: 5 additions & 5 deletions grafana-dashboards/application/pod.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"editable": true,
"fiscalYearStartMonth": 0,
"graphTooltip": 0,
"id": 20,
"id": 17,
"links": [],
"liveNow": false,
"panels": [
Expand Down Expand Up @@ -935,7 +935,7 @@
},
"editorMode": "code",
"exemplar": false,
"expr": "sum(kube_pod_container_resource_requests_cpu_cores{pod=~\"$pod\"}) or vector(0)",
"expr": "sum(kube_pod_container_resource_requests{resource=\"cpu\", pod=~\"$pod\"}) or vector(0)",
"format": "time_series",
"instant": true,
"legendFormat": "CPU (cores)",
Expand All @@ -948,7 +948,7 @@
"uid": "${datasource}"
},
"editorMode": "code",
"expr": "sum(kube_pod_container_resource_requests_memory_bytes{pod=~\"$pod\"}) or vector(0)",
"expr": "sum(kube_pod_container_resource_requests{resource=\"memory\", pod=~\"$pod\"}) or vector(0)",
"format": "time_series",
"hide": false,
"legendFormat": "Memory",
Expand Down Expand Up @@ -1038,7 +1038,7 @@
},
"editorMode": "code",
"exemplar": false,
"expr": "sum(kube_pod_container_resource_limits_cpu_cores{pod=~\"$pod\"}) or vector(0)",
"expr": "sum(kube_pod_container_resource_limits{resource=\"cpu\", pod=~\"$pod\"}) or vector(0)",
"format": "time_series",
"instant": true,
"legendFormat": "CPU (cores)",
Expand All @@ -1051,7 +1051,7 @@
"uid": "${datasource}"
},
"editorMode": "code",
"expr": "sum(kube_pod_container_resource_limits_memory_bytes{pod=~\"$pod\"}) or vector(0)",
"expr": "sum(kube_pod_container_resource_limits{resource=\"memory\", pod=~\"$pod\"}) or vector(0)",
"format": "time_series",
"hide": false,
"legendFormat": "Memory",
Expand Down
8 changes: 4 additions & 4 deletions grafana-dashboards/cluster/cluster-overview.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"editable": true,
"fiscalYearStartMonth": 0,
"graphTooltip": 0,
"id": 6,
"id": 2,
"links": [],
"liveNow": false,
"panels": [
Expand Down Expand Up @@ -2405,7 +2405,7 @@
},
"editorMode": "code",
"exemplar": false,
"expr": "topk(10, sum(irate(container_network_receive_bytes_total{image!=\"\",name=~\"^K8S_.*\"}[2m])) by (pod))",
"expr": "topk(10, sum(irate(container_network_receive_bytes_total{image!=\"\",name=~\"^k8s_.*\"}[2m])) by (pod))",
"hide": false,
"instant": false,
"interval": "",
Expand All @@ -2423,7 +2423,7 @@
},
"editorMode": "code",
"exemplar": false,
"expr": "-topk(10, sum(irate(container_network_transmit_bytes_total{image!=\"\",name=~\"^K8S_.*\"}[2m])) by (pod))",
"expr": "-topk(10, sum(irate(container_network_transmit_bytes_total{image!=\"\",name=~\"^k8s_.*\"}[2m])) by (pod))",
"instant": false,
"interval": "",
"intervalFactor": 1,
Expand Down Expand Up @@ -3081,6 +3081,6 @@
"timezone": "",
"title": "集群监控概览",
"uid": "cluster-overview",
"version": 3,
"version": 1,
"weekStart": ""
}
Loading

0 comments on commit 9beaf09

Please sign in to comment.