⚡️ 풀 리퀘스트를 쿠버네티스에 배포하여 머지하기 전에 테스트 해볼 수 있도록 만들어주는 GitHub Action

Overview

PR preview deploy k8s (GitHub Action)

Project Contributors Project License

⚡️ 풀 리퀘스트를 쿠버네티스에 배포하여 머지하기 전에 테스트 해볼 수 있도록 만들어주는 GitHub Action 입니다.

최대한 단순하게 구현을 하려고 노력하였습니다.

만약, 더 나은 방법을 알고 계시다면 꼭 알려주시길 부탁드립니다. 🙇‍♂️

풀 리퀘스트에 "/deploy"와 같은 특정 커맨드를 커멘트로 남기면 → 배포가 되고 → 배포된 서버의 URL이 풀 리퀘스트에 커멘트로 올라옵니다.

AWS 기준으로 이 환경 구성에,
EC2 1대, Route53 도메인 1개가 필요합니다.

무료로도 할 수 있으며, 이에 대한 자세한 방법은 아래에 서술해두었습니다.

사용 예시

어떤 상황에서 쓰일 수 있는가:

  • 기획서와 디자인 시안을 보고 열심히 웹 개발함 → PR을 만듦 → PR을 배포함 → 재택 중이신 기획자와 디자이너에게 채팅으로 URL을 전달함 → 원하는대로 잘 구현되었는지 기획자와 디자이너가 평가할 수 있음
  • 개발한 서버가 하루내내 부하를 줘도 안죽는 경우에만 머지를 하고 싶음 → PR을 만듦 → PR을 배포함 → 하루내내 부하를 줌 → 안정적인 기능만 머지할 수 있음
  • 백엔드 개발자가 새로 작업한 기능을 개발 브랜치에 머지하기 전에 프론트 개발자에게 전달하고 싶음 → PR을 만듦 → PR을 배포함 → 프론트 개발자에게 전달함 → 프론트 개발자가 새로 작업한 기능에 대한 피드백을 백엔드 개발자에게 함 → 백엔드 개발자가 수정 ... → 작업 완료 후 개발 브랜치에 머지 → 미완성된 기능이 개발 브랜치에 머지되는 것을 막을 수 있음

대충 이런 느낌으로 쓰일 수 있습니다:

#3

구조

image

동작 과정

각 GitHub Action 파일에 주석으로 간단하게 설명해두었습니다.

배포

pr-preview-deploy.yml

제거

pr-preview-undeploy.yml

내 프로젝트에 설정하는 방법

무료로 하는 법

아래 리소스들을 사용하면 무료로 환경을 구성할 수 있습니다:

설정 과정

