Skip to content

Commit

Permalink
chore: add cicd argo
Browse files Browse the repository at this point in the history
  • Loading branch information
CChuYong committed Jul 13, 2024
1 parent 2c37ee3 commit 6202bb0
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 1 deletion.
16 changes: 16 additions & 0 deletions .github/workflows/api-gateway.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,19 @@ jobs:
secrets:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}

call-deploy-workflow:
needs: [ prepare-variables, call-build-workflow ]
name: ArgoCD로 배포하기
uses: ./.github/workflows/argocd-deploy.yaml
permissions:
contents: write
with:
argocd-repo-name: YAPP-Github/mafoo-argocd-manifest
overlay-name: ${{ needs.prepare-variables.outputs.spring-profile }}
service-name: ${{ needs.prepare-variables.outputs.module-path }}
image-name: spinachpasta/api-gateway
image-tag: ${{ needs.prepare-variables.outputs.image-tag }}
environment: ${{ needs.prepare-variables.outputs.spring-profile }}
secrets:
PAT_TOKEN: ${{ secrets.PAT_TOKEN }}
52 changes: 52 additions & 0 deletions .github/workflows/argocd-deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: ArgoCD로 배포하기
on:
workflow_call:
inputs:
argocd-repo-name:
required: true
type: string
overlay-name:
required: true
type: string
service-name:
required: true
type: string
image-name:
required: true
type: string
environment:
required: true
type: string
image-tage:
required: true
type: string
secrets:
PAT_TOKEN:
required: true

jobs:
build:
runs-on: [ ubuntu-latest ]
name: ArgoCD로 배포하기

environment: ${{ inputs.environment }}

steps:
- name: GitHub 에서 레포 받아오기
uses: actions/checkout@v3
with:
repository: ${{ inputs.argocd-repo-name }}
token: ${{ secrets.PAT_TOKEN }}

- name: Kustomize 설정하기
uses: imranismail/setup-kustomize@v2

- name: 이미지 태그 변경 후 배포하기
run: |
cd modules/${{ inputs.service-name }}/overlays/${{ inputs.overlay-name }}
kustomize edit set image ${{ inputs.image-name }}:${{ inputs.image-tag }}
cat kustomization.yaml
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git commit -am "deploy(${{ inputs.service-name }}): 자동배포 ${{ inputs.image-name }}"
git push -u origin main
1 change: 0 additions & 1 deletion api-gateway/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ repositories {
extra["springCloudVersion"] = "2023.0.2"

dependencies {
//implementation("org.springframework.boot:spring-boot-starter-security")
implementation("org.springframework.cloud:spring-cloud-starter-gateway")
implementation("org.springframework.boot:spring-boot-starter-actuator")
implementation("org.springdoc:springdoc-openapi-starter-webflux-ui:2.5.0")
Expand Down

0 comments on commit 6202bb0

Please sign in to comment.