-
Notifications
You must be signed in to change notification settings - Fork 288
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
99 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
name: arkid v2 cicd | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- v2-dev | ||
paths-ignore: | ||
- 'docs/**' | ||
- 'kustomize/**' | ||
- 'README.md' | ||
- '.github/**' | ||
jobs: | ||
dev2test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@master | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v1 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
- name: Login harbor | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: harbor.longguikeji.com | ||
username: ${{ secrets.HARBORUSER }} | ||
password: ${{ secrets.HARBORPWD }} | ||
- name: Login to Docker Hub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKERHUBUSERNAME }} | ||
password: ${{ secrets.DOCKERHUBPWD }} | ||
- id: get-short-id | ||
run: | | ||
id=$(echo ${{github.sha}}) | ||
echo "::set-output name=id::${id: 0 :8}" | ||
- run: echo "${{steps.get-short-id.outputs.id}}" | ||
- id: set-pip | ||
run: | | ||
sed -i "s@https://mirrors.aliyun.com/pypi/simple@https://pypi.python.org/simple@g" requirements.txt; | ||
sed -i "s@https://mirrors.aliyun.com/pypi/simple@https://pypi.python.org/simple@g" requirements-dev.txt; | ||
- name: Build and push dockerhub | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
platforms: linux/amd64 | ||
build-args: | | ||
DEBIAN=http://deb.debian.org/debian | ||
DEBIANSRT=http://security.debian.org/debian-security | ||
PIP="-i https://pypi.python.org/simple" | ||
push: true | ||
tags: | | ||
longguikeji/arkid:v2dev-${{ github.run_number }}-${{steps.get-short-id.outputs.id}} | ||
longguikeji/arkid:v2dev-${{ github.run_number }} | ||
longguikeji/arkid:v2dev | ||
- name: deploy to cluster dockerhub | ||
uses: steebchen/kubectl@v2.0.0 | ||
with: # defaults to latest kubectl binary version | ||
config: ${{ secrets.KUBE_CONFIG_HW }} | ||
command: -n demo-arkidv2 --insecure-skip-tls-verify=true set image --record deployment/demo-arkidv2-be cpextensionroot=longguikeji/arkid:v2dev-${{ github.run_number }} arkid-be=longguikeji/arkid:v2dev-${{ github.run_number }} | ||
- name: Build and push harbor | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
platforms: linux/amd64 | ||
build-args: | | ||
DEBIAN=http://deb.debian.org/debian | ||
DEBIANSRT=http://security.debian.org/debian-security | ||
PIP="-i https://pypi.python.org/simple" | ||
push: true | ||
tags: | | ||
${{ secrets.ARK_DEV }}/arkid:v2dev-${{ github.run_number }}-${{steps.get-short-id.outputs.id}} | ||
${{ secrets.ARK_DEV }}/arkid:v2dev-${{ github.run_number }} | ||
${{ secrets.ARK_DEV }}/arkid:v2dev | ||
longguikeji/arkid | ||
- name: deploy to cluster harbor | ||
uses: steebchen/kubectl@v2.0.0 | ||
with: # defaults to latest kubectl binary version | ||
config: ${{ secrets.KUBE_CONFIG_HW }} | ||
command: -n demo-arkidv2 --insecure-skip-tls-verify=true set image --record deployment/demo-arkidv2-be cpextensionroot=${{ secrets.ARK_DEV }}/arkid:v2dev-${{ github.run_number }} arkid-be=${{ secrets.ARK_DEV }}/arkid:v2dev-${{ github.run_number }} | ||
- name: Feishu 报忧 | ||
if: ${{ failure() }} | ||
uses: wangsijie/feishu-bot@v1 | ||
with: | ||
uuid: ${{ secrets.FEISHU_UUID }} | ||
data: | | ||
{"msg_type":"post","content":{"post":{"zh_cn":{"title":"${{ github.event.repository.name }}流水线状态通知", | ||
"content":[[{"tag":"text","text":"${{ github.event.repository.name }} 项目流水线有更新: "}, | ||
{"tag":"a","text":"${{ github.event.ref }}分支构建失败,点击查看具体日志","href":"https://github.com/${{ github.repository }}/actions/workflows/dev.yml"}]]}}}} | ||
- name: Feishu 报喜 | ||
if: ${{ success() }} | ||
uses: wangsijie/feishu-bot@v1 | ||
with: | ||
uuid: ${{ secrets.FEISHU_UUID }} | ||
data: | | ||
{"msg_type":"post","content":{"post":{"zh_cn":{"title": "${{ github.event.repository.name }}流水线状态通知", | ||
"content":[[{"tag":"text","text":"${{ github.event.repository.name }} 项目流水线有更新: "}, | ||
{"tag":"a","text":"${{ github.event.ref }}分支构建并部署成功,点击查看部署后的效果","href":"${{ secrets.ENV_DEV }}"}]]}}}} |