① 이 레퍼지토리에 있는 GitHub Action 들을 메인 브랜치에 복사 붙혀넣기 합니다. (./github/workflows/*.yml)

② 이 레퍼지토리에 있는 kubernetes.yml과 Dockerfile을 메인 브랜치에 복사 붙혀넣기 하고, 작업 환경에 맞춰 업데이트 해줍니다.

③ GitHub Action Secrets을 설정합니다:

PREVIEW_SERVER_HOST_NAME="프리뷰 서버 호스트 주소를 입력해주세요. (아이피 말고 도메인 주소를 입력하셔야 합니다. 예: rhea.n-e.kr)"
PREVIEW_SERVER_HOST_USER="프리뷰 서버 호스트 SSH 접속시 사용할 유저 이름을 입력해주세요 (예: root)"
PREVIEW_SERVER_HOST_PEM_KEY="프리뷰 서버 호스트 SSH 접속시 사용할 인증 키를 입력해주세요 (-----BEGIN RSA PRIVATE KEY-----로 시작합니다)"

④ 프리뷰 서버에 쿠버네티스를 설치합니다. (k3s를 추천합니다)

⑤ PR을 만들고, 테스트 해봅니다.

질문

질문이나 도움이 필요하신 분들은 이 디스코드 채널을 이용 부탁드립니다. 프로젝트의 이슈 목록은 기능 추가 요청이나 버그 제보용으로만 사용됩니다.

라이선스

프로젝트에는 MIT 라이선스가 적용되어 있습니다.

You might also like...

GitHub action code for VMware Image Builder (VIB).

VMware Image Builder Overview This GitHub Action allows to interact with the VMware Image Builder service from VMware, a.k.a. VIB. VIB is a SaaS servi

Dec 22, 2022

⚙️ A GitHub Action to push a feed item to RSS3 network

RSS3 Github Action Update a users feed to reflect changes in a Github Repository. Setup Have a copy of your private key Add an environment secret to y

Apr 26, 2022

🚀 A GitHub action to publish a new release of the repository

Create a JavaScript Action using TypeScript Use this template to bootstrap the creation of a TypeScript action. 🚀 This template includes compilation

Nov 1, 2022

💅 A ready-to-go with a well-thought-out structure Electron app boilerplate with ReactJS, TypeScript, CSS / SASS modules, SWC, Eslint, Prettier, GitHub Action releases and more.

💅 A ready-to-go with a well-thought-out structure Electron app boilerplate with ReactJS, TypeScript, CSS / SASS modules, SWC, Eslint, Prettier, GitHub Action releases and more.

Electron App 💅  A ready-to-go with a well-thought-out structure Electron app boilerplate with ReactJS, TypeScript, CSS / SASS modules, SWC, Eslint, P

Dec 29, 2022

This GitHub Action will setup a Nushell environment for you.

setup-nu 中文说明 This GitHub Action will setup a Nushell environment for you. Usage Examples In most cases you need to specify the version of Nushell to

Dec 30, 2022

GitHub action to automate managing repositories with labels, milestones and projects.

triagecat GitHub action to automate managing repositories with labels, milestones and projects. Link issues and PRs labels. Add issues and PRs to a pr

Jun 14, 2022

A GitHub action to run Dart analyzer with annotation support.

A GitHub action to run Dart analyzer with annotation support.

⚒️ GitHub Action for Dart Analyzer A GitHub action to run Dart analyzer with annotation support. License Usage name: "analyze" on: # rebuild any PRs a

Dec 28, 2022

🛠️ GitHub Action for `fuelup` commands

fuel-toolchain Action Use this action to install the Fuel toolchain using fuelup. Heavily based on @actions-rs/toolchain. Example workflow on: [push]

Dec 15, 2022

Github action to collect metrics (CPU, memory, I/O, etc ...) from your workflows to help you debug and optimize your CI/CD pipeline

Github action to collect metrics (CPU, memory, I/O, etc ...) from your workflows to help you debug and optimize your CI/CD pipeline

workflow-telemetry-action A GitHub Action to track and monitor the resource metrics of your GitHub Action workflow runs. If the run is triggered via a

Dec 30, 2022
Owner
Rhea's Lab
Here is a laboratory that does what I want to do.
Rhea's Lab
A GitHub action to submit your dependency graph from your Mill build to GitHub.

Mill Dependency Submission A GitHub action to submit your dependency graph from your Mill build to GitHub via their Dependency Submission API. The mai

Chris Kipp 6 Dec 15, 2022
A GitHub Action that allows to debug GitHub workflows using VS Code.

VS Code Server Action A GitHub Action that allows to debug GitHub workflows using VS Code. Failing CI builds can be annoying especially since we don't

stateful 18 Dec 23, 2022
A github action that provides detailed bundle analysis on PRs for next.js apps

Next.js Bundle Analysis Github Action Analyzes each PR's impact on your next.js app's bundle size and displays it using a comment. Optionally supports

HashiCorp 369 Dec 27, 2022
A custom action for setting GitHub Workflow environment variables with YAML configuration files.

yaml-env-action - A custom action for setting GitHub Workflow environment variables with YAML configuration files. Introduction yaml-env-action is a c

Piper Dougherty 3 Dec 13, 2022
Setup-graalvm - GitHub Action for setting up GraalVM CE.

GitHub Action for GraalVM This GitHub action sets up GraalVM Community Edition and GraalVM components such as Native Image and GraalVM languages. Key

GraalVM 105 Jan 2, 2023
A GitHub Action for pushing to a repo.

action-gh-push A GitHub Action for pushing to a repo. ?? Usage Below is a simple example of step.if tag gating name: ci on: push jobs: build:

迷渡 6 Feb 15, 2022
A GitHub Action to cache your workload to a Google Cloud Storage bucket.

Google Cloud Storage Cache Action GitHub already provides an awesome action to cache your workload to Azure's servers hosted in United States. However

MansaGroup 9 Dec 15, 2022
🤖 GitHub Action which creates Issues from comments in your code

todo-issue[action] Disclosure Huge thanks to JasonEtco! After he decided to shut down his todo[bot] I've looked around for alternatives but decided to

Julian 17 Dec 11, 2022
GitHub action to install Foundry

foundry-toolchain Action This GitHub action installs Foundry. Example workflow on: [push] name: test jobs: check: name: Foundry project ru

Bjerg 128 Jan 5, 2023
Github action to parse OWNERS files and outputs random reviewers

Get Owners Github Action Do you want to have all the approvers and reviewers without having strange scripts in your actions? Do you want to have rando

Ugo Palatucci 3 Oct 22, 2022