GitLab cicd starclass test

1 minute read

  1. make test_run.py to pass with python uniitest
    1-1. make cicd variables in settings.
script:
...
--assets $FRIDA_TEST_ASSET_0 
--assets $FRIDA_TEST_ASSET_

with parser.add_argument('--assets', default=[], action='append') this.

the yml file means that append CICD variable(FRIDA_TEST_ASSET_0 ) to assets

  1. make run.py to pass pipeline test stage

  2. remove redundancy not linked to build stage

Artifact

CICD_variables

  • protected๋Š” protected tag or protected branch ๊ฐ€ ๋“ค์–ด๊ฐ„ ํŒŒ์ดํ”„๋ผ์ธ์—์„œ๋งŒ ์ ‘๊ทผ์ด ๊ฐ€๋Šฅ.
  • docs ๋‹ค์‹œ ์ฒดํฌํ•ด์„œ ์ •๋ฆฌ

masked variable

  • ์ ‘๊ทผ ๊ถŒํ•œ ๋ฒ”์œ„ ์„ค์ •๊ณผ ๊ด€๋ จ์žˆ๋Š” ์„ค์ •
  • ํŒŒ์ดํ”„๋ผ์ธ ์‹คํ–‰ ๋กœ๊ทธ๋งŒ ๋ณผ ์ˆ˜๋งŒ ์žˆ๋Š” ์‚ฌ๋žŒ(๊ถŒํ•œ)์ด masked ์—†์œผ๋ฉด ๋ณ€์ˆ˜๊ฐ€ ํ‘œ์‹œ๊ฐ€๋จ
  • masked(****)๋กœ ์ถœ๋ ฅ์ด ๋จ.

Credential Vault

๊ฐ™์€ ์„œ๋น„์Šค ๋„ ์žˆ์Œ.

protected tags

  • settings/repository ์„ค์ •์— protected tags, protected branchs ์—์„œ ์„ค์ •.
  • ์ƒ์„ฑ, ์‚ญ์ œ ๊ถŒํ•œ ์—†์Œ
  • GITLAB์—์„œ๋Š” ์‚ญ์ œ๊ฐ€ ์•ˆ๋˜๊ฒŒ ํ•˜๋ ค๊ณ (ํ”Œ๋žซํผ๋งˆ๋‹ค ๊ธฐ๋Šฅ์ด ๋‹ค๋ฆ„ , ๊ถŒํ•œ ๋ฒ”์œ„๋„ ๋‹ค๋ฆ„)
  • Wildcards(*) ๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ์ž๋™์œผ๋กœ dropdown์ด ์ƒ๊น€.

CI_COMMIT_TAG

  • CI_commit_tag๋Š” predefined variable์ธ๋ฐ ์—ฌ๊ธฐ์— ๊ฐ’์ด ์จ์ง€๋Š” ๊ฒฝ์šฐ๋Š” ํ•ด๋‹น ํƒœ๊ทธ๊ฐ€ variable์— ์ž…๋ ฅ์ด ๋œ ์ƒํƒœ์—์„œ ์ง„ํ–‰
    • repository์— ์žˆ๋Š” tags ๊ฐ€ CO_COMMIT
  • ONLYTAGS
    • TAG๋ฅผ ๋งŒ๋“ค๋ฉด ๊ทธ ๋–„ TRIGGER๊ฐ€ ๋˜์„œ PIPELINE ์‹คํ–‰์ด ๋จ
    • PROTECTED ์—ฌ๋ถ€ ์ƒ๊ด€์—†์ด PIPELINE ์‹คํ–‰์ด ๋จ.
    • local ์—์„œ ์ž‘์—…ํ›„ push ํ•ด๋„ pipeline ์‹คํ–‰์ด ์•ˆ๋จ
    • tag๊ฐ€ ์ƒ์„ฑ๋  ๋•Œ๋งŒ pipeline ์‹คํ–‰.
  • EXCLUDE ์˜ต์…˜์ด ์žˆ์Œ
    • REGEX๋ฅผ ์จ์„œ ํ•ด๋‹น ํƒœ๊ทธ๊ฐ€ ๋งค์นญ์ด ๋˜๋ฉด ์•ˆํ•จ(PIPELINE)
  • ํŠน์ • TAG๋ฅผ ๊ฐ€์ง„ REPOSITORY์—์„œ BUILD ํ•˜๋ ค๋ฉด?
    • ์ƒˆ tag๋ฅผ ๊ทธ ๊ณผ๊ฑฐ tag๋ฅผ ์„ ํƒํ•ด์„œ ์ƒˆ๋กœ ๋งŒ๋“ค๋ฉด ๋จ
    • ์™„์ „ ๋‹ค๋ฅธ ์ž‘์—…์„ ํ• ๋•Œ๋‚˜.
      • ๋นŒ๋“œ ํ™˜๊ฒฝ์ด ์ƒˆ ๋ฒ„์ „์ด ๋‚˜์˜ค๋ฉด์„œ ๋ฐ”๋€Œ๊ฑฐ๋‚˜ ํ–ˆ์„ ๊ฒฝ์šฐ ํ„ฐ์ง
      • ์˜ˆ์ „ ํ™˜๊ฒฝ์„ ๋‹ค์‹œ ๊ฐ€์ ธ์™€์„œ ์‹คํ–‰ํ…Œ์ŠคํŠธ ํ•ด๋ณผ ๊ฒฝ์šฐ (๋””๋ฒ„๊น…)

TAG๋Š” CICD ๋๋‚˜๊ณ  ๋‹ค๋Š” ๊ฒƒ์ด ์ง„์ •ํ•œ CICD๋‹ค

CI

๊ฐ์ž ๋งŒ๋“ ๊ฑธ ํ†ตํ•ฉ

CD

ํ†ตํ•ฉํ›„ DEPLOY

Appendix

argparse

  • store_true store_true ๋ฅผ ์ฃผ๊ฒŒ ๋˜๋ฉด default ๊ฐ’์œผ๋กœ Namespace์— True๊ฐ€ ์ €์žฅ๋œ๋‹ค.
    parser = argparse.ArgumentParser()
    parser.add_argument('--foo', action='store_true')
    parser.add_argument('--bar', action='store_false')
    parser.add_argument('--baz', action='store_false')
    parser.parse_args('--foo --bar'.split())
    # Namespace(foo=True, bar=False, baz=True)
    
  • append
    parser = argparse.ArgumentParser()
    parser.add_argument('--foo', action='append')
    parser.parse_args('--foo 1 --foo 2'.split())
    # Namespace(foo=['1', '2'])
    

https://docs.python.org/3/library/argparse.html

Leave a comment