Bitbucket Pipelines CI/CD: DinD & Private

๐Ÿ’ก Bitbucket Pipelines CI/CD: DinD & Private โ€” Executive Summary

Technical architectural analysis, practical configuration manifests, and deployment instructions for Bitbucket Pipelines CI/CD: DinD & Private.

yaml
image:
  #Docker image options page
options:
  #Global options page
clone:
  #Git clone behavior page
definitions:
  #Cache and service container definitions page
pipeline:
  #Pipeline start options page
    parallel:
      #Parallel step options page
    stage:
      #Stage options page
    step:
      #Step options page
image
yaml
#private
image:
  name: registry/image:tag
  username: username
  password: password

#public
image: registry/image:tag
options
References and Guidelines (NOTE)

Experimental feature, rarely used

yaml
#(premium-only) ๋™์ผํ•œ ์ž‘์—… ๊ณต๊ฐ„ ๋‚ด์˜ ๋‹ค๋ฅธ ์ €์žฅ์†Œ์™€ ํŒŒ์ดํ”„๋ผ์ธ ์ •์˜๋ฅผ ๊ณต์œ ํ• ์ง€ ์—ฌ๋ถ€๋ฅผ ์ง€์ •ํ•ฉ๋‹ˆ๋‹ค.
export: true

options:
	#max-time ์˜ต์…˜์€ ๋‹จ๊ณ„๊ฐ€ ์‹œ๊ฐ„ ์ดˆ๊ณผ๋˜๊ธฐ ์ „๊นŒ์ง€ ์‹คํ–‰ํ•  ์ˆ˜ ์žˆ๋Š” ์ตœ๋Œ€ ์‹œ๊ฐ„(๋ถ„)์„ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค. max-time ์˜ต์…˜์€ ์ „์—ญ ์˜ต์…˜ ์†์„ฑ๊ณผ ๊ฐœ๋ณ„ ํŒŒ์ดํ”„๋ผ์ธ ๋‹จ๊ณ„๋ฅผ ๋ชจ๋‘ ์‚ฌ์šฉํ•˜์—ฌ ์„ค์ •ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ํŒŒ์ดํ”„๋ผ์ธ ๋‹จ๊ณ„์˜ ๊ธฐ๋ณธ ์ตœ๋Œ€ ์‹œ๊ฐ„์€ 120๋ถ„์ž…๋‹ˆ๋‹ค.
  max-time: 30
	#๊ธ€๋กœ๋ฒŒ docker ์˜ต์…˜์€ ํŒŒ์ดํ”„๋ผ์ธ์˜ ๋ชจ๋“  ๋‹จ๊ณ„์— Docker ์„œ๋น„์Šค๋ฅผ ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค. ์ด Docker ์„œ๋น„์Šค๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ๋ชจ๋“  ํŒŒ์ดํ”„๋ผ์ธ ๋‹จ๊ณ„์—์„œ Docker ๋ช…๋ น์„ ์‹คํ–‰ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. Bitbucket ํŒŒ์ดํ”„๋ผ์ธ์—์„œ Docker๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๋ฐฉ๋ฒ•์— ๋Œ€ํ•œ ์ž์„ธํ•œ ๋‚ด์šฉ์€ Bitbucket ํŒŒ์ดํ”„๋ผ์ธ์—์„œ Docker ๋ช…๋ น ์‹คํ–‰์„ ์ฐธ์กฐํ•˜์„ธ์š”.  
  docker: true
  #ํฌ๊ธฐ ์˜ต์…˜์€ Bitbucket Cloud ์ธํ”„๋ผ๋‚˜ Linux Docker ์ž์ฒด ํ˜ธ์ŠคํŒ… ๋Ÿฌ๋„ˆ์—์„œ ์‹คํ–‰ํ•  ๋•Œ ๋‹จ๊ณ„๋‚˜ ์ „์ฒด ํŒŒ์ดํ”„๋ผ์ธ์— ์ถ”๊ฐ€ ๋ฆฌ์†Œ์Šค๋ฅผ ํ• ๋‹นํ•ฉ๋‹ˆ๋‹ค.
  size: 2x
  #๋‹จ๊ณ„์— ์ ์šฉํ•  ๋Ÿฐํƒ€์ž„ ๊ตฌ์„ฑ์ž…๋‹ˆ๋‹ค.
  runtime:
	  #ํด๋ผ์šฐ๋“œ ๋‹จ๊ณ„์— ์ ์šฉํ•  ๋Ÿฐํƒ€์ž„ ๊ตฌ์„ฑ์ž…๋‹ˆ๋‹ค.
    cloud:
	    #์ด ์˜ต์…˜์€ ์ˆ˜์‹ /์†ก์‹  ํŠธ๋ž˜ํ”ฝ์— ๋Œ€ํ•œ ๋‹จ๊ณ„๋ฅผ ์‹คํ–‰ํ•  ๋•Œ ๊ธฐ๋ณธ aws-ip-ranges๋ฅผ ์‚ฌ์šฉํ• ์ง€ ์•„๋‹ˆ๋ฉด atlassian-ip-ranges๋ฅผ ์‚ฌ์šฉํ• ์ง€ ์—ฌ๋ถ€๋ฅผ ๋‚˜ํƒ€๋ƒ…๋‹ˆ๋‹ค.
      atlassian-ip-ranges: true
      #์ด ์˜ต์…˜์€ ๋‹จ๊ณ„๋ฅผ ์‹คํ–‰ํ•  ๋•Œ ์‚ฌ์šฉํ•  ์•„ํ‚คํ…์ฒ˜๋ฅผ ์ œ์–ดํ•ฉ๋‹ˆ๋‹ค.
      arch: arm
