mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-03 03:40:49 +08:00
fixed 图形化流水线构建
This commit is contained in:
9
app/views/api/v1/projects/pipelines/build_node.yaml.erb
Normal file
9
app/views/api/v1/projects/pipelines/build_node.yaml.erb
Normal file
@@ -0,0 +1,9 @@
|
||||
steps:
|
||||
- name: <%=self.node.name %>
|
||||
uses: <%=self.full_name %>
|
||||
<%if self.action_node_inputs.present? %>
|
||||
with:
|
||||
<% self.action_node_inputs.each do |input| %>
|
||||
<%=input.name %>: ''
|
||||
<%end %>
|
||||
<%end %>
|
||||
55
app/views/api/v1/projects/pipelines/build_pipeline.yaml.erb
Normal file
55
app/views/api/v1/projects/pipelines/build_pipeline.yaml.erb
Normal file
@@ -0,0 +1,55 @@
|
||||
# action name
|
||||
name: <%=@name %>
|
||||
|
||||
# 什么时候触发这个workflow
|
||||
on:
|
||||
<%@on_nodes.each do |node| %>
|
||||
<%if node.name.to_s.include?("on-push") %>
|
||||
push:
|
||||
<% node.input_values.each_key do |key| %>
|
||||
<%=key %>:
|
||||
<% if node.input_values[key].blank? %>
|
||||
- *
|
||||
<% else %>
|
||||
<% node.input_values[key].to_s.split(",").each do |val| %>
|
||||
- <%=val %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<%if node.name.to_s.include?("on-pull_request") %>
|
||||
pull_request:
|
||||
<% node.input_values.each_key do |key| %>
|
||||
<%=key %>:
|
||||
<% if node.input_values[key].blank? %>
|
||||
- *
|
||||
<% else %>
|
||||
<% node.input_values[key].to_s.split(",").each do |val| %>
|
||||
- <%=val %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<%if node.name.to_s.include?("on-schedule") %>
|
||||
schedule:
|
||||
<% node.input_values.each_key do |key| %>
|
||||
- <%=key %>: "<%=node.input_values[key] %>"
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
jobs:
|
||||
job1:
|
||||
# 运行环境
|
||||
runs-on: 'ubuntu-latest'
|
||||
steps:
|
||||
<%@steps_nodes.each do |node| %>
|
||||
- name: <%=node.cust_name || node.name %>
|
||||
uses: <%=node.full_name %>
|
||||
<%if node.input_values.present? %>
|
||||
with:
|
||||
<% node.input_values.each_key do |key| %>
|
||||
<%=key %>: <%=node.input_values[key] %>
|
||||
<%end %>
|
||||
<%end %>
|
||||
<% end %>
|
||||
8
app/views/api/v1/projects/pipelines/index.json.jbuilder
Normal file
8
app/views/api/v1/projects/pipelines/index.json.jbuilder
Normal file
@@ -0,0 +1,8 @@
|
||||
json.status 0
|
||||
json.message "success"
|
||||
|
||||
json.pipelines @pipelines.each do |pip|
|
||||
json.extract! pip, :id, :pipeline_name, :pipeline_status, :description, :file_name, :is_graphic_design,
|
||||
:repo_name, :repo_identifier, :branch, :event, :sha, :disable, :json, :yaml, :created_at, :updated_at
|
||||
# json.project
|
||||
end
|
||||
5
app/views/api/v1/projects/pipelines/show.json.jbuilder
Normal file
5
app/views/api/v1/projects/pipelines/show.json.jbuilder
Normal file
@@ -0,0 +1,5 @@
|
||||
json.status 0
|
||||
json.message "success"
|
||||
json.extract! @pipeline, :id, :pipeline_name, :pipeline_status, :description, :file_name, :is_graphic_design,
|
||||
:repo_name, :repo_identifier, :branch, :event, :sha, :disable, :json, :yaml, :created_at, :updated_at
|
||||
# json.project
|
||||
89
app/views/api/v1/projects/pipelines/test.yaml.erb
Normal file
89
app/views/api/v1/projects/pipelines/test.yaml.erb
Normal file
@@ -0,0 +1,89 @@
|
||||
name: Check dist<%= @name %>
|
||||
|
||||
# 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可以并行运行
|
||||
jobs:
|
||||
junit:
|
||||
strategy:
|
||||
matrix:
|
||||
# 指定jdk 版本。可以指定多个版本 比如[8,11,17]
|
||||
java: [11]
|
||||
# 指定运行 os 版本 也是多个
|
||||
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'
|
||||
# 设置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
|
||||
Reference in New Issue
Block a user