-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a11f650
commit def640c
Showing
38 changed files
with
4,121 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
.idea/ | ||
.gradle/ | ||
build/ | ||
target/ | ||
out/ | ||
release/ | ||
reports/ | ||
*.iml | ||
.DS_Store | ||
*.log | ||
gradle/ | ||
gradlew | ||
gradlew.bat | ||
version.txt | ||
build.yml | ||
.codecc | ||
task.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,57 @@ | ||
# run | ||
#### 插件功能 | ||
在构建机上执行脚本: | ||
- 默认情况使用Bash进行脚本执行 | ||
- 可选解析器如图所示![command.png](./img/command.png) | ||
|
||
#### 适用场景 | ||
执行编译脚本 | ||
|
||
支持通过如下方式设置当前步骤输出变量: | ||
``` | ||
echo "::set-output name=<output_name>::<output_val>" | ||
``` | ||
如: | ||
``` | ||
echo "::set-output name=release_type::dev" | ||
``` | ||
在下游步骤入参中: | ||
- 通过 ${{ jobs.<job_id>.steps.<step_id>.outputs.release_type }} 引用此变量值 | ||
- <job_id> 为当前Job上配置的 Job ID | ||
- <step_id> 为当前 Task 上配置的 Step ID | ||
|
||
支持通过如下方式设置/修改流水线变量: | ||
``` | ||
echo "::set-variable name=<var_name>::<var_value>" | ||
``` | ||
如: | ||
``` | ||
echo "::set-variable name=a::1" | ||
``` | ||
在下游步骤入参中,通过 ${{ variables.a }} 方式引用此变量 | ||
|
||
#### 使用限制和受限解决方案[可选] | ||
设置输出参数或者流水线变量时,**在当前步骤不会生效,在下游步骤才生效** | ||
|
||
#### 常见的失败原因和解决方案 | ||
1. 脚本执行退出码非0时,当前步骤执行结果为失败,请检查脚本逻辑,或确认执行环境是否满足需求 | ||
|
||
#### 多行文本使用set-output/set-variable/set-gate-value | ||
bash示例: | ||
使用format_multiple_lines 替代echo输出 | ||
``` | ||
content=$(ls -l ..) | ||
echo "$content" | ||
format_multiple_lines "::set-output name=content_a::$content" | ||
resultStr="\n" | ||
resultStr="$resultStr\n$PATH" | ||
resultStr="$resultStr\n$PATH" | ||
resultStr="$resultStr\n$PATH" | ||
echo resultStr=$resultStr | ||
format_multiple_lines "::set-output name=content2_a::$resultStr" | ||
``` | ||
|
||
python 示例: | ||
``` | ||
multiple_lines = "line one \n line two \n line three" | ||
print("::set-output name=lines::{0}".format(format_multiple_lines(multiple_lines))) | ||
``` |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>com.tencent.devops.ci-plugins</groupId> | ||
<artifactId>run</artifactId> | ||
<version>1.0.0</version> | ||
|
||
<properties> | ||
<!-- 引用的sdk版本,当sdk版本有升级时再修改 --> | ||
<sdk.version>1.1.3</sdk.version> | ||
<java.version>1.8</java.version> | ||
<kotlin.version>1.7.0</kotlin.version> | ||
<maven.compiler.source>${java.version}</maven.compiler.source> | ||
<maven.compiler.target>${java.version}</maven.compiler.target> | ||
<!--项目版本 --> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
|
||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>com.tencent.devops.ci-plugins</groupId> | ||
<artifactId>java-plugin-sdk</artifactId> | ||
<version>${sdk.version}</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.jetbrains.kotlin</groupId> | ||
<artifactId>kotlin-stdlib-jdk8</artifactId> | ||
<version>${kotlin.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<version>4.12</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.commons</groupId> | ||
<artifactId>commons-exec</artifactId> | ||
<version>1.3</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<finalName>${project.name}</finalName> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-assembly-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<id>jar-with-dependencies</id> | ||
<phase>package</phase> | ||
<goals> | ||
<goal>single</goal> | ||
</goals> | ||
<configuration> | ||
<descriptorRefs> | ||
<descriptorRef>jar-with-dependencies</descriptorRef> | ||
</descriptorRefs> | ||
<archive> | ||
<manifest> | ||
<mainClass>com.tencent.bk.devops.atom.AtomRunner</mainClass> | ||
</manifest> | ||
</archive> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.jetbrains.kotlin</groupId> | ||
<artifactId>kotlin-maven-plugin</artifactId> | ||
<version>${kotlin.version}</version> | ||
<executions> | ||
<execution> | ||
<id>compile</id> | ||
<goals> | ||
<goal>compile</goal> | ||
</goals> | ||
<configuration> | ||
<sourceDirs> | ||
<sourceDir>${project.basedir}/src/main/kotlin</sourceDir> | ||
<sourceDir>${project.basedir}/src/main/java</sourceDir> | ||
</sourceDirs> | ||
</configuration> | ||
</execution> | ||
<execution> | ||
<id>test-compile</id> | ||
<goals> | ||
<goal>test-compile</goal> | ||
</goals> | ||
<configuration> | ||
<sourceDirs> | ||
<sourceDir>${project.basedir}/src/test/kotlin</sourceDir> | ||
<sourceDir>${project.basedir}/src/test/java</sourceDir> | ||
</sourceDirs> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
Oops, something went wrong.