clone
yaml
#clone ์†์„ฑ์€ ๋นŒ๋“œ ์ค‘์— Bitbucket Pipelines๊ฐ€ ์ €์žฅ์†Œ๋ฅผ ๋ณต์ œํ•˜๋Š” ๋ฐฉ๋ฒ•์„ ์ œ์–ดํ•˜๋Š” ์˜ต์…˜์„ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค.
clone:
	#Git ๋ณต์ œ๋ณธ์„ ๋น„ํ™œ์„ฑํ™”ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. (pipelines.step.clone.enabled ์—์„œ ํŠน์ • step ํ™œ์„ฑํ™” ๊ฐ€๋Šฅ)
	enabled: false
	#lfs ์˜ต์…˜์€ git clone ์ž‘์—… ์ค‘์— ์ €์žฅ์†Œ์˜ ๋ชจ๋“  LFS ํŒŒ์ผ์„ ๋‹ค์šด๋กœ๋“œํ•˜๋„๋ก git์— ์ง€์‹œํ•ฉ๋‹ˆ๋‹ค. lfs๋ฅผ ์ „์—ญ ์˜ต์…˜์œผ๋กœ true๋กœ ์„ค์ •ํ•˜๋ฉด ๋ชจ๋“  LFS ํŒŒ์ผ์ด ๊ฐ ๋‹จ๊ณ„ ์‹œ์ž‘ ์‹œ ๋‹ค์šด๋กœ๋“œ๋ฉ๋‹ˆ๋‹ค. lfs๋ฅผ ๊ฐœ๋ณ„ ๋‹จ๊ณ„์—์„œ true๋กœ ์„ค์ •ํ•˜๋ฉด ํ•ด๋‹น ๋‹จ๊ณ„์˜ ๋ชจ๋“  LFS ํŒŒ์ผ์ด ๋‹ค์šด๋กœ๋“œ๋ฉ๋‹ˆ๋‹ค. ๋นŒ๋“œ ์‹œ๊ฐ„๊ณผ ๋ฆฌ์†Œ์Šค ์‚ฌ์šฉ๋Ÿ‰์„ ์ค„์ด๋ ค๋ฉด ๊ฐœ๋ณ„ ๋‹จ๊ณ„์—์„œ LFS๋ฅผ ์‚ฌ์šฉํ•˜๊ฑฐ๋‚˜ ๊ฐ ๋‹จ๊ณ„์— ํ•„์š”ํ•œ ํŒŒ์ผ๋งŒ ๋‹ค์šด๋กœ๋“œํ•˜๋Š” ๊ฒƒ์ด ์ข‹์Šต๋‹ˆ๋‹ค.
	lfs: true
	#๋ชจ๋“  ํŒŒ์ดํ”„๋ผ์ธ ๋˜๋Š” ํŒŒ์ดํ”„๋ผ์ธ ๋‹จ๊ณ„์— ๋Œ€ํ•œ Git ๋ณต์ œ๋ณธ์˜ ๊นŠ์ด๋ฅผ ์ •์˜ํ•ฉ๋‹ˆ๋‹ค. ์ „์ฒด ๋ณต์ œ๋ณธ์„ ๋งŒ๋“ค๋ ค๋ฉด full์„ ์‚ฌ์šฉํ•˜์„ธ์š”. ์ง€์ •ํ•˜์ง€ ์•Š์œผ๋ฉด ๊ธฐ๋ณธ๊ฐ’์€ ์ตœ๊ทผ 50๊ฐœ ์ปค๋ฐ‹์ž…๋‹ˆ๋‹ค. Git ๋ณต์ œ ๊นŠ์ด ์˜ต์…˜์— ๋Œ€ํ•œ ์ž์„ธํ•œ ๋‚ด์šฉ์€ Git ๋ฌธ์„œ โ€” git clone์„ ์ฐธ์กฐํ•˜์„ธ์š”.
	depth: 2
	#skip-ssl-verify ์˜ต์…˜์€ git clone ์ค‘์— SSL ๊ฒ€์ฆ์„ ๋น„ํ™œ์„ฑํ™”ํ•˜์—ฌ ์ž์ฒด ์„œ๋ช…๋œ ์ธ์ฆ์„œ๋ฅผ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋„๋ก ํ•ฉ๋‹ˆ๋‹ค.
	skip-ssl-verify: true
