| @@ -17,13 +17,17 @@ | |||
| # created_at :datetime not null | |||
| # updated_at :datetime not null | |||
| # label :string(255) | |||
| # node_type :string(255) | |||
| # is_mutil_link :boolean | |||
| # link_type :string(255) | |||
| # | |||
| # Indexes | |||
| # | |||
| # index_action_nodes_on_action_node_types_id (action_node_types_id) | |||
| # index_action_nodes_on_user_id (user_id) | |||
| # by_name (name) | |||
| # index_action_nodes_on_action_types_id (action_node_types_id) | |||
| # index_action_nodes_on_user_id (user_id) | |||
| # | |||
| # node_type 0: 触发器 1: 任务作业, 2: 步骤 | |||
| class Action::Node < ApplicationRecord | |||
| self.table_name = 'action_nodes' | |||
| default_scope { order(sort_no: :asc) } | |||
| @@ -34,7 +38,7 @@ class Action::Node < ApplicationRecord | |||
| belongs_to :user, optional: true | |||
| attr_accessor :cust_name, :run_values, :input_values, :next_step_nodes | |||
| attr_accessor :cust_name, :run_values, :input_values, :sub_nodes | |||
| validates :name, presence: { message: "不能为空" } | |||
| validates :full_name, length: { maximum: 200, too_long: "不能超过200个字符" } | |||
| @@ -0,0 +1,29 @@ | |||
| jobs: | |||
| <%@job_nodes.each_with_index do |job,index| %> | |||
| job<%=index + 1 %>: | |||
| name: "<%=job.label || job.name %>" | |||
| # 运行环境,这里就是上面定义的多个 os | |||
| runs-on: 'ubuntu-latest' | |||
| <% if index >0 %> | |||
| needs: job<%=index %> | |||
| <% end %> | |||
| steps: | |||
| <%job.sub_nodes.each do |node| %> | |||
| - name: <%=node.label || node.name %> | |||
| <% if node.name !="shell" %> | |||
| uses: <%=node.full_name %> | |||
| <% end %> | |||
| <%if node.input_values.present? %> | |||
| with: | |||
| <% node.input_values.each_key do |key| %> | |||
| <%=key %>: '<%=node.input_values[key] %>' | |||
| <%end %> | |||
| <%end %> | |||
| <%if node.run_values.present? %> | |||
| <% node.run_values.each_key do |key| %> | |||
| <%=key %>: | | |||
| <%=node.run_values[key] %> | |||
| <%end %> | |||
| <%end %> | |||
| <% end %> | |||
| <%end %> | |||
| @@ -0,0 +1,51 @@ | |||
| # steps: | |||
| # 将job的工作目录指向$GITHUB_WORSPACES checkout@v2比较旧不推荐使用 | |||
| - name: Checkout codes | |||
| uses: actions/checkout@v3 | |||
| - name: Install Java and Maven | |||
| uses: actions/setup-java@v3 | |||
| with: | |||
| java-version: '11' | |||
| distribution: 'temurin' | |||
| # 设置jdk环境 | |||
| - name: download latest temurin JDK | |||
| id: download_latest_jdk | |||
| env: | |||
| HTTPS_PROXY: http://172.20.32.253:3128 | |||
| HTTP_PROXY: http://172.20.32.253:3128 | |||
| #run: curl -o https://testgitea2.trustie.net/xxq250/licensee-identify-api-sss/raw/branch/master/openlogic-openjdk-11.0.22+7-linux-x64.tar.gz | |||
| run: wget -O $RUNNER_TEMP/java_package.tar.gz "http://172.20.32.202:10082/xxq250/licensee-identify-api-sss/raw/branch/master/OpenJDK11U-jdk_x64_linux_hotspot_11.0.22_7.tar.gz" | |||
| - uses: actions/setup-java@v4 | |||
| with: | |||
| distribution: 'jdkfile' | |||
| jdkFile: ${{ runner.temp }}/java_package.tar.gz | |||
| java-version: '11.0.0' | |||
| architecture: x64 | |||
| mvn-toolchain-vendor: 'Oracle' | |||
| # 设置maven 仓库缓存 避免每次构建时都重新下载依赖 | |||
| - name: Cache local Maven repository | |||
| uses: actions/cache@v3 | |||
| with: | |||
| path: ~/.m2/repository | |||
| key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |||
| restore-keys: | | |||
| ${{ runner.os }}-maven- | |||
| - name: Test java version | |||
| run: java -version | |||
| - name: Set up Maven | |||
| uses: stCarolas/setup-maven@v5 | |||
| with: | |||
| maven-version: 3.8.2 | |||
| - name: Setup Maven mirrors | |||
| uses: s4u/maven-settings-action@v3.0.0 | |||
| with: | |||
| mirrors: '[{"id": "alimaven", "name": "aliyun maven", "mirrorOf": "central", "url": "http://172.20.32.181:30005/repository/aliyun-maven/"}]' | |||
| - name: env show | |||
| run: env | |||
| - name: cat maven-settings.xml | |||
| run: cat /root/.m2/settings.xml | |||
| - name: Test with Maven | |||
| run: mvn clean test -B -U | |||
| env: | |||
| https_proxy: http://172.20.32.253:3128 | |||
| http_proxy: http://172.20.32.253:3128 | |||
| @@ -1,7 +1,4 @@ | |||
| # action name | |||
| name: <%=@pipeline_name %> | |||
| # 什么时候触发这个workflow | |||
| name: "<%=@pipeline_name %>" | |||
| on: | |||
| <%@on_nodes.each do |node| %> | |||
| <%if node.name.to_s.include?("on-push") %> | |||
| @@ -39,16 +36,18 @@ on: | |||
| <% end %> | |||
| jobs: | |||
| job1: | |||
| # 运行环境 | |||
| <%@job_nodes.each_with_index do |job,index| %> | |||
| job<%=index %>: | |||
| name: "<%=job.label || job.name %>" | |||
| # 运行环境,这里就是上面定义的多个 os | |||
| runs-on: 'ubuntu-latest' | |||
| steps: | |||
| <%@steps_nodes.each do |node| %> | |||
| <%job.sub_nodes.each do |node| %> | |||
| - name: <%=node.label || node.name %> | |||
| <% if node.name !="shell" %> | |||
| <% if node.name !="shell" %> | |||
| uses: <%=node.full_name %> | |||
| <% end %> | |||
| <%if node.input_values.present? %> | |||
| <% end %> | |||
| <%if node.input_values.present? %> | |||
| with: | |||
| <% node.input_values.each_key do |key| %> | |||
| <%=key %>: '<%=node.input_values[key] %>' | |||
| @@ -56,7 +55,9 @@ jobs: | |||
| <%end %> | |||
| <%if node.run_values.present? %> | |||
| <% node.run_values.each_key do |key| %> | |||
| <%=key %>: '<%=node.run_values[key] %>' | |||
| <%=key %>: | | |||
| <%=node.run_values[key] %> | |||
| <%end %> | |||
| <%end %> | |||
| <% end %> | |||
| <%end %> | |||
| @@ -1,22 +1,20 @@ | |||
| name: Check dist<%= @name %> | |||
| # action name | |||
| name: Test with Junit | |||
| # 什么时候触发这个workflow | |||
| on: | |||
| # push 到master分之的时候 这里可以指定多个 | |||
| #push: | |||
| # branches: | |||
| # - master | |||
| # paths-ignore: | |||
| # - '**.md' | |||
| push: | |||
| branches: | |||
| - master | |||
| paths-ignore: | |||
| - '**.md' | |||
| # pull request 到master分之的时候, 这里可以指定多个 | |||
| #pull_request: | |||
| # branches: | |||
| # - master | |||
| # paths-ignore: | |||
| # - '**.md' | |||
| pull_request: | |||
| branches: | |||
| - master | |||
| paths-ignore: | |||
| - '**.md' | |||
| # 定时调度执行 | |||
| schedule: | |||
| - cron: '26 10,11 * * *' | |||
| @@ -35,16 +33,15 @@ jobs: | |||
| os: [ 'ubuntu-latest' ] | |||
| # 运行环境,这里就是上面定义的多个 os | |||
| runs-on: 'ubuntu-latest' | |||
| steps: | |||
| # 将job的工作目录指向$GITHUB_WORSPACES checkout@v2比较旧不推荐使用 | |||
| - name: Checkout codes | |||
| uses: actions/checkout@v3 | |||
| #- name: Install Java and Maven | |||
| # uses: actions/setup-java@v3 | |||
| # with: | |||
| # java-version: '11' | |||
| # distribution: 'temurin' | |||
| - name: Install Java and Maven | |||
| uses: actions/setup-java@v3 | |||
| with: | |||
| java-version: '11' | |||
| distribution: 'temurin' | |||
| # 设置jdk环境 | |||
| - name: download latest temurin JDK | |||
| id: download_latest_jdk | |||
| @@ -0,0 +1,26 @@ | |||
| # action name | |||
| name: Test with Junit | |||
| # 什么时候触发这个workflow | |||
| on: | |||
| # push 到master分之的时候 这里可以指定多个 | |||
| push: | |||
| branches: | |||
| - master | |||
| paths-ignore: | |||
| - '**.md' | |||
| # pull request 到master分之的时候, 这里可以指定多个 | |||
| pull_request: | |||
| branches: | |||
| - master | |||
| paths-ignore: | |||
| - '**.md' | |||
| # 定时调度执行 | |||
| schedule: | |||
| - cron: '26 10,11 * * *' | |||
| env: | |||
| https_proxy: http://172.20.32.253:3128 | |||
| http_proxy: http://172.20.32.253:3128 | |||
| # 一个workflow可以由多个job组成,多个job可以并行运行 | |||
| <%= render(partial: 'api/v1/projects/pipelines/jobs') %> | |||
| @@ -165,6 +165,7 @@ defaults format: :json do | |||
| resources :pipelines do | |||
| post :build_yaml, on: :collection | |||
| post :save_yaml, on: :collection | |||
| get :test_yaml, on: :collection | |||
| end | |||
| resources :pulls, module: 'pulls' do | |||
| member do | |||