Child pages
  • Bamboo variables 사용하여 빌드하기

Contents


bamboo 의 build plan 에 bamboo 내부의 변수나 시스템의 변수를 사용하여 유연하게 빌드할 수 있다.

 

variable 의 종류

  • Global variables are defined across your entire Bamboo instance, and have the same (static) value for every plan that is built by Bamboo.
  • Plan variables are similar to global variables, but are defined for specific plans. Plan variables override global variables with the same name. You can also override a plan variable for a build, if you have triggered the build manually.
  • Build-specific variables are evaluated by Bamboo dynamically at build time. The source of a build-specific variable can either be a Bamboo property or one of the default plugins (assuming they have been enabled).
  • Deployment variables are a number of standard reserved variables that are available during deployment executions. 
  • System variables also apply across your entire Bamboo instance and inherit their values from system or environment variables of the same name.

사용

${bamboo.variableName} 형식으로 사용


예제

git branch 명으로 maven 의 artifact 생성

  1. pom.xml 설정

    pom.xml
    <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/maven-v4_0_0.xsd">
      <modelVersion>4.0.0</modelVersion>
      <groupId>org.example</groupId>
      <artifactId>webapp1</artifactId>
      <packaging>war</packaging>
      <version>1.0-SNAPSHOT</version>
      <name>webapp1 Maven Webapp</name>
      <url>http://maven.apache.org</url>
    <dependencies>
        <dependency>
          <groupId>junit</groupId>
          <artifactId>junit</artifactId>
          <version>4.11</version>
          <scope>test</scope>
        </dependency>
      </dependencies>
    <build>
        <finalName>webapp1-${gitBranch}</finalName>
      </build>
    </project>
  2. bamboo 에서 maven task 를 만들고 Goal 에 다음 내용 설정

    clean package -DgitBranch=${bamboo.repository.git.branch}
  3. run build

 

 

Ref

 

  • No labels
Write a comment…