Skip to content

standard-V5-Arm64

standard-V5-Arm64 #18

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
GIT_REPO: ${{ secrets.GIT_REPO }}
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 $GIT_REPO/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 $GIT_REPO/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 $GIT_REPO/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 $GIT_REPO/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 V5.17 --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