Skip to content

Commit 51382a6

Browse files
authored
develop -> main
develop -> main
2 parents f243117 + 39e9e5c commit 51382a6

169 files changed

Lines changed: 12902 additions & 946 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.dockerignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
**
2+
3+
!Dockerfile
4+
!.dockerignore
5+
!build/
6+
!build/libs/
7+
!build/libs/KONECT_API.jar
8+
!opentelemetry-javaagent.jar

.github/workflows/checkstyle.yml

Lines changed: 80 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,80 @@
1-
name: Checkstyle
2-
3-
on:
4-
pull_request:
5-
branches:
6-
- main
7-
- develop
8-
push:
9-
branches:
10-
- main
11-
- develop
12-
13-
permissions:
14-
contents: read
15-
pull-requests: write
16-
17-
jobs:
18-
checkstyle:
19-
name: Code Style Check
20-
runs-on: ubuntu-latest
21-
22-
steps:
23-
- name: Checkout code
24-
uses: actions/checkout@v4
25-
with:
26-
submodules: recursive
27-
token: ${{ secrets.SUBMODULE_TOKEN }}
28-
29-
- name: Set up JDK 21
30-
uses: actions/setup-java@v4
31-
with:
32-
java-version: '21'
33-
distribution: 'temurin'
34-
35-
- name: Cache Gradle packages
36-
uses: actions/cache@v3
37-
with:
38-
path: |
39-
~/.gradle/caches
40-
~/.gradle/wrapper
41-
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
42-
restore-keys: |
43-
${{ runner.os }}-gradle-
44-
45-
- name: Grant execute permission for gradlew
46-
run: chmod +x gradlew
47-
48-
- name: Run Checkstyle
49-
run: ./gradlew checkstyleMain --no-daemon
50-
51-
- name: Upload Checkstyle Report
52-
if: failure()
53-
uses: actions/upload-artifact@v4
54-
with:
55-
name: checkstyle-report
56-
path: |
57-
build/reports/checkstyle/main.html
58-
build/reports/checkstyle/main.xml
59-
retention-days: 7
60-
61-
- name: Comment PR with Checkstyle Results
62-
if: github.event_name == 'pull_request' && failure()
63-
uses: actions/github-script@v7
64-
with:
65-
github-token: ${{ secrets.GITHUB_TOKEN }}
66-
script: |
67-
const fs = require('fs');
68-
const path = require('path');
69-
70-
let comment = '## ⚠️ Checkstyle 위반 사항 발견\n\n';
71-
comment += 'Checkstyle 검사에서 코딩 컨벤션 위반이 발견되었습니다.\n\n';
72-
comment += '### 📋 상세 리포트\n';
73-
comment += '- [Main 소스 리포트 다운로드](../actions/runs/${{ github.run_id }})\n';
74-
75-
github.rest.issues.createComment({
76-
issue_number: context.issue.number,
77-
owner: context.repo.owner,
78-
repo: context.repo.repo,
79-
body: comment
80-
});
1+
name: Checkstyle
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
- develop
8+
push:
9+
branches:
10+
- main
11+
- develop
12+
13+
permissions:
14+
contents: read
15+
pull-requests: write
16+
17+
jobs:
18+
checkstyle:
19+
name: Code Style Check
20+
runs-on: ubuntu-latest
21+
22+
steps:
23+
- name: Checkout code
24+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
25+
with:
26+
submodules: recursive
27+
token: ${{ secrets.SUBMODULE_TOKEN }}
28+
29+
- name: Set up JDK 21
30+
uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4
31+
with:
32+
java-version: '21'
33+
distribution: 'temurin'
34+
35+
- name: Cache Gradle packages
36+
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
37+
with:
38+
path: |
39+
~/.gradle/caches
40+
~/.gradle/wrapper
41+
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
42+
restore-keys: |
43+
gradle-${{ runner.os }}-
44+
45+
- name: Grant execute permission for gradlew
46+
run: chmod +x gradlew
47+
48+
- name: Run Checkstyle
49+
run: ./gradlew checkstyleMain --no-daemon
50+
51+
- name: Upload Checkstyle Report
52+
if: failure()
53+
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4
54+
with:
55+
name: checkstyle-report
56+
path: |
57+
build/reports/checkstyle/main.html
58+
build/reports/checkstyle/main.xml
59+
retention-days: 7
60+
61+
- name: Comment PR with Checkstyle Results
62+
if: github.event_name == 'pull_request' && failure()
63+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7
64+
with:
65+
github-token: ${{ secrets.GITHUB_TOKEN }}
66+
script: |
67+
const fs = require('fs');
68+
const path = require('path');
69+
70+
let comment = '## ⚠️ Checkstyle 위반 사항 발견\n\n';
71+
comment += 'Checkstyle 검사에서 코딩 컨벤션 위반이 발견되었습니다.\n\n';
72+
comment += '### 📋 상세 리포트\n';
73+
comment += '- [Main 소스 리포트 다운로드](../actions/runs/${{ github.run_id }})\n';
74+
75+
github.rest.issues.createComment({
76+
issue_number: context.issue.number,
77+
owner: context.repo.owner,
78+
repo: context.repo.repo,
79+
body: comment
80+
});

