Skip to content

Commit

Permalink
chore: update to argocd cicd
Browse files Browse the repository at this point in the history
  • Loading branch information
CChuYong committed Jul 24, 2024
1 parent c66fefd commit 5a6d1c1
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 12 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/deploy-argocd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
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
default-image-name:
required: true
type: string
image-name:
required: true
type: string
environment:
required: true
type: string
image-tag:
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.default-image-name }}=${{ 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 "release(${{ inputs.service-name }}): 자동배포 ${{ inputs.image-name }}:${{ inputs.image-tag }}"
git config pull.rebase true
git pull && git push -u origin main
22 changes: 10 additions & 12 deletions .github/workflows/dev-cicd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,19 +69,17 @@ jobs:
call-deploy-workflow:
if: github.event_name == 'push'
needs: [ prepare-variables, call-build-workflow ]
name: AWS ECS 배포
uses: ./.github/workflows/deploy-ecs.yaml
name: ArgoCD로 배포하기
uses: ./.github/workflows/deploy-argocd.yaml
permissions:
id-token: write
contents: read
contents: write
with:
argocd-repo-name: bibbi-team/bibbi-argocd-manifest
overlay-name: ${{ needs.prepare-variables.outputs.spring-profile }}
service-name: bibbi-backend-api
image-name: bibbi-backend-api-dev
image-tag: ${{ needs.prepare-variables.outputs.image-tag }}
environment: development
ecs-service: ${{ needs.prepare-variables.outputs.ecs-service }}
ecs-cluster: ${{ needs.prepare-variables.outputs.ecs-cluster }}
ecr-task-definition: ${{ needs.prepare-variables.outputs.ecr-task-definition }}
image-url: ${{ needs.call-build-workflow.outputs.image-url }}
default-image-name: no5ing/bibbi-backend-api
secrets:
AWS_ASSUME_ROLE_ARN: ${{ secrets.AWS_ASSUME_ROLE_ARN }}
AWS_ECR_REGISTRY_URL: ${{ secrets.AWS_ECR_REGISTRY_URL }}
AWS_REGION: ${{ secrets.AWS_REGION }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
PAT_TOKEN: ${{ secrets.PAT_TOKEN }}

0 comments on commit 5a6d1c1

Please sign in to comment.