definitions
yaml
#definitions ์†์„ฑ์€ ํŒŒ์ดํ”„๋ผ์ธ ๊ตฌ์„ฑ์˜ ๋‹ค๋ฅธ ๊ณณ์—์„œ ์‚ฌ์šฉ๋˜๋Š” ๋ฆฌ์†Œ์Šค๋ฅผ ์ •์˜ํ•˜๋Š” ๋ฐ ์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค.
definitions:
	#Bitbucket Pipelines๋Š” ๋นŒ๋“œ ์ข…์†์„ฑ๊ณผ ๋””๋ ‰ํ† ๋ฆฌ ์บ์‹ฑ์„ ์ง€์›ํ•˜์—ฌ ๋นŒ๋“œ ์†๋„๋ฅผ ๋†’์ด๊ณ  ์†Œ์š”๋˜๋Š” ๋นŒ๋“œ ์‹œ๊ฐ„์„ ์ค„์ž…๋‹ˆ๋‹ค. ๋ฏธ๋ฆฌ ์ •์˜๋œ ์บ์‹œ๊ฐ€ ์—ฌ๋Ÿฌ ๊ฐœ ์žˆ์Šต๋‹ˆ๋‹ค. ๋ฏธ๋ฆฌ ์ •์˜๋œ ์บ์‹œ์˜ ์ „์ฒด ๋ชฉ๋ก์€ ์บ์‹œ โ€” ๋ฏธ๋ฆฌ ์ •์˜๋œ ์บ์‹œ๋ฅผ ์ฐธ์กฐํ•˜์„ธ์š” .
	caches:
	#Bitbucket ํŒŒ์ดํ”„๋ผ์ธ์€ ์„œ๋น„์Šค๋ณ„๋กœ ๋ณ„๋„์˜ Docker ์ปจํ…Œ์ด๋„ˆ๋ฅผ ์ƒ์„ฑํ•  ์ˆ˜ ์žˆ์–ด ๋นŒ๋“œ ์†๋„๊ฐ€ ๋นจ๋ผ์ง€๊ณ  ์„œ๋น„์Šค ํŽธ์ง‘์ด ๊ฐ„ํŽธํ•ด์ง‘๋‹ˆ๋‹ค. ์„œ๋น„์Šค ์ƒ์„ฑ์— ๋Œ€ํ•œ ์ž์„ธํ•œ ๋‚ด์šฉ์€ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ๋ฐ ์„œ๋น„์Šค ์ปจํ…Œ์ด๋„ˆ๋ฅผ ์ฐธ์กฐํ•˜์„ธ์š” . ์ด services์˜ต์…˜์€ ์„œ๋น„์Šค๋ฅผ ์ •์˜ํ•˜์—ฌ ํŒŒ์ดํ”„๋ผ์ธ ๋‹จ๊ณ„์—์„œ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋„๋ก ํ•˜๋Š” ๋ฐ ์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค.
	services:
		#service daemon image
		image: registry/image:tag
		#์ด memory์˜ต์…˜์€ ์„œ๋น„์Šค ์ปจํ…Œ์ด๋„ˆ์—์„œ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋Š” ๋ฉ”๋ชจ๋ฆฌ(๋ฉ”๊ฐ€๋ฐ”์ดํŠธ)๋ฅผ ์ œํ•œํ•˜๋Š” ๋ฐ ์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค. 4096MB( ๋นŒ๋“œ 8192์˜ ๊ฒฝ์šฐ MB size: 2x)๋Š” ์Šคํฌ๋ฆฝํŠธ ๋ฐ ํŒŒ์ดํ”„๋ผ์ธ ์„œ๋น„์Šค๋ฅผ ํฌํ•จํ•˜์—ฌ ์— ํ• ๋‹นํ•  ์ˆ˜ ์žˆ๋Š” ์ด ๋ฉ”๋ชจ๋ฆฌ ์–‘์ž…๋‹ˆ๋‹ค step. ์˜ˆ๋ฅผ ๋“ค์–ด, ์„œ๋น„์Šค์— 3072MB๊ฐ€ ํ•„์š”ํ•œ ๊ฒฝ์šฐ 1024ํ•ด๋‹น ์„œ๋น„์Šค๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๋‹จ๊ณ„๋ฅผ ์‹คํ–‰ํ•˜๋Š” ๋ฐ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋Š” ๋ฉ”๋ชจ๋ฆฌ๋Š” MB๋ฟ์ž…๋‹ˆ๋‹ค. ์„œ๋น„์Šค ์ปจํ…Œ์ด๋„ˆ ๋ฉ”๋ชจ๋ฆฌ ์ œํ•œ์— ๋Œ€ํ•œ ์ž์„ธํ•œ ๋‚ด์šฉ์€ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ๋ฐ ์„œ๋น„์Šค ์ปจํ…Œ์ด๋„ˆ - ์„œ๋น„์Šค ๋ฉ”๋ชจ๋ฆฌ ์ œํ•œ์„ ์ฐธ์กฐํ•˜์‹ญ์‹œ์˜ค .
		memory: 512
		#์ด type์˜ต์…˜์€ ๋‹ค์Œ์„ ์œ„ํ•œ Docker ์„œ๋น„์Šค ์ปจํ…Œ์ด๋„ˆ(Docker-in-Docker ์‹คํ–‰)๋ฅผ ์ง€์ •ํ•˜๋Š” ๋ฐ ์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค. (--privileged ๋ถˆ๊ฐ€๋กœ docker-daemon ์‚ฌ์šฉ์„ ์œ„ํ•ด ํ•„์š”ํ•จ.)
		type: docker
		#์„œ๋น„์Šค variables์˜ต์…˜์€ ์„œ๋น„์Šค ์ปจํ…Œ์ด๋„ˆ์— ํ™˜๊ฒฝ ๋ณ€์ˆ˜๋ฅผ ์ „๋‹ฌํ•˜๋Š” ๋ฐ ์‚ฌ์šฉ๋˜๋ฉฐ, ์ผ๋ฐ˜์ ์œผ๋กœ ์„œ๋น„์Šค๋ฅผ ๊ตฌ์„ฑํ•˜๋Š” ๋ฐ ์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค. ์„œ๋น„์Šค ์ƒ์„ฑ์— ๋Œ€ํ•œ ์ž์„ธํ•œ ๋‚ด์šฉ์€ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ๋ฐ ์„œ๋น„์Šค ์ปจํ…Œ์ด๋„ˆ๋ฅผ ์ฐธ์กฐํ•˜์„ธ์š” .
		variables: [env]
	#๋ฐ˜๋ณต๋˜๋Š” yaml ๊ตฌ์„ฑ ์…‹์„ ์‚ฌ์ „์ •์˜ํ•˜๊ณ  ์žฌ์‚ฌ์šฉ
	{yamlAnchor}: [anchor]
  • features

  • Definitions for using a Docker-in-Docker (DIND) image from a private registry.

