You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@linkis.apache.org by ca...@apache.org on 2022/07/22 09:47:27 UTC

[incubator-linkis] branch dev-1.3.0 updated: Support git action and add publish-docker.yaml (#2478)

This is an automated email from the ASF dual-hosted git repository.

casion pushed a commit to branch dev-1.3.0
in repository https://gitbox.apache.org/repos/asf/incubator-linkis.git


The following commit(s) were added to refs/heads/dev-1.3.0 by this push:
     new dadbe6a9f Support git action and add publish-docker.yaml  (#2478)
dadbe6a9f is described below

commit dadbe6a9fa26d2fac0a10b22ea2f5fc90fce5d5d
Author: jack tao <79...@qq.com>
AuthorDate: Fri Jul 22 17:47:23 2022 +0800

    Support git action and add publish-docker.yaml  (#2478)
    
    * 1.delete Jenkinsfile
    2.add publish-docker.yaml
    
    * add build.type params
    
    * adjust apache rat check exclude configuration for module linkis-web (#2499)
    Co-authored-by: Casion <ca...@gmail.com>
---
 .github/workflows/publish-docker.yaml |  85 +++++++++---------
 Jenkinsfile                           | 165 ----------------------------------
 2 files changed, 45 insertions(+), 205 deletions(-)

diff --git a/.github/workflows/publish-docker.yaml b/.github/workflows/publish-docker.yaml
index 77812510b..6d28cff60 100644
--- a/.github/workflows/publish-docker.yaml
+++ b/.github/workflows/publish-docker.yaml
@@ -15,66 +15,71 @@
 # limitations under the License.
 #
 
-name: Build
-
-on:
-  push:
+name: publish-docker
+on: 
+  create:
     branches:
-      - dev-1.3.0
+      - release-**
 jobs:
-  build:
+  publish-docker:
     runs-on: ubuntu-latest
- 
+    strategy:
+      matrix:
+        node-version: [14.17.3]
+    timeout-minutes: 90
+    env:
+      TAG: ${{ github.sha }}
+      SKIP_TEST: true
+      HUB: ghcr.io/apache/incubator-linkis
+      LINKIS_VERSION: 1.3.0
     steps:
     - name: Checkout
       uses: actions/checkout@v2
+    - id: commit
+      uses: pr-mpt/actions-commit-hash@v1
     - name: Set up JDK 8
       uses: actions/setup-java@v2
       with:
         distribution: 'adopt'
         java-version: 8
+    - name: Cache local Maven repository
+      uses: actions/cache@v2
+      with:
+        path: ~/.m2/repository
+        key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
+        restore-keys: |
+          ${{ runner.os }}-maven-
     - name: Use Node.js ${{ matrix.node-version }}
       uses: actions/setup-node@v2
       with:
         node-version: ${{ matrix.node-version }}
-    - name: Build backend by maven
-      run: |
-          ./mvnw -N install
-          ./mvnw clean package
+    - name: Set up QEMU
+      uses: docker/setup-qemu-action@v1
+    - name: Set up Docker Buildx
+      uses: docker/setup-buildx-action@v1
     - name: Build frontend by node.js
       run: |
           cd web
-          sed -i \'/VUE_APP_MN_CONFIG_PREFIX/d\' .env
+          sed -i "/VUE_APP_MN_CONFIG_PREFIX/d" .env
           npm install
           npm run build
-    - name: Build Docker Image
+    - name: Build backend by maven
       run: |
-        docker build -f k8s/Dockerfile/linkis-mg-gateway.Dockerfile -t linkis-mg-gateway:1.2 ./assembly-combined-package/target/apache-linkis-1.1.0-incubating-bin/linkis-package
-        docker build -f k8s/Dockerfile/linkis-mg-eureka.Dockerfile -t linkis-mg-gateway:1.2 ./assembly-combined-package/target/apache-linkis-1.1.0-incubating-bin/linkis-package
-        docker build -f k8s/Dockerfile/linkis-ps-publicservice.Dockerfile -t linkis-ps-publicservice:1.2 ./assembly-combined-package/target/apache-linkis-1.1.0-incubating-bin/linkis-package
-        docker build -f k8s/Dockerfile/linkis-ps-cs.Dockerfile -t linkis-ps-cs:1.2 ./assembly-combined-package/target/apache-linkis-1.1.0-incubating-bin/linkis-package
-        docker build -f k8s/Dockerfile/linkis-cg-linkismanager.Dockerfile -t linkis-cg-linkismanager:1.2 ./assembly-combined-package/target/apache-linkis-1.1.0-incubating-bin/linkis-package
-        docker build -f k8s/Dockerfile/linkis-cg-entrance.Dockerfile -t linkis-cg-entrance:1.2 ./assembly-combined-package/target/apache-linkis-1.1.0-incubating-bin/linkis-package
-        docker build -f k8s/Dockerfile/linkis-cg-engineplugin.Dockerfile -t linkis-cg-engineplugin:1.2 ./assembly-combined-package/target/apache-linkis-1.1.0-incubating-bin/linkis-package
-        docker build -f k8s/Dockerfile/linkis-cg-engineconnmanager.Dockerfile -t linkis-cg-engineconnmanager:1.2 ./assembly-combined-package/target/apache-linkis-1.1.0-incubating-bin/linkis-package
-        docker build -f k8s/Dockerfile/linkis-web.Dockerfile -t linkis-web:1.2.0 ./web
+          ./mvnw -N install
+    - name: Build backend by maven
+      run: |
+          ./mvnw install -Pdocker -Dmaven.javadoc.skip=true -Dmaven.test.skip=true -Dlinkis.build.web=true -Dimage.build.type=release
+    - name: Log in to the Container registry
+      uses: docker/login-action@v1.10.0
+      with:
+        registry: ${{ env.HUB }}
+        username: ${{ github.actor }}
+        password: ${{ secrets.GITHUB_TOKEN }}
     - name: Push Docker Image
+      env: 
+        DOCKER_VERSION: ${{ github.ref_name }}-${{ steps.commit.outputs.short }}
       run: |
-        docker tag linkis-mg-gateway:1.2.0 registry.mydomain.com/library/linkis-mg-gateway:1.2.0
-        docker push registry.mydomain.com/library/linkis-mg-gateway:1.2.0
-        docker tag linkis-mg-eureka:1.2.0 registry.mydomain.com/library/linkis-mg-eureka:1.2.0
-        docker push registry.mydomain.com/library/linkis-mg-eureka:1.2.0
-        docker tag linkis-ps-publicservice:1.2.0 registry.mydomain.com/library/linkis-ps-publicservice:1.2.0
-        docker push registry.mydomain.com/library/linkis-ps-publicservice:1.2.0
-        docker tag linkis-ps-cs:1.2.0 registry.mydomain.com/library/linkis-ps-cs:1.2.0
-        docker push registry.mydomain.com/library/linkis-ps-cs:1.2.0
-        docker tag linkis-cg-linkismanager:1.2.0 registry.mydomain.com/library/linkis-cg-linkismanager:1.2.0
-        docker push registry.mydomain.com/library/linkis-cg-linkismanager:1.2.0
-        docker tag linkis-cg-entrance:1.2.0 registry.mydomain.com/library/linkis-cg-entrance:1.2.0
-        docker push registry.mydomain.com/library/linkis-cg-entrance:1.2.0
-        docker tag linkis-cg-engineplugin:1.2.0 registry.mydomain.com/library/linkis-cg-engineplugin:1.2.0
-        docker push registry.mydomain.com/library/linkis-cg-engineplugin:1.2.0
-        docker tag linkis-cg-engineconnmanager:1.2.0 registry.mydomain.com/library/linkis-cg-engineconnmanager:1.2.0
-        docker push registry.mydomain.com/library/linkis-cg-engineconnmanager
-        docker tag linkis-web:1.2.0 registry.mydomain.com/library/linkis-web:1.2.0
-        docker push registry.mydomain.com/library/linkis-web:1.2.0
+        docker tag linkis:${{ env.LINKIS_VERSION }} ${{ env.HUB }}/library/linkis:${{ env.DOCKER_VERSION }}
+        docker push ${{ env.HUB }}/library/linkis:${{ env.DOCKER_VERSION }}
+        docker tag linkis-web:${{ env.LINKIS_VERSION }} ${{ env.HUB }}/library/linkis-web:${{ env.DOCKER_VERSION }}
+        docker push ${{ env.HUB }}/library/linkis-web:${{ env.DOCKER_VERSION }}
diff --git a/Jenkinsfile b/Jenkinsfile
deleted file mode 100644
index 9cdea7525..000000000
--- a/Jenkinsfile
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- * 
- *   http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-pipeline {
-  agent {
-    node {
-      label 'node2'
-    }
-
-  }
-  stages {
-    stage('build package') {
-      steps {
-        echo 'start build'
-        sh '''source /etc/profile
-mvn -N install
-mvn clean install -DskipTests
-'''
-      }
-    }
-
-    stage('build image') {
-      steps {
-        echo 'Build Docker Image Stage'
-        sh '''docker build -f k8s/Dockerfile/linkis-mg-gateway.Dockerfile -t linkis-mg-gateway:1.2.0 ./assembly-combined-package/target/apache-linkis-1.1.0-incubating-bin/linkis-package
-
-docker build -f k8s/Dockerfile/linkis-mg-eureka.Dockerfile -t linkis-mg-gateway:1.2.0 ./assembly-combined-package/target/apache-linkis-1.1.0-incubating-bin/linkis-package
-
-docker build -f k8s/Dockerfile/linkis-ps-publicservice.Dockerfile -t linkis-ps-publicservice:1.2.0 ./assembly-combined-package/target/apache-linkis-1.1.0-incubating-bin/linkis-package
-
-docker build -f k8s/Dockerfile/linkis-ps-cs.Dockerfile -t linkis-ps-cs:1.2.0 ./assembly-combined-package/target/apache-linkis-1.1.0-incubating-bin/linkis-package
-
-docker build -f k8s/Dockerfile/linkis-cg-linkismanager.Dockerfile -t linkis-cg-linkismanager:1.2.0 ./assembly-combined-package/target/apache-linkis-1.1.0-incubating-bin/linkis-package
-
-docker build -f k8s/Dockerfile/linkis-cg-entrance.Dockerfile -t linkis-cg-entrance:1.2.0 ./assembly-combined-package/target/apache-linkis-1.1.0-incubating-bin/linkis-package
-
-docker build -f k8s/Dockerfile/linkis-cg-engineplugin.Dockerfile -t linkis-cg-engineplugin:1.2.0 ./assembly-combined-package/target/apache-linkis-1.1.0-incubating-bin/linkis-package
-
-docker build -f k8s/Dockerfile/linkis-cg-engineconnmanager.Dockerfile -t linkis-cg-engineconnmanager:1.2.0 ./assembly-combined-package/target/apache-linkis-1.1.0-incubating-bin/linkis-package
-
-docker build -f k8s/Dockerfile/linkis-ps-metadatamanager.Dockerfile -t linkis-ps-metadatamanager:1.2.0 ./assembly-combined-package/target/apache-linkis-1.1.0-incubating-bin/linkis-package
-
-docker build -f k8s/Dockerfile/linkis-ps-data-source-manager.Dockerfile -t linkis-ps-data-source-manager:1.2.0 ./assembly-combined-package/target/apache-linkis-1.1.0-incubating-bin/linkis-package
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-'''
-        sh '''cd web
-sed -i \'/VUE_APP_MN_CONFIG_PREFIX/d\' .env
-yarn
-yarn build
-cd ..
-docker build -f k8s/Dockerfile/linkis-web.Dockerfile -t linkis-web:1.2.0 .
-
-'''
-      }
-    }
-
-    stage('push image') {
-      steps {
-        sh '''docker tag linkis-mg-gateway:1.2.0 registry.mydomain.com/library/linkis-mg-gateway:1.2.0
-docker push registry.mydomain.com/library/linkis-mg-gateway:1.2.0
-
-docker tag linkis-mg-eureka:1.2.0 registry.mydomain.com/library/linkis-mg-eureka:1.2.0
-docker push registry.mydomain.com/library/linkis-mg-eureka:1.2.0
-
-docker tag linkis-ps-publicservice:1.2.0 registry.mydomain.com/library/linkis-ps-publicservice:1.2.0
-docker push registry.mydomain.com/library/linkis-ps-publicservice:1.2.0
-
-docker tag linkis-ps-cs:1.2.0 registry.mydomain.com/library/linkis-ps-cs:1.2.0
-docker push registry.mydomain.com/library/linkis-ps-cs:1.2.0
-
-docker tag linkis-cg-linkismanager:1.2.0 registry.mydomain.com/library/linkis-cg-linkismanager:1.2.0
-docker push registry.mydomain.com/library/linkis-cg-linkismanager:1.2.0
-
-docker tag linkis-cg-entrance:1.2.0 registry.mydomain.com/library/linkis-cg-entrance:1.2.0
-docker push registry.mydomain.com/library/linkis-cg-entrance:1.2.0
-
-docker tag linkis-cg-engineplugin:1.2.0 registry.mydomain.com/library/linkis-cg-engineplugin:1.2.0
-docker push registry.mydomain.com/library/linkis-cg-engineplugin:1.2.0
-
-docker tag linkis-cg-engineconnmanager:1.2.0 registry.mydomain.com/library/linkis-cg-engineconnmanager:1.2.0
-docker push registry.mydomain.com/library/linkis-cg-engineconnmanager
-
-docker tag linkis-web:1.2.0 registry.mydomain.com/library/linkis-web:1.2.0
-docker push registry.mydomain.com/library/linkis-web:1.2.0
-
-
-docker tag linkis-ps-data-source-manager:1.2.0 registry.mydomain.com/library/linkis-ps-data-source-manager:1.2.0
-docker push registry.mydomain.com/library/linkis-ps-data-source-manager:1.2.0
-
-
-docker tag linkis-ps-metadatamanager:1.2.0 registry.mydomain.com/library/linkis-ps-metadatamanager:1.2.0
-docker push registry.mydomain.com/library/linkis-ps-metadatamanager:1.2.0'''
-      }
-    }
-
-    stage('deploy on k8s') {
-      steps {
-        echo 'deploy on k8s'
-        sh '''kubectl delete -f k8s/yaml/configmap/linkis-configmap.yaml --namespace=preprod
-kubectl delete -f k8s/yaml/configmap/hadoop-configmap.yaml --namespace=preprod
-kubectl delete -f k8s/yaml/configmap/hive-configmap.yaml --namespace=preprod
-kubectl delete -f k8s/yaml/configmap/spark-configmap.yaml --namespace=preprod
-kubectl delete -f k8s/yaml/linkis-mg-gateway.yaml --namespace=preprod
-kubectl delete -f k8s/yaml/linkis-mg-eureka.yaml --namespace=preprod
-kubectl delete -f k8s/yaml/linkis-ps-publicservice.yaml --namespace=preprod
-kubectl delete -f k8s/yaml/linkis-ps-cs.yaml --namespace=preprod
-kubectl delete -f k8s/yaml/linkis-ps-metadatamanager.yaml --namespace=preprod
-kubectl delete -f k8s/yaml/linkis-ps-data-source-manager.yaml --namespace=preprod
-kubectl delete -f k8s/yaml/linkis-cg-linkismanager.yaml --namespace=preprod
-kubectl delete -f k8s/yaml/linkis-cg-entrance.yaml --namespace=preprod
-kubectl delete -f k8s/yaml/linkis-cg-engineplugin.yaml --namespace=preprod
-kubectl delete -f k8s/yaml/linkis-cg-engineconnmanager.yaml --namespace=preprod
-kubectl delete -f k8s/yaml/linkis-web.yaml --namespace=preprod
-
-
-kubectl apply -f k8s/yaml/configmap/linkis-configmap.yaml --namespace=preprod
-kubectl apply -f k8s/yaml/configmap/hadoop-configmap.yaml --namespace=preprod
-kubectl apply -f k8s/yaml/configmap/hive-configmap.yaml --namespace=preprod
-kubectl apply -f k8s/yaml/configmap/spark-configmap.yaml --namespace=preprod
-kubectl apply -f k8s/yaml/linkis-mg-gateway.yaml --namespace=preprod
-kubectl apply -f k8s/yaml/linkis-mg-eureka.yaml --namespace=preprod
-kubectl apply -f k8s/yaml/linkis-ps-publicservice.yaml --namespace=preprod
-kubectl apply -f k8s/yaml/linkis-ps-cs.yaml --namespace=preprod
-kubectl apply -f k8s/yaml/linkis-ps-metadatamanager.yaml --namespace=preprod
-kubectl apply -f k8s/yaml/linkis-ps-data-source-manager.yaml --namespace=preprod
-kubectl apply -f k8s/yaml/linkis-cg-linkismanager.yaml --namespace=preprod
-kubectl apply -f k8s/yaml/linkis-cg-entrance.yaml --namespace=preprod
-kubectl apply -f k8s/yaml/linkis-cg-engineplugin.yaml --namespace=preprod
-kubectl apply -f k8s/yaml/linkis-cg-engineconnmanager.yaml --namespace=preprod
-kubectl apply -f k8s/yaml/linkis-web.yaml --namespace=preprod'''
-      }
-    }
-
-  }
-}


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@linkis.apache.org
For additional commands, e-mail: commits-help@linkis.apache.org