Skip to content

Create deploy_max.yaml #431

Create deploy_max.yaml

Create deploy_max.yaml #431

name: Build And Push DongTai Base Image To Aliyun Repo
on:
push:
branches:
- main
- beta
- develop
jobs:
build:
if: ${{ github.event_name == 'push' && github.repository_owner == 'HXSecurity' }}
runs-on: ubuntu-latest
strategy:
max-parallel: 4
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Aliyun
uses: docker/login-action@v1
with:
registry: ${{ secrets.TEN_REGISTRY }}
username: ${{ secrets.TEN_DOCKERHUB_USER }}
password: ${{ secrets.TEN_DOCKERHUB_PASSWORD }}
- name: Get the release version
id: version
run: echo ::set-output name=GITHUB_REF::${GITHUB_REF##*/}
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DONGTAI_DOCKERHUB_USERNAME }}
password: ${{ secrets.DONGTAI_DOCKERHUB_TOKEN }}
- name: SQL LINT
run: |
sudo apt install npm -y
sudo npm i -g sql-lint
sql-lint . trailing-whitespace || true
- name: Build Mysql only schema to local
working-directory: ./mysql
run: |
docker pull wukong.tencentcloudcr.com/dongtai/dongtai-mysql:latest
docker tag wukong.tencentcloudcr.com/dongtai/dongtai-mysql:latest wukong.tencentcloudcr.com/dongtai/dongtai-mysql:${{ steps.version.outputs.GITHUB_REF }}-latest
docker tag wukong.tencentcloudcr.com/dongtai/dongtai-mysql:latest wukong.tencentcloudcr.com/dongtai/dongtai-mysql:max-${{ steps.version.outputs.GITHUB_REF }}-latest
docker tag wukong.tencentcloudcr.com/dongtai/dongtai-mysql:latest wukong.tencentcloudcr.com/dongtai/dongtai-mysql:${{ steps.version.outputs.GITHUB_REF }}-1.0.${{github.run_number}}
docker tag wukong.tencentcloudcr.com/dongtai/dongtai-mysql:latest wukong.tencentcloudcr.com/dongtai/dongtai-mysql:max-${{ steps.version.outputs.GITHUB_REF }}-1.0.${{github.run_number}}
docker tag wukong.tencentcloudcr.com/dongtai/dongtai-mysql:latest dongtai/dongtai-mysql-unittest:1.0.${{github.run_number}}-${{ steps.version.outputs.GITHUB_REF }}
docker tag wukong.tencentcloudcr.com/dongtai/dongtai-mysql:latest dongtai/dongtai-mysql-unittest:latest
docker push wukong.tencentcloudcr.com/dongtai/dongtai-mysql:${{ steps.version.outputs.GITHUB_REF }}-latest
docker push wukong.tencentcloudcr.com/dongtai/dongtai-mysql:max-${{ steps.version.outputs.GITHUB_REF }}-latest
docker push wukong.tencentcloudcr.com/dongtai/dongtai-mysql:${{ steps.version.outputs.GITHUB_REF }}-1.0.${{github.run_number}}
docker push wukong.tencentcloudcr.com/dongtai/dongtai-mysql:max-${{ steps.version.outputs.GITHUB_REF }}-1.0.${{github.run_number}}
docker push dongtai/dongtai-mysql-unittest:1.0.${{github.run_number}}-${{ steps.version.outputs.GITHUB_REF }}
docker push dongtai/dongtai-mysql-unittest:latest
- name: Build and push logstash
uses: docker/build-push-action@v3
with:
context: ./logstash
file: ./logstash/Dockerfile
push: true
tags: |
wukong.tencentcloudcr.com/dongtai/dongtai-logstash:${{ steps.version.outputs.GITHUB_REF }}-latest
wukong.tencentcloudcr.com/dongtai/dongtai-logstash:${{ steps.version.outputs.GITHUB_REF }}-1.0.${{github.run_number}}
wukong.tencentcloudcr.com/dongtai/dongtai-logstash:max-${{ steps.version.outputs.GITHUB_REF }}-latest
wukong.tencentcloudcr.com/dongtai/dongtai-logstash:max-${{ steps.version.outputs.GITHUB_REF }}-1.0.${{github.run_number}}
- name: Build and push logrotate
uses: docker/build-push-action@v3
with:
context: ./logrotate
file: ./logrotate/Dockerfile
push: true
tags: |
wukong.tencentcloudcr.com/dongtai/dongtai-logrotate:${{ steps.version.outputs.GITHUB_REF }}-latest
wukong.tencentcloudcr.com/dongtai/dongtai-logrotate:${{ steps.version.outputs.GITHUB_REF }}-1.0.${{github.run_number}}
wukong.tencentcloudcr.com/dongtai/dongtai-logrotate:max-${{ steps.version.outputs.GITHUB_REF }}-latest
wukong.tencentcloudcr.com/dongtai/dongtai-logrotate:max-${{ steps.version.outputs.GITHUB_REF }}-1.0.${{github.run_number}}
- name: Build and push Redis
uses: docker/build-push-action@v2
with:
context: ./redis
push: true
tags: |
wukong.tencentcloudcr.com/dongtai/dongtai-redis:${{ steps.version.outputs.GITHUB_REF }}-latest
wukong.tencentcloudcr.com/dongtai/dongtai-redis:${{ steps.version.outputs.GITHUB_REF }}-1.0.${{github.run_number}}
wukong.tencentcloudcr.com/dongtai/dongtai-redis:max-${{ steps.version.outputs.GITHUB_REF }}-latest
wukong.tencentcloudcr.com/dongtai/dongtai-redis:max-${{ steps.version.outputs.GITHUB_REF }}-1.0.${{github.run_number}}
- name: deploy to cluster A
uses: tscuite/kubectl-helm-action@main
env:
MAX: false
PROJECT: mysql
TOKEN_SCA: ${{ secrets.TOKEN_SCA }}
KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_TEST_DATA }}
- name: deploy to cluster B
uses: tscuite/kubectl-helm-action@main
env:
MAX: true
PROJECT: mysql
TOKEN_SCA: ${{ secrets.MAX_TOKEN_SCA }}
KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_TEST_DATA }}