ãå人éçºãã¦ãWebãµã¼ãã¹ãã¨ããã®ã¯ Pixela ã®ãã¨ã§ãrunn ã¨ã¯ @k1loW ãããéçºãã¦ãããªãã¬ã¼ã·ã§ã³èªååãã¼ã«/ããã±ã¼ã¸ã§ãã
Pixela ã¯ããã®ã¦ã¼ã¶ã¼ã¤ã³ã¿ã¼ãã§ã¼ã¹ã¨ãã¦åºæ¬çã« Web API ã®ã¿ãæä¾ãã¦ãããµã¼ãã¹ã§ï¼ãµã¼ãã¹ãå©ç¨ããããã®å種æä½ã¯åºæ¬çã«ãã¹ã¦ Web API ã«å¯¾ãã HTTP ãªã¯ã¨ã¹ãã«ãã£ã¦è¡ãå¿ è¦ãããï¼ãç¾å¨ãã®ãã¼ã³ããã6å¹´ç®ãè¿ãããµã¼ãã¹ã§ãã
ããããããã¨ã«ãä¸çä¸ã®ã¦ã¼ã¶ã¼ï¼ç¹ã«ãããã°ã©ãã³ã°åå¦è ã®æ¹ã«ãããå©ç¨ããã ãã¦ããããã§ãï¼ã«ç¶ç¶çã«ä½¿ã£ã¦ããã ãã¦ãããµã¼ãã¹ã«ãªã£ã¦ãããç»é²ã¦ã¼ã¶ã¼æ°ã¯ãããã7ä¸äººã«å°éãããã¨ãã¦ããã¨ããã§ããéçºã»ã¡ã³ããã³ã¹ã«ä¿ãç§ã®äººä»¶è²»ãé¤ãã°ãé»åéå¶ãç¶ãããã¨ãã§ãã¦ãã¾ãã
ä¸æ¹ã® runn ã«ã¤ãã¦ã¯ã以åããä½ãã®ãã£ããã§ãã®åå¨ã ãã¯ç¥ã£ã¦ãã¾ãããrunn ã®ä¸»ãªã¦ã¼ã¹ã±ã¼ã¹ã¨ãã¦ã¯ãZenn ã§è²©å£²ããã¦ãããªã³ã©ã¤ã³ããã¯ã§ã®è¨è¿°ãå¼ç¨ããã¦ããã ãã¨ãæ¦ã以ä¸ã®ãããªãã®ã¨ãªãã¾ãã
runnãæ³å®ãã¦ãã主ãªã¦ã¼ã¹ã±ã¼ã¹ã¯æ¬¡ã®ãããªãã®ã«ãªãã¾ãã 1. APIã®ã·ããªãªãã¹ãï¼HTTP/gRPCï¼ 2. ãã¼ã«ã«ããªã¢ã¼ãã¸ã®ä»»æã®ã³ãã³ããHTTP/gRPCãªã¯ã¨ã¹ãããã¼ã¿ãã¼ã¹ã¯ã¨ãªãå®è¡å¯è½ãªã¯ã¼ã¯ããã¼ã¨ã³ã¸ã³ 3. ãã¼ã¿ãã¼ã¹æä½çã®ãªãã¬ã¼ã·ã§ã³ã®å®è¡ã¨è¨é² Runbook Automationã¨ãã¦ã¯2ããã£ã¨ããããããã¦ã¼ã¹ã±ã¼ã¹ã§ãããç¾å¨runnã®éçºã¡ã³ãã¼ãåãå ¥ãã¦ããã®ã¯1ã«ãªãã¾ãã ãªã®ã§ãrunnã¯APIã·ããªãªãã¹ãã£ã³ã°ãã¼ã«ã»ããã±ã¼ã¸ã¨ãè¨ããã§ãããã -- runnã¯ãã¯ãã㯠https://zenn.dev/k1low/books/runn-cookbook/viewer/about Chapter01 runnã¨ã¯ ãã
ãAPIã·ããªãªãã¹ãã£ã³ã°ãã¼ã«ã»ããã±ã¼ã¸ããåè¿°ã®ãããªãµã¼ãã¹ã§ãã Pixela ã®ãã¹ãã®ããã«ä½¿ãã®ã«ã¯ã¾ãã«ã´ã£ããã®ãã¼ã«ãªããããªããã¨æã£ã¦ãã¦ãä»åããããããã«åãçµãããã®æéãåããã¨ãã§ããã¾ãæä½éãã¹ãã¨ãã¦æå³ã®ããå½¢ã§çµã¿è¾¼ãã¨ããã¾ã§ã§ããã®ã§ãä¸åºåãã¨ãã¦ããã®è«¸ã ãã¾ã¨ãã¦ããããã¨æãã¾ãã
ãã£ã¦ã¿ã¦ã©ããªã£ãã
ãããªãçµè«ãã¨ããããPixela ã¨ãããµã¼ãã¹ã«å¯¾ã㦠runn ã使ããã¨ã§ã©ã®ãããªå¬ãããã¨ããã£ãããã¨ããã®ãã¾ã¨ãã¾ãã
1. ãã¹ã¦ã® Web API ãã²ã¨ã¨ãã使ããããªã·ããªãªãã¹ãããèªåã§å®è¡ã§ããç¶æ ã«ãªã£ã
ããããã¼ãã¹ãã¹ããã¨ããããã¹ã¢ã¼ã¯ãã¹ããã¨ãããããå¤ãã®ã¦ã¼ã¶ã¼ãè¡ãåºæ¬çãªæä½ããä»ãåé¡ãªãåãç¶æ ã«ãããã¨ãã常ã«æ軽ã«ç¢ºèªã§ããç¶æ ã«ããããªããã¨ã以åããèãã¦ããã®ã§ãããä»åã¾ããããã®ãããªç¶æ ãã¤ããããããã¨ãã§ãã¾ããã
Pixela ã® Web API ã«å¯¾ãã¦ã¯æ§ã ãªãã©ã¡ã¼ã¿ã渡ããã¨ãã§ããã®ã§ã決ãã¦ã1ã¤ã®APIã«å¯¾ãããã¹ãã1ã¤ã®ã·ããªãªã§ç¶²ç¾ ã§ãããã¨ããããã§ã¯ãªãã®ã§ãããç´°ãããã©ã¡ã¼ã¿ã®çµã¿åããã¨ããã«å¯¾å¿ããæåã«ã¤ãã¦ã¯åä½ã¬ãã«ã®ãã¹ãã§å¥éã«ãã¼ã§ãã¦ããï¼ãã¹ãï¼ãªã®ã§ãããã¯å²ãåã£ã¦æ´»ç¨ãã¦ãã¾ãã
ãããããã«ã¼ãã£ã³ã°ãå£ãã¦ãã¾ã£ã¦ããªããï¼ãã¨ãããããã¤å ã®å種çéç¶æ ã«åé¡ã¯èµ·ãã¦ããªããï¼ãã¨ãããã¨ã¯ãAPIéãã¾ããã æä½ã§æ´åæ§ãå´©ãã¦ãã¾ã£ã¦ããªããï¼ãã¨ãããããã£ãã¬ãã«ã§ã®ç¢ºèªã¯ããã¾ã§æåã§ãããã極ãã¦éå®çãªç¯å²ã«å¯¾ãã¦ãã確èªã§ãã¦ããªãã£ãã®ã§ãä»åãã®ä»çµã¿ãæ§ç¯ãããã¨ãã§ãã¦æ¬å½ã«æºè¶³ãã¦ãã¾ãã
åºæ¬çãªã¦ã¼ã¹ã±ã¼ã¹ã¯ runn ã§ãã¹ãããã¦ããç¶æ ã«ã§ããã®ã§ãä»å¾å¤æ´ãå ããã¨ãã§ããããã¾ã§ãããèªä¿¡ãæã£ã¦è¡ããã¨ãã§ãããã§ãã
ãã¡ããããããã¨ããããã¾ããï¼ããããã¾ã§ä¸æ°ã«ãããããå®å¿ãªç¶æ ã«ãªããä»å¾ã®éçºã«éãã¦ãå¿å¼·ããªãã¾ããï¼ðª
— a-know | Daisuke Inoue (@a_know) January 24, 2024
2. runn ã«ããAPIã·ããªãªãã¹ããããªãã¸ããªã«å¯¾ããpushãã¨ã«èªåã§è¡ãããããã«ã§ãã
GitHub Actions ãç¨æããã¦ããã®ã§ã極ãã¦ã¹ã ã¼ãºã«å°å ¥ãããã¨ãã§ãã¾ããã
ãã https://t.co/Ec5wmYDaXm pic.twitter.com/qZ7UtUTRSo
— a-know | Daisuke Inoue (@a_know) 2024å¹´1æ24æ¥
ã¤ã¤ããã¼ï¼ï¼ðð pic.twitter.com/YpL4WxgCeS
— a-know | Daisuke Inoue (@a_know) 2024å¹´1æ24æ¥
å人çã«ã debug
ãªãã·ã§ã³ã¯å¸¸ã«æå¹ã§ãããªãã¨æã£ã¦ãã¾ãã
3. æ½å¨ãã°ãããã¥ã¡ã³ãã¼ã·ã§ã³ããã¦ããªãã£ãä»æ§ããã¶ãåºããã¨ãã§ãã
ä¸è¿°ã®ã¨ããããµã¼ãã¹ãã¼ã³ã以é6å¹´ç®ã«çªå ¥ãã¦ããã¨ãããã¨ããããçµæ§ "æ¯ãã¦ãã" é¨åãå¤ããªã£ã¦ãã¦ããã®ã§ãæ³å®å¤ã®ãã°ã«åºãããã¨ãã£ããã¨ãï¼æ°æ©è½é¨å以å¤ã§ã¯ç¹ã«ï¼æè¿æ¸ã£ã¦ããã®ã§ãããä»å runn ã® runbook ãçµã¿ä¸ããéç¨ã§ãã¿ãã¨ã«ããããã¶ãåºããã¨ãã§ãã¾ãã......ï¼
runn ã§ãã¹ããä½ãéç¨ã§ãæ½å¨ãã°ãè¦ã¤ãããã¨ãã§ãã...ãã
— a-know | Daisuke Inoue (@a_know) January 18, 2024
å®ã«5å¹´ã¢ãã®ãã°ãã²ããð±ð±
ãããããåä½ãã¹ãã ããããªããã®ã¬ãã«ã®ãã¹ããè¡ãã¨ããæå³ã®ãã¡ã®ã²ã¨ã¤ã ããªãã¨å®æãã¾ãããããããããããåãçµã¿ããã¦ãªããã°ããããä»å¾ãèªåã§æ°ãã¤ããã¨ã¯ã§ããªãã£ãã ãããªããã¨ãæãã¾ããã
ã¾ããããã¥ã¡ã³ãã¼ã·ã§ã³ããã¦ããªãã£ãï¼ããããéçºå½åã¯æèã§ãã¦ããã§ãããï¼Pixela ã®ä»æ§ã«æ°ä»ãããããã¨ããåºæ¥äºãããã¾ããã
ããã¦ä»åã¯ãä½ã£ã人ã失念ãã¦ããããªå¾®å¦ãªä»æ§ãæãåºããã¦ãããããä¸ç¬ãã¾ããã°ãï¼ã¨æã£ããããã ã£ãð https://t.co/fxgjpAJYqn
— a-know | Daisuke Inoue (@a_know) January 24, 2024
å°ããå°ããã......ï¼ ä»¥éã®è¿½å éçºã®éã«ã¯ãRDDï¼runn-driven developmentï¼ã«ãææ¦ãã¦ããããã§ããã
runn ãå§ãã¦ã¿ãã«ããããäºåã«ç¢ºèªãããã®
åé ã§ãç´¹ä»ãããªã³ã©ã¤ã³ããã¯ã§ãããrunn ã¯ãã¯ããã¯ãã«ã¯ãä¸éãç®ãéãã¾ãããããããæåã¯è³¼å ¥ããæ°ãã³ãã³ã ã£ãã®ã§ãããè³¼å ¥ããªãã¨èªããªã Chapter ã«èªåãå¿ è¦ã¨ããããªæ å ±ããªãã£ãã®ã§ããããããç¡æã§èªã¾ãã¦ããã ãã¾ããã
ãã¨ã¯ããªãã¸ããªã® README ãä¸éã確èªãã¾ãããæ å ±ãå å®ãã¾ãã£ã¦ãã¦ç´ æ´ããããªã¨æãã¾ããã
èªåçtips
åºæ¬çã«ã¯ãä¸è¨ã®ã¯ãã¯ããã¯ã¨ README ã§å°ããã¨ã¯ãªãã£ãã®ã§ãããèªåçã«å°ãã¤ã¾ã¥ãããããªç®æã«ã¤ãã¦tipsçã«ã¾ã¨ãã¦ããã¾ãã
åã®ã¹ãããã®çµæãªã©ããå¾ãããæååã®ä¸é¨ãç·¨éããä¸ã§ãå¾ç¶ã®ã¹ãããã§ä½¿ç¨ãããã¨ã
Pixela ã§ã¯ã¾ãã«ãã®ãããªãã¨ãè¡ãå¿
è¦ã®ããã·ããªãªãå¤ãã¦ãä¾ãã°ãããã API ã«ãªã¯ã¨ã¹ãããçµæå¾ãããæåå 2024-01-23
ã 20240123
ã«ããä¸ã§ã次㮠API ã«æ¸¡ãããããã¨ãã£ããã¨ãã§ããªãã¨ã使ãããã¦ã使ããªããª......ã¨æã£ã¦ãã¾ããã
ã¯ãã¯ããã¯ã README ãããããã«é¢é£ããæ å ±ãè¦ã¤ãããã¨ãã§ããªãã£ãã®ã§ã以ä¸ã®ããã«ã¤ã¶ããã¦ã¿ãã¨ããã
åã®ã¹ãããã®çµæããã®ã¾ã¾ä½¿ããã¨ã¯ã§ããããã ãã©ãä¸é¨ãreplaceãããconcatããä¸ã§å¾ç¶ã§ä½¿ããã¨ãã¯ã§ããã®ããªï¼ {{}} ã®ä¸ãªãGoã®ã³ã¼ããæ¸ããï¼ #runn https://t.co/7rTFct7QQj
— a-know | Daisuke Inoue (@a_know) January 7, 2024
@k1LoW ãããæãã®æãå·®ã伸ã¹ã¦ããã¾ããããããã¨ããããã¾ããããã¨ããããã¾ãã
https://t.co/A3QFGHkxyA ãã¸ããé§ä½¿ããããããããï¼ã§ã
— k1LoW (@k1LoW) January 11, 2024
ãã¨ã¯çµã¿è¾¼ã¾ãã¦ãã https://t.co/FJFmolhMHu ã使ãã¨ãã§ãããã¼
— k1LoW (@k1LoW) January 11, 2024
ä»åã®ã±ã¼ã¹ã§ã¯ãããããã runn ã«çµã¿è¾¼ãã§ããã ãã¦ãã expr ããã³ãã·ã£ã§ããããã§é£ãªãã·ããªãªãä½ããã¨ãã§ãã¾ããã
ãã¨ãã°ãä»åä½ã£ã runbook ã«ã¯ä»¥ä¸ã®ãããªè¨è¿°ãã¨ããã©ããã«å«ã¾ãã¦ãã¾ãã
body: application/json: - date: "{{string(int(replace(steps[xx].res.body.maxDate, '-', '')) - 1)}}"
éä¸ã§ãã¹ãã失æããå ´åã§ããæ¯åå®è¡ãã¦ã»ããã¹ããããããå ´å
ãããã before/after ããsetup/teardown ç¸å½ã®ãã¨ã runn ã§ããããã¨ãã«ã©ãããã°ããã®ï¼ã¨ãããã®ã§ãããä»åã®èªåã®ã±ã¼ã¹ã®å ´åããã¹ãã®ããã«ä½æããã¦ã¼ã¶ã¼ã¯æå¾ã«ã¯å¿ ãåé¤ãã¦ãããããã¨ãã£ããã¼ãºãããã¾ããã
runn ã§ãéä¸ã®ã¹ãããã失æããå ´åã§ãå¿ ããã®ã¹ãããã ãã¯å®æ½ãããã¿ãããªã®ã£ã¦ã§ããã®ããªï¼ ð #runn
— a-know | Daisuke Inoue (@a_know) January 18, 2024
ããã«ã¤ãã¦ã¯ãã§ã« issue ãä½æããè°è«ãé²ãã§ãããã®ã®ãã¾ã æ©è½ã¨ãã¦ã¯å®è£
ããã¦ããªãããã§ãããã®ããä»å㯠force
ã使ããã¨ã«ãã¾ããã
ããã¯ããã¹ã¦ã®ã¹ããããæ¯åå¿ ãå®æ½ãããããã®ãã®ã§ããä»®ã«ã·ããªãªã®åé ã®ã¹ãããã§ãã¹ãã失æãã¦ãã¾ããããã«ãã£ã¦ãã以éã®ã¹ãããããã¹ã¦å¤±æãããã¨ãããã£ã¦ããã¨ãã¦ããteardown ç¸å½ã®ã¹ããããå«ããã®ãããã¹ã¦ã®ã¹ããããæç´ã«å®è¡ãããã¨ããæåã«ãªãã®ã§ãå°ãã¹ãã¼ãã§ã¯ãªãæãã¯ããã¾ãããå°ãªãã¨ã teardown ç¸å½ã®å¦çãæ¼ãããã¨ãããã¨ã¯ç¡ãããã¨ãã§ãã¾ããã
Web API ã«å¯¾ãããã¹ãã®ããã® runbook ãä½ãã®ã«ã¯ runn new --and-run
ã便å©ï¼
ã¨ã¦ã便å©ã§ãããããããªãã£ããããã¾ã§ã®ã¹ãã¼ãã§ä»åã®ãã¹ããçµã¿ä¸ãããã¨ã¯ã§ããªãã£ãã§ãããããããããéä¸ã§å¿ãæãã¦ãã¾ã£ã¦ããå¯è½æ§ããã£ããªãã¨ããæãã¾ãã
ãã¾ãã»åã㦠GitHub Sponsor ã§ã¹ãã³ãµã¼ã«ãªã£ã¦ã¿ã
以ä¸ãå人çãªãã¼ãºããã£ã¦ k1LoW/runn ã使ã£ã¦ã¿ããã¨ã«ã¤ãã¦ã¾ã¨ãã¦ã¿ã¾ããã
ããããã¯ä½è«ãªã®ã§ãããä»åã®åãçµã¿ãéã㦠runn ã«é¢ãããããããã¨ã»ãã®ã«å¯¾ãã¦æ·±ãæè¬ã®æ°æã¡ãçºçãã端çã«è¨ãã¨å¤§å¥½ãã«ãªã£ããããå°é¡ã»ã¯ã³ã¿ã¤ã ã§ã¯ããã¾ãããGitHub Sponsor ã«ããå¯ä»ãè¡ã£ã¦ã¿ã¾ããã
ð I'm sponsoring @k1LoW because k1LoW/runn is a great tool! https://t.co/e0TJyueLMW
— a-know | Daisuke Inoue (@a_know) January 24, 2024
GitHub Sponsor ã使ãã®ã¯ä»ååãã¦ã ã£ãã®ã§ãããç¹ã«ã¤ã¾ã¥ããã¨ãªãã¹ã ã¼ãºã«ã§ãã¾ãããããªã«ããç¹å¥ãª "ããæ°æã¡" ã«ãªããã¨ãã§ãã¦è¯ãã£ãã§ããããããå½¢ã§ã® contribute ããä»å¾ã¯ãã£ã¦ãããããªã¨æãã¾ããã