.github/workflows/deploy-monitoring.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ jobs:
1313
runs-on: ubuntu-latest
1414
steps:
1515
- name: Checkout code
16-
uses: actions/checkout@v4
16+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
1717

1818
- name: Transfer monitoring configs to server
19-
uses: appleboy/scp-action@v0.1.7
19+
uses: appleboy/scp-action@917f8b81dfc1ccd331fef9e2d61bdc6c8be94634 # v0.1.7
2020
with:
2121
host: ${{ secrets.SERVER_IP }}
2222
username: ${{ secrets.SERVER_USER }}
@@ -27,7 +27,7 @@ jobs:
2727
rm: false
2828

2929
- name: Deploy monitoring stack
30-
uses: appleboy/ssh-action@v0.1.8
30+
uses: appleboy/ssh-action@v1.2.0
3131
env:
3232
WORK_DIR: ${{ secrets.PROD_WORK_DIR }}
3333
MONITORING_ENV: ${{ secrets.MONITORING_ENV }}

.github/workflows/deploy-prod.yml

Lines changed: 40 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@ jobs:
1111

1212
steps:
1313
- name: Checkout code
14-
uses: actions/checkout@v4
14+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
1515

1616
- name: Set up JDK 21
17-
uses: actions/setup-java@v4
17+
uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4
1818
with:
1919
java-version: '21'
2020
distribution: 'temurin'
2121

2222
- name: Cache Gradle packages
23-
uses: actions/cache@v4
23+
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
2424
with:
2525
path: |
2626
~/.gradle/caches
@@ -29,6 +29,23 @@ jobs:
2929
restore-keys: |
3030
gradle-${{ runner.os }}-
3131
32+
- name: Cache OpenTelemetry Java Agent
33+
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
34+
with:
35+
path: ~/.cache/otel-java-agent
36+
key: otel-agent-${{ runner.os }}-${{ vars.OTEL_JAVA_AGENT_VERSION }}-${{ vars.OTEL_JAVA_AGENT_SHA256 }}
37+
38+
- name: Prepare OpenTelemetry Agent
39+
run: |
40+
mkdir -p ~/.cache/otel-java-agent
41+
if [ ! -f ~/.cache/otel-java-agent/opentelemetry-javaagent.jar ]; then
42+
wget -O ~/.cache/otel-java-agent/opentelemetry-javaagent.jar \
43+
"https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v${{ vars.OTEL_JAVA_AGENT_VERSION }}/opentelemetry-javaagent.jar"
44+
fi
45+
# Verify checksum
46+
echo "${{ vars.OTEL_JAVA_AGENT_SHA256 }} $HOME/.cache/otel-java-agent/opentelemetry-javaagent.jar" | sha256sum -c -
47+
cp ~/.cache/otel-java-agent/opentelemetry-javaagent.jar .
48+
3249
- name: Grant execute permission for gradlew
3350
run: chmod +x gradlew
3451

