---
title: "【Jenkins】Parameterized Build"
author: "Perrin Yong"
author_profile: https://www.pystone.net/profile/
published_by: "Perrin Yong"
canonical: https://www.pystone.net/notes/jenkins-parameterized-build/
type: note
content_role: unspecified
visibility: public
id_stability: rename-stable
source_path: "10-计算机、信息技术与工程/03-软件工程与质量保障/CI-CD与质量保障/CI-CD工具链/【Jenkins】Parameterized Build.md"
content_hash: 729be2f8b56b7cdcdc117ab906c3c07131a17975ea4cdf5463bf4ef62f0e104c
knowledge_version: 224c990773de.5fa8af6e39fa
site_commit: 224c990773de166d23a886306577dd90379529ce
notes_commit: 5fa8af6e39fa3891d1b9b4832bfa6c4e0ecaaf0a
---
# 【Jenkins】Parameterized Build

﻿# 【Jenkins】Parameterized Build

> 创建时间：2021/6/21 21:51

## Introduction

Sometimes, it is useful/necessary to have your builds take several "parameters."

The parameters are available as environment variables.

the shell syntax:

```csharp
string a = &quot;test&quot;;
string tmp = &quot;est&quot;;
string b = &quot;t&quot; + tmp;
Console.WriteLine(string .ReferenceEquals(str1, str2));

```

And with batch commands, we use the native Windows syntax:

```csharp
string a = &quot;test&quot;;
string tmp = &quot;est&quot;;
string b = &quot;t&quot; + tmp;
Console.WriteLine(string .ReferenceEquals(str1, str2));

```

Ant

```csharp
string a = &quot;test&quot;;
string tmp = &quot;est&quot;;
string b = &quot;t&quot; + tmp;
Console.WriteLine(string .ReferenceEquals(str1, str2));

```

## 使用方法

### Defining Parameters

  * define parameters for your job by selecting "This build is parameterized"
  * using the drop-down button to add as many parameters as you need.

![assets/0026 - 【Jenkins】Parameterized Build__resource-001-e98b427c4a82.png](/media/a5cbb28ff2f118380748.png)

![assets/0026 - 【Jenkins】Parameterized Build__resource-002-9a694673bffe.png](/media/8a7f9db5e200c93681a5.png)

### Using Build Parameters

the shell syntax:

```csharp
string a = &quot;test&quot;;
string tmp = &quot;est&quot;;
string b = &quot;t&quot; + tmp;
Console.WriteLine(string .ReferenceEquals(str1, str2));

```

### Setting Parameter Values

#### Jenkins UI

![assets/0026 - 【Jenkins】Parameterized Build__resource-003-494a47beee45.png](/media/3095d257e231d27fc867.png)

#### Remote Execution

```csharp
string a = &quot;test&quot;;
string tmp = &quot;est&quot;;
string b = &quot;t&quot; + tmp;
Console.WriteLine(string .ReferenceEquals(str1, str2));

```

## ref

https://www.baeldung.com/ops/jenkins-parameterized-builds
