66
77jobs :
88 build :
9+ if : ${{ github.repository_owner == 'HXSecurity' }}
910 runs-on : ubuntu-latest
1011 permissions :
1112 contents : write
5152 - name : Setup Ossutil
5253 uses :
manyuanrong/[email protected] 5354 with :
54- # 填写Bucket所在地域的域名信息,可参考访问域名和数据中心。
5555 endpoint : ${{ secrets.ALIYUN_OSS_ENDPOINT }}
56- # AccessKeyID
5756 access-key-id : ${{ secrets.ALIYUN_OSS_KEY_ID }}
58- # AccessKeySceret
5957 access-key-secret : ${{ secrets.ALIYUN_OSS_KEY_SECRET }}
6058 - run : |
6159 echo "${{ github.event.repository.name }},version,${{ steps.release.outputs.version }}" >> version.txt && \
@@ -68,30 +66,18 @@ jobs:
6866 [ ! -f ./dongtai-agent.jar ] && echo "$FILE does not exist."
6967 ossutil cp oss://dongtai/agent/python/ ./ --include "*.tar.gz" -r
7068 ossutil cp oss://dongtai/agent/php/ ./ --include "*.tar.gz" -r
71- #ossutil cp oss://huoqi-public/iast/release-version/DongTai-agent-python/${{ steps.release.outputs.VERSION }}/version.txt DongTai-agent-python.version.txt || true
72- #ossutil cp oss://huoqi-public/iast/release-version/DongTai-agent-java/${{ steps.release.outputs.VERSION }}/version.txt DongTai-agent-java.version.txt || true
73- #ossutil cp oss://huoqi-public/iast/release-version/DongTai-agent-php/${{ steps.release.outputs.VERSION }}/version.txt DongTai-agent-php.version.txt || true
74- #DONGTAI_JAVA_AGENT_REPONAME=`cat DongTai-agent-java.version.txt | awk '{split($0,a,",");print a[1]}' | sed -n "1p"`
75- #DONGTAI_JAVA_AGENT_VERSION=`cat DongTai-agent-java.version.txt | awk '{split($0,a,",");print a[3]}' | sed -n "1p"`
76- #DONGTAI_JAVA_AGENT_HASH=`cat DongTai-agent-java.version.txt | awk '{split($0,a,",");print a[3]}' | sed -n "2p"`
77- #DONGTAI_PYTHON_AGENT_REPONAME=`cat DongTai-agent-python.version.txt | awk '{split($0,a,",");print a[1]}' | sed -n "1p"`
78- #DONGTAI_PYTHON_AGENT_VERSION=`cat DongTai-agent-python.version.txt | awk '{split($0,a,",");print a[3]}' | sed -n "1p"`
79- #DONGTAI_PYTHON_AGENT_HASH=`cat DongTai-agent-python.version.txt | awk '{split($0,a,",");print a[3]}' | sed -n "2p"`
8069 echo "REPLACE INTO project_version_control (version, component_name, component_version_hash) VALUES('${{ steps.release.outputs.version }}', '${{ github.event.repository.name }}', '${GITHUB_SHA}');" >> ./deploy/docker/version.sql
81- #echo "REPLACE INTO project_version_control (version, component_name, component_version_hash) VALUES('$DONGTAI_JAVA_AGENT_VERSION', '$DONGTAI_JAVA_AGENT_REPONAME', '$DONGTAI_JAVA_AGENT_HASH');" >> ./deploy/docker/version.sql
82- #echo "REPLACE INTO project_version_control (version, component_name, component_version_hash) VALUES('$DONGTAI_PYTHON_AGENT_VERSION', '$DONGTAI_PYTHON_AGENT_REPONAME', '$DONGTAI_PYTHON_AGENT_HASH');" >> ./deploy/docker/version.sql
83-
70+
8471 - name : Build and push
8572 uses : docker/build-push-action@v2
8673 with :
8774 file : Dockerfile
8875 context : .
8976 push : true
9077 tags : |
91- registry.cn-beijing.aliyuncs.com/huoxian_pub/dongtai-server:latest
92- registry.cn-beijing.aliyuncs.com/huoxian_pub/dongtai-server:${{ steps.release.outputs.version }}
9378 dongtai/dongtai-server:latest
9479 dongtai/dongtai-server:${{ steps.release.outputs.version }}
80+
9581 # - uses: actions/checkout@master
9682 # - name: deploy to cluster
9783 # uses: wahyd4/kubectl-helm-action@master
@@ -107,3 +93,42 @@ jobs:
10793 with :
10894 url : ${{ secrets.DONGTAI_WEBHOOK_URL }}
10995 body : ' {"msg_type": "interactive","card": {"config": {"wide_screen_mode": true,"enable_forward": true},"elements": [{"tag": "div","text": {"content": "状态:项目${{github.repository}}构建成功\n分支:${{github.ref}}\n流程:${{github.workflow}}\n构建编号:${{github.run_number}}\n触发事件:${{github.event_name}}\n提交人:${{github.actor}}\nSHA-1:${{github.sha}}\n","tag": "lark_md"}}]}}'
96+
97+
98+ helm :
99+ name : Build
100+ runs-on : ubuntu-latest
101+
102+ steps :
103+ - name : Checkout repo
104+ uses : actions/checkout@v2
105+
106+ - uses : azure/setup-helm@v1
107+ with :
108+ version : ' latest'
109+ id : install
110+
111+ - name : Get the release version
112+ id : get_version
113+ run : echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/}
114+
115+ - name : Setup ossutil
116+ uses :
manyuanrong/[email protected] 117+ with :
118+ endpoint : ${{ secrets.CHART_OSS_ENDPOINT }}
119+ access-key-id : ${{ secrets.CHART_OSS_ACCESS_KEY_ID }}
120+ access-key-secret : ${{ secrets.CHART_OSS_ACCESS_KEY_SECRET }}
121+
122+ - name : Download existed repo files
123+ run : |
124+ ossutil cp -rf oss://dongtai-helm-charts/iast/ ~/helm/repo/ --include dongtai-iast-*.tgz --exclude "index.yaml"
125+
126+ - name : Create helm package
127+ run : |
128+ helm package deploy/kubernetes/helm -d ~/helm/repo --app-version ${{ steps.get_version.outputs.VERSION }} --version ${{ steps.get_version.outputs.VERSION }}
129+ helm repo index ~/helm/repo/ --url ${{ secrets.DONGTAI_IAST_CHART_REPO_URL }}
130+
131+ - name : Push helm chart to repo
132+ run : |
133+ ossutil cp -rf ~/helm/repo/dongtai-iast-${{ steps.get_version.outputs.VERSION }}.tgz oss://dongtai-helm-charts/iast/
134+ ossutil cp -rf ~/helm/repo/index.yaml oss://dongtai-helm-charts/iast/
0 commit comments