Skip to content

Commit c5a3f65

Browse files
authored
Update loadtest CI/CD workflow structure
Refactor load test CI/CD workflow to include build and deploy jobs with conditional execution based on input parameters.
1 parent 7ce561c commit c5a3f65

1 file changed

Lines changed: 18 additions & 12 deletions

File tree

β€Ž.github/workflows/loadtest-cd.ymlβ€Ž

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ name: Load Test CD
33
on:
44
push:
55
branches: [ loadtest ]
6-
paths:
7-
- 'backend/**'
86
workflow_dispatch:
97
inputs:
108
skip_build:
@@ -23,51 +21,47 @@ env:
2321
SPRING_PROFILES_ACTIVE: loadtest
2422

2523
jobs:
26-
deploy:
27-
runs-on: [ self-hosted, "turip-server-dev" ]
24+
build:
25+
if: github.event_name == 'push' || github.event.inputs.skip_build != 'yes'
26+
runs-on: ubuntu-latest
2827

2928
steps:
3029
- name: Checkout repository
3130
uses: actions/checkout@v4
3231

3332
- name: Set up JDK ${{ env.JAVA_VERSION }}
34-
if: github.event.inputs.skip_build != 'yes'
3533
uses: actions/setup-java@v4
3634
with:
3735
java-version: ${{ env.JAVA_VERSION }}
3836
distribution: 'temurin'
3937
cache: 'gradle'
4038

4139
- name: Build Jar (ν…ŒμŠ€νŠΈ μŠ€ν‚΅)
42-
if: github.event.inputs.skip_build != 'yes'
4340
working-directory: ${{ env.WORKING_DIR }}
4441
run: |
4542
chmod +x gradlew
4643
./gradlew :turip-app:bootJar -x test
4744
4845
- name: Prepare OpenTelemetry agent
49-
if: github.event.inputs.skip_build != 'yes'
5046
working-directory: ${{ env.WORKING_DIR }}
5147
run: |
5248
mkdir -p otel
5349
curl -L -o otel/opentelemetry-javaagent.jar \
5450
https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v2.10.0/opentelemetry-javaagent.jar
5551
5652
- name: Login to Docker Hub
57-
if: github.event.inputs.skip_build != 'yes'
5853
uses: docker/login-action@v3.3.0
5954
with:
6055
username: ${{ secrets.DOCKERHUB_USERNAME }}
6156
password: ${{ secrets.DOCKERHUB_TOKEN }}
6257

58+
- name: Set up QEMU (arm64 크둜슀 λΉŒλ“œμš©)
59+
uses: docker/setup-qemu-action@v3
60+
6361
- name: Set up Docker Buildx
64-
if: github.event.inputs.skip_build != 'yes'
6562
uses: docker/setup-buildx-action@v3.7.1
66-
with:
67-
driver-opts: network=host
6863

6964
- name: Build and push image
70-
if: github.event.inputs.skip_build != 'yes'
7165
uses: docker/build-push-action@v6.10.0
7266
with:
7367
context: ./${{ env.WORKING_DIR }}
@@ -78,6 +72,15 @@ jobs:
7872
cache-from: type=registry,ref=${{ env.DOCKER_IMAGE_REPO }}:${{ env.IMAGE_TAG }}
7973
cache-to: type=inline
8074

75+
deploy:
76+
needs: build
77+
if: always() && (needs.build.result == 'success' || needs.build.result == 'skipped')
78+
runs-on: [ self-hosted, "turip-server-dev" ]
79+
80+
steps:
81+
- name: Checkout repository
82+
uses: actions/checkout@v4
83+
8184
- name: Write .env
8285
working-directory: ${{ env.WORKING_DIR }}
8386
run: |
@@ -100,6 +103,9 @@ jobs:
100103
KOREA_TOURISM_API_KEY=${{ secrets.KOREA_TOURISM_API_KEY }}
101104
ENVEOF
102105
106+
- name: Pull latest image
107+
run: docker pull ${{ env.DOCKER_IMAGE_REPO }}:${{ env.IMAGE_TAG }}
108+
103109
# ── 배포 ──────────────────────────────────────────────────────────────
104110
- name: Deploy
105111
working-directory: ${{ env.WORKING_DIR }}

0 commit comments

Comments
Β (0)