From 331c516e8b254670443d65b84bbe9f37a48b4d07 Mon Sep 17 00:00:00 2001 From: Xuannan Date: Tue, 12 Oct 2021 18:11:42 +0800 Subject: [PATCH] [AIFlow] Add github workflow to publish aiflow docker image (#649) * [AIFlow] Add github workflow to publish aiflow docker image (#636) * [AIFlow] Add github workflow to publish aiflow docker image * [Airflow] Allow setting image repo and image tag * [Airflow] Lint ignore frontend node_modules * [AIFlow] Ignore Lint and license check for ai_flow/frontend/dist (cherry picked from commit 6150da73c72a2225b0409d48146c48a36a4242dc) * [AIFlow] Fix AIFlow Image publish ci (#647) (cherry picked from commit 9b70ebcdad9b1b2d0599bf2d2486f235e00bb6b2) --- .github/workflows/flink_ai_flow_ci.yml | 6 ++- .github/workflows/publish_ai_flow_image.yaml | 48 ++++++++++++++++++++ flink-ai-flow/pom.xml | 1 + 3 files changed, 53 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/publish_ai_flow_image.yaml diff --git a/.github/workflows/flink_ai_flow_ci.yml b/.github/workflows/flink_ai_flow_ci.yml index e240d3a75..48cb03c46 100644 --- a/.github/workflows/flink_ai_flow_ci.yml +++ b/.github/workflows/flink_ai_flow_ci.yml @@ -38,9 +38,11 @@ jobs: - name: Lint with flake8 run: | # stop the build if there are Python syntax erroservice.pys or undefined names - flake8 flink-ai-flow --count --select=E9,F63,F7,F82 --show-source --statistics + flake8 flink-ai-flow --count --select=E9,F63,F7,F82 --show-source --statistics \ + --exclude flink-ai-flow/ai_flow/frontend/node_modules,flink-ai-flow/ai_flow/frontend/dist # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - flake8 flink-ai-flow --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + flake8 flink-ai-flow --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics \ + --exclude flink-ai-flow/ai_flow/frontend/node_modules,flink-ai-flow/ai_flow/frontend/dist - name: Test with pytest run: | /bin/bash flink-ai-flow/run_tests.sh \ No newline at end of file diff --git a/.github/workflows/publish_ai_flow_image.yaml b/.github/workflows/publish_ai_flow_image.yaml new file mode 100644 index 000000000..10edaa0ae --- /dev/null +++ b/.github/workflows/publish_ai_flow_image.yaml @@ -0,0 +1,48 @@ +name: Publish AIFlow Docker Image + +on: + workflow_dispatch: + inputs: + image_repository: + description: 'Image Repository' + required: false + default: 'flinkaiflow/flink-ai-flow-dev' + image_tag: + description: 'Image Tag' + required: false + default: '' + schedule: + - cron: '0 16 * * *' + +jobs: + push_to_registry: + name: Push Docker image + runs-on: ubuntu-latest + steps: + - name: Check out the repo + uses: actions/checkout@v2 + + - name: Set variables + env: + DEFAULT_IMAGE_REPO: 'flinkaiflow/flink-ai-flow-dev' + run: | + IMAGE_REPO=${{ github.event.inputs.image_repository || env.DEFAULT_IMAGE_REPO }} + IMAGE_TAG=${{ github.event.inputs.image_tag }} + [ -z ${IMAGE_TAG} ] && IMAGE_TAG=${GITHUB_REF##*/}-`echo ${GITHUB_SHA} | cut -c1-8` + echo "IMAGE_REPO=${IMAGE_REPO}" >> $GITHUB_ENV + echo "IMAGE_TAG=${IMAGE_TAG}" >> $GITHUB_ENV + + - name: Log in to to docker registry + run: | + docker login --username=${{ secrets.IMAGE_REGISTRY_USERNAME }} --password=${{ secrets.IMAGE_REGISTRY_PASSWORD }} ${{ secrets.LOGIN_REGISTRY }} + + - name: Build Image + run: | + cd ./flink-ai-flow + echo building image with repo: ${{ env.IMAGE_REPO }} tag: ${{ env.IMAGE_TAG }} + bash build_docker_image.sh ${{ env.IMAGE_REPO }}:${{ env.IMAGE_TAG }} + + - name: Push Image + run: | + echo pushing ${{ env.IMAGE_REPO }}:${{ env.IMAGE_TAG }} + docker push ${{ env.IMAGE_REPO }}:${{ env.IMAGE_TAG }} \ No newline at end of file diff --git a/flink-ai-flow/pom.xml b/flink-ai-flow/pom.xml index 47c24b039..843686910 100644 --- a/flink-ai-flow/pom.xml +++ b/flink-ai-flow/pom.xml @@ -112,6 +112,7 @@ ai_flow/java/client/target/**/* ai_flow/java/.idea/**/* ai_flow/frontend/node_modules/**/* + ai_flow/frontend/dist/**/*