yaml
# private registry
    definitions:
      services:
        custom-dind:
          image:
            name: { insecure-dind input }
            username: "$private_docker_hub"
            password: "$private_docker_hub_pw"
          type: docker
          variables:
            DOCKER_OPTS: "--insecure-registry={ registry input }"
  • Definitions for using a Docker-in-Docker (DIND) image from a public registry.
yaml
# public registry
    definitions:
      services:
        custom-dind:
          image: { insecure-dind input }
          type: docker
          variables:
            DOCKER_OPTS: "--insecure-registry={ registry input }"
Yaml anchors
References and Guidelines (NOTE)

Predefine and reuse repeated yaml configuration sets

yaml
#์ •์˜: {$}
definitions: 
  steps:
    - step: &build-test
        name: Build and test
        script:
          - mvn package
        artifacts:
          - target/**
#์ฐธ์กฐ: {*}
pipelines:
  branches:
    develop:
      - step: *build-test
    main:
      - step: *build-test

#์ฐธ์กฐ์‹œ Overwrite: {<<: *}
ipelines:
  branches:
    develop:
      - step: *build-test
    main:
      - step: 
          <<: *build-test
          name: Testing on Main
  • feature
  • Use manual trigger for specific branches
yaml
definitions: 
      steps:
        - step: &build-test
            name: Build and test
            script:
              - mvn package
            artifacts:
              - target/**
        - step: &deploy
            name: Deploy
            deployment: test
            script:
              - ./deploy.sh target/my-app.jar

    pipelines:
      branches:
        develop:
          - step: *build-test
          - step: *deploy
        main:
          - step: *build-test
          - step:
              <<: *deploy
              deployment: production
              trigger: manual
pipeline
yaml
#ํŒŒ์ดํ”„๋ผ์ธ ์†์„ฑ์€ ์ €์žฅ์†Œ์˜ ๋นŒ๋“œ ํ”„๋กœ์„ธ์Šค๋ฅผ ์ •์˜ํ•˜๋Š” ๋ฐ ์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค. ํŒŒ์ดํ”„๋ผ์ธ ์‹œ์ž‘ ์กฐ๊ฑด๊ณผ ํŒŒ์ดํ”„๋ผ์ธ ๋‹จ๊ณ„๊ฐ€ ํฌํ•จ๋ฉ๋‹ˆ๋‹ค. ํŒŒ์ดํ”„๋ผ์ธ ์†์„ฑ์€ ํ•„์ˆ˜์ด๋ฉฐ ์ €์žฅ์†Œ๋‹น ํ•œ ๋ฒˆ๋งŒ ์ •์˜ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.
pipelines:
	#๋‹ค๋ฅธ ์„น์…˜์˜ ํŒŒ์ดํ”„๋ผ์ธ ์ •์˜์™€ ์ผ์น˜ํ•˜์ง€ ์•Š๋Š” ๋ชจ๋“  ๋ธŒ๋žœ์น˜์— ๋Œ€ํ•œ ํŒŒ์ดํ”„๋ผ์ธ ์ •์˜๋ฅผ ํฌํ•จํ•ฉ๋‹ˆ๋‹ค.
	default: [step]
	#๋ชจ๋“  ๋ธŒ๋žœ์น˜๋ณ„ ๋นŒ๋“œ ํŒŒ์ดํ”„๋ผ์ธ์„ ์ •์˜ํ•ฉ๋‹ˆ๋‹ค. ์ด ์„น์…˜์˜ ์ด๋ฆ„ ๋˜๋Š” ํ‘œํ˜„์‹์€ Git ์ €์žฅ์†Œ์˜ ๋ธŒ๋žœ์น˜์™€ ์ผ์น˜ํ•ฉ๋‹ˆ๋‹ค. Glob ํŒจํ„ด์„ ์‚ฌ์šฉํ•˜์—ฌ ๋ธŒ๋žœ์น˜๋ฅผ ์ผ์น˜์‹œํ‚ฌ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. Glob ํŒจํ„ด์„ ์‚ฌ์šฉํ•˜์—ฌ ๋ธŒ๋žœ์น˜ ์ด๋ฆ„์„ ์ผ์น˜์‹œํ‚ค๋Š” ๋ฐฉ๋ฒ•์— ๋Œ€ํ•œ ์ž์„ธํ•œ ๋‚ด์šฉ์€ ํŒŒ์ดํ”„๋ผ์ธ YAML ํŒŒ์ผ์—์„œ Glob ํŒจํ„ด ์‚ฌ์šฉ์„ ์ฐธ์กฐํ•˜์„ธ์š”.
	branches: 
		main: [step]
		"feature/*": [step]
	#ํ’€ ๋ฆฌํ€˜์ŠคํŠธ ์†์„ฑ์€ ํ’€ ๋ฆฌํ€˜์ŠคํŠธ๊ฐ€ ์ƒ์„ฑ๋  ๋•Œ๋งŒ ์‹คํ–‰๋˜๋Š” ํŒŒ์ดํ”„๋ผ์ธ์„ ์ •์˜ํ•ฉ๋‹ˆ๋‹ค. ์‹คํ–‰ ์ „์— ๋Œ€์ƒ ๋ธŒ๋žœ์น˜๋ฅผ ์ž‘์—… ๋ธŒ๋žœ์น˜์— ๋ณ‘ํ•ฉํ•ฉ๋‹ˆ๋‹ค. ํฌํฌ๋œ ์ €์žฅ์†Œ์˜ ํ’€ ๋ฆฌํ€˜์ŠคํŠธ๋Š” ํŒŒ์ดํ”„๋ผ์ธ์„ ํŠธ๋ฆฌ๊ฑฐํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ๋ณ‘ํ•ฉ์ด ์‹คํŒจํ•˜๋ฉด ํŒŒ์ดํ”„๋ผ์ธ์ด ์ค‘์ง€๋ฉ๋‹ˆ๋‹ค. ์ฐธ๊ณ : ํ• ๋‹น๋œ ๋ธŒ๋žœ์น˜๋Š” ํ’€ ๋ฆฌํ€˜์ŠคํŠธ์˜ ์†Œ์Šค ๋ธŒ๋žœ์น˜์—ฌ์•ผ ํ•ฉ๋‹ˆ๋‹ค. ํ’€ ๋ฆฌํ€˜์ŠคํŠธ ํŒŒ์ดํ”„๋ผ์ธ์€ ์ •์˜๋œ ๋ชจ๋“  ๋ธŒ๋žœ์น˜ ๋ฐ ๊ธฐ๋ณธ ํŒŒ์ดํ”„๋ผ์ธ๊ณผ ํ•จ๊ป˜ ์‹คํ–‰๋˜๋ฏ€๋กœ ์ •์˜๊ฐ€ ๊ฒน์น˜๋ฉด ๋‘ ๊ฐœ์˜ ํŒŒ์ดํ”„๋ผ์ธ์ด ๋™์‹œ์— ์‹คํ–‰๋  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
  pull-requests:
		main: [step]
		"feature/*": [step]
		#pr default
		'**': [step]
	#๋ชจ๋“  ํƒœ๊ทธ๋ณ„ ๋นŒ๋“œ ํŒŒ์ดํ”„๋ผ์ธ์„ ์ •์˜ํ•ฉ๋‹ˆ๋‹ค. ์ด ์„น์…˜์˜ ์ด๋ฆ„์ด๋‚˜ ํ‘œํ˜„์‹์€ Git ์ €์žฅ์†Œ์˜ ํƒœ๊ทธ ๋ฐ ์ฃผ์„์ด ๋‹ฌ๋ฆฐ ํƒœ๊ทธ์™€ ์ผ์น˜ํ•ฉ๋‹ˆ๋‹ค. Glob ํŒจํ„ด์„ ์‚ฌ์šฉํ•˜์—ฌ ํƒœ๊ทธ๋ฅผ ์ผ์น˜์‹œํ‚ฌ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
	tags:
		"*-windows": [step]
		"*-linux": [step]
	#์‚ฌ์šฉ์ž ์ง€์ • ์†์„ฑ์€ Bitbucket Cloud ์ธํ„ฐํŽ˜์ด์Šค์—์„œ ์ˆ˜๋™์œผ๋กœ๋งŒ ํŠธ๋ฆฌ๊ฑฐํ•˜๊ฑฐ๋‚˜ ์˜ˆ์•ฝํ•  ์ˆ˜ ์žˆ๋Š” ํŒŒ์ดํ”„๋ผ์ธ์„ ์ •์˜ํ•˜๋Š” ๋ฐ ์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค. ์ˆ˜๋™ ๋˜๋Š” ์˜ˆ์•ฝ๋œ ํŒŒ์ดํ”„๋ผ์ธ ์ƒ์„ฑ์— ๋Œ€ํ•œ ์ž์„ธํ•œ ๋‚ด์šฉ์€ ์ˆ˜๋™ ๋ฐ ์˜ˆ์•ฝ๋œ ํŒŒ์ดํ”„๋ผ์ธ ์ƒ์„ฑ์„ ์ฐธ์กฐํ•˜์„ธ์š”.
	custom:
		"defined-trigger-name1": [step]
		"defined-trigger-name2": [step]


custom-trigger

stage
yaml
pipelines:
   default:
   #์Šคํ…Œ์ด์ง€๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ๊ณต์œ  ์†์„ฑ์„ ์‚ฌ์šฉํ•˜์—ฌ ํŒŒ์ดํ”„๋ผ์ธ ๋‹จ๊ณ„๋ฅผ ๊ทธ๋ฃนํ™”ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด, ์Šคํ…Œ์ด์ง€๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๋ฐฐํฌ์— ํ•„์š”ํ•œ ๋‹จ๊ณ„(์˜ˆ: ์•ฑ ๋ฐฐํฌ ๋ฐ ๋ฐฐํฌ ์„ฑ๊ณต ํ™•์ธ)๋ฅผ ๊ทธ๋ฃนํ™”ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
    - stage:
        name: name
        steps: [step]
step
References and Guidelines (NOTE)

This step option is used to define the build execution unit. Each step is executed in the order it appears in the file bitbucket-pipelines.yml. A single pipeline can contain up to 100 stages.


Each step in the pipeline starts a separate Docker container to run the commands configured in its options. Each step can be customized using the following options:

  • runtimeโ€“ Customize the runtime environment of the step.
  • cloud
  • atlassian-ip-ranges
  • imageโ€”Use a different Docker image.
  • max-timeโ€”Sets the maximum time allowed for the step.
  • cachesand servicesโ€”for specific caches and services.
  • artifactsโ€”Holds artifacts that can be used in subsequent steps.
  • cloneโ€”Customize the Git clone operation for this step.
  • triggermanualโ€”Set a step to require a manual trigger before the pipeline can continue.

  • features

  • self-hosted pipeline using custom defined service

yaml
pipelines:
      branches:
        "feature/pipeline-test":
          - step:
              name: "on-premise-agent :: Images push & Kubernetes Deploy"
              runs-on:
                - self.hosted
              services:
                - custom-dind
              image: { client input }
              script:
                - docker info
parallel
yaml
pipelines:
  default:
    - step: # sequential step
        name: Build
        script:
          - ./build.sh
    - step: # sequential step
        name: Build
        script:
          - ./build.sh
		#parallel ์˜ต์…˜์„ ์‚ฌ์šฉํ•˜๋ฉด ์—ฌ๋Ÿฌ ๋‹จ๊ณ„๋ฅผ ๋™์‹œ์— ์‹คํ–‰ํ•˜์—ฌ ์ฝ”๋“œ๋ฅผ ๋” ๋น ๋ฅด๊ฒŒ ๋นŒ๋“œํ•˜๊ณ  ํ…Œ์ŠคํŠธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ํŒŒ์ดํ”„๋ผ์ธ์—์„œ ์‚ฌ์šฉํ•˜๋Š” ์ด ๋นŒ๋“œ ์‹œ๊ฐ„์€ ๋‹จ๊ณ„๋ฅผ ๋ณ‘๋ ฌ๋กœ ์„ค์ •ํ•ด๋„ ๋ณ€ํ•˜์ง€ ์•Š์ง€๋งŒ, ๊ฒฐ๊ณผ๋ฅผ ๋” ๋นจ๋ฆฌ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ํŒŒ์ดํ”„๋ผ์ธ ์ •์˜์— ํฌํ•จํ•  ์ˆ˜ ์žˆ๋Š” ์ด ๋‹จ๊ณ„ ์ˆ˜๋Š” ๋ณ‘๋ ฌ ๋˜๋Š” ์ง๋ ฌ ์‹คํ–‰ ์—ฌ๋ถ€์™€ ๊ด€๊ณ„์—†์ด 100๊ฐœ๋กœ ์ œํ•œ๋ฉ๋‹ˆ๋‹ค.
    - parallel: # these 2 steps will run in parallel
        steps:
          - step:
              name: Integration 1
              script:
                - ./integration-tests.sh --batch 1
          - step:
              name: Integration 2
              script:
                - ./integration-tests.sh --batch 2
built-in
Caches
References and Guidelines (NOTE)

โ€“ Pre-defined caches

The pipeline provides predefined cache locations for commonly used language tools.

Cache name In your step Directories
[docker](https://support.atlassian.com/bitbucket-cloud/docs/run-docker-commands-in-bitbucket-pipelines/) caches:
- docker
n/a โ€“ [Create a cache in the layers generated by the build.](https://support.atlassian.com/bitbucket-cloud/docs/run-docker-commands-in-bitbucket-pipelines/#RunDockercommandsinBitbucketPipelines-ci_caching)
composer caches:
- composer
~/.composer/cache
dotnetcore caches:
- dotnetcore
~/.nuget/packages
gradle caches:
- gradle
~/.gradle/caches
ivy2 caches:
- ivy2
~/.ivy2/cache
maven caches:
- maven
~/.m2/repository
node caches:
- node
node_modules
pip caches:
- pip
~/.cache/pip
sbt
Note: To use the sbt tool, you must have both sbt and ivy2 caches enabled.
caches:
- sbt
- ivy2
~/.sbt
~/.ivy2/cache
Services
References and Guidelines (NOTE)

Backing service for using Docker daemon or configuring tests using DB


Pipeline services have the following limitations:

  • Up to 5 services per step
  • Memory limits as described below
  • There is no REST API to access services and logs based on pipeline results.
  • There is no mechanism to wait for the service to start.
  • To run a larger number of small services, use Docker run or docker-compose
  • Port 29418 is not available.

Features

Enterprise Cloud-si

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *