검색

1.2. 소스 정의

download PDF

다음 필드의 값을 설정하여 빌드의 소스 세부 정보를 Build CR(사용자 정의 리소스)에서 구성할 수 있습니다.

  • source.git.url: Git 리포지토리에서 사용할 수 있는 이미지의 소스 위치를 정의합니다.
  • source.git.cloneSecret: 개인 Git 리포지토리의 SSH 개인 키가 포함된 네임스페이스의 시크릿을 참조합니다.
  • source.git.revision: 소스 Git 리포지토리에서 선택할 특정 버전을 정의합니다. 예를 들어 커밋, 태그 또는 분기 이름입니다. 이 필드는 기본적으로 Git 리포지토리 기본 분기입니다.
  • source.contextDir: 소스 코드가 루트 폴더에 없는 리포지토리의 컨텍스트 경로를 지정합니다.

빌드 컨트롤러에서 이미지를 가져오기 위해 지정한 Git 리포지토리가 있는지 자동으로 확인하지 않습니다. 검증해야 하는 경우 다음 예와 같이 build.shipwright.io/verify.repository 주석의 값을 true 로 설정합니다.

apiVersion: shipwright.io/v1beta1
kind: Build
metadata:
  name: buildah-golang-build
  annotations:
    build.shipwright.io/verify.repository: "true"
spec:
  source:
    git:
      url: https://github.com/shipwright-io/sample-go
    contextDir: docker-build

빌드 컨트롤러는 다음 시나리오에서 Git 리포지토리가 있는지 확인합니다.

  • HTTP 또는 HTTPS 프로토콜과 함께 끝점 URL을 사용하는 경우
  • git@ 과 같은 SSH 프로토콜을 정의했지만 참조된 보안(예: source.git.cloneSecret )이 정의되어 있지 않은 경우입니다.

다음 예제에서는 다양한 소스 입력 세트를 사용하여 빌드를 구성하는 방법을 보여줍니다.

예: 인증 정보를 사용하여 빌드 구성

다음 예와 같이 인증 정보를 지정하여 소스로 빌드를 구성할 수 있습니다.

apiVersion: shipwright.io/v1beta1
kind: Build
metadata:
  name: buildah-build
spec:
  source:
    git:
      url: https://github.com/sclorg/nodejs-ex
      cloneSecret: source-repository-credentials

예: 컨텍스트 경로를 사용하여 빌드 구성

다음 예와 같이 Git 리포지토리에서 컨텍스트 경로를 지정하는 소스로 빌드를 구성할 수 있습니다.

apiVersion: shipwright.io/v1beta1
kind: Build
metadata:
  name: buildah-custom-context-dockerfile
spec:
  source:
    git:
      url: https://github.com/userjohn/npm-simple
    contextDir: docker-build

예: 태그를 사용하여 빌드 구성

다음 예와 같이 Git 리포지토리의 v.0.1.0 태그를 지정하는 소스로 빌드를 구성할 수 있습니다.

apiVersion: shipwright.io/v1beta1
kind: Build
metadata:
  name: buildah-golang-build
spec:
  source:
    git:
      url: https://github.com/shipwright-io/sample-go
      revision: v0.1.0

예: 환경 변수를 사용하여 빌드 구성

다음 예와 같이 환경 변수를 지정하는 빌드를 구성할 수도 있습니다.

apiVersion: shipwright.io/v1beta1
kind: Build
metadata:
  name: buildah-golang-build
spec:
  source:
    git:
      url: https://github.com/shipwright-io/sample-go
    contextDir: docker-build
  env:
    - name: <example_var_1>
      value: "<example_value_1>"
    - name: <example_var_2>
      value: "<example_value_2>"
Red Hat logoGithubRedditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 문서 정보

Red Hat을 사용하는 고객은 신뢰할 수 있는 콘텐츠가 포함된 제품과 서비스를 통해 혁신하고 목표를 달성할 수 있습니다.

보다 포괄적 수용을 위한 오픈 소스 용어 교체

Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

© 2024 Red Hat, Inc.