@@ -38,46 +55,49 @@ jobs:
3855
source .env.example
3956
set +a
4057
unset JAVA_TOOL_OPTIONS
41-
./gradlew clean build -x test -Dspring.profiles.active=prod
58+
./gradlew bootJar -x test --build-cache -Dspring.profiles.active=prod
4259
4360
- name: Set up Docker Buildx
44-
uses: docker/setup-buildx-action@v3
61+
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
4562

4663
- name: Login to Docker Hub
47-
uses: docker/login-action@v3
64+
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3
4865
with:
4966
username: ${{ secrets.DOCKERHUB_USERNAME }}
5067
password: ${{ secrets.DOCKERHUB_TOKEN }}
5168

5269
- name: Extract metadata for Docker
5370
id: meta
54-
uses: docker/metadata-action@v5
71+
uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5
5572
with:
5673
images: soundbar91/konect-prod
5774
tags: |
5875
type=raw,value=latest
5976
type=sha,prefix=sha-
6077
6178
- name: Build and push Docker image
62-
uses: docker/build-push-action@v5
79+
uses: docker/build-push-action@ca052bb54ab0790a636c9b5f226502c73d547a25 # v5
6380
with:
6481
context: .
65-
platforms: linux/amd64,linux/arm64
82+
platforms: linux/arm64
6683
push: true
6784
tags: ${{ steps.meta.outputs.tags }}
6885
labels: ${{ steps.meta.outputs.labels }}
6986
cache-from: type=gha
7087
cache-to: type=gha,mode=max
88+
build-args: |
89+
OTEL_JAVA_AGENT_VERSION=${{ vars.OTEL_JAVA_AGENT_VERSION }}
7190
7291
- name: Backup prod MySQL before deploy
73-
uses: appleboy/ssh-action@v0.1.8
92+
uses: appleboy/ssh-action@v1.2.0
7493
with:
7594
host: ${{ secrets.PROD_SERVER_IP }}
7695
username: ${{ secrets.PROD_SERVER_USER }}
7796
key: ${{ secrets.PROD_SERVER_SSH_KEY }}
7897
port: ${{ secrets.PROD_SERVER_PORT }}
7998
script: |
8099
set -euo pipefail
100+
START_TIME=$(date +%s)
81101
82102
WORK_DIR="${{ secrets.PROD_WORK_DIR }}"
83103
MYSQL_CONTAINER="mysql-prod"
@@ -96,13 +116,22 @@ jobs:
96116
97117
find "$BACKUP_DIR" -type f -name '*.sql' -mtime +30 -delete
98118
119+
END_TIME=$(date +%s)
120+
echo "Prod MySQL backup completed in $((END_TIME - START_TIME))s"
121+
99122
- name: Deploy to prod server
100-
uses: appleboy/ssh-action@v0.1.8
123+
uses: appleboy/ssh-action@v1.2.0
101124
with:
102125
host: ${{ secrets.PROD_SERVER_IP }}
103126
username: ${{ secrets.PROD_SERVER_USER }}
104127
key: ${{ secrets.PROD_SERVER_SSH_KEY }}
105128
port: ${{ secrets.PROD_SERVER_PORT }}
106129
script: |
130+
set -euo pipefail
131+
START_TIME=$(date +%s)
132+
107133
cd ${{ secrets.PROD_WORK_DIR }}
108134
./deploy.sh
135+
136+
END_TIME=$(date +%s)
137+
echo "Prod deploy.sh completed in $((END_TIME - START_TIME))s"

0 commit comments

Comments
 (0)