Skip to content

Commit

Permalink
chore: test
Browse files Browse the repository at this point in the history
  • Loading branch information
Seungpang committed Dec 13, 2023
2 parents 0e33101 + a3bdabc commit e119e04
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 35 deletions.
17 changes: 7 additions & 10 deletions .github/workflows/click-service-cd.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: cd for click-service
on:
pull_request:
push:
branches: [ main ]
paths:
- click-service/**
Expand Down Expand Up @@ -36,11 +36,11 @@ jobs:
with:
credentials_json: ${{ secrets.GCE_SA_KEY }}

- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v1
- id: 'get-credentials'
uses: google-github-actions/get-gke-credentials@v1
with:
project_id: ${{ env.PROJECT_ID }}
install_components: gke-gcloud-auth-plugin
cluster_name: autopilot-cluster-2
location: ${{ env.REGION }}

- name: Use gcloud CLI
run: gcloud info
Expand All @@ -53,15 +53,12 @@ jobs:
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'corretto'
distribution: 'temurin'

- name: Docker Build
if: success()
run: ../gradlew jib

- name: Deploy
run: |
gcloud container clusters get-credentials autopilot-cluster-2 --region ${{env.REGION}} --project ${{env.PROJECT_ID}}
sed "s,\${image},${{ env.IMAGE }}:${{env.IMAGE}},g" resources.yaml > deployment.yaml
sed "s,\${image},${{ env.IMAGE }},g" resources.yaml > deployment.yaml
kubectl apply -f ./deployment.yaml
9 changes: 9 additions & 0 deletions .github/workflows/click-service-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@ jobs:
- name: Check out Repository
uses: actions/checkout@v3

- name: cache
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-gradle

- name: set up JDK 17
uses: actions/setup-java@v3
with:
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/transfer-service-cd.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: cd for transfer-service
on:
pull_request:
push:
branches: [ main ]
paths:
- transfer-service/**
Expand Down Expand Up @@ -36,11 +36,11 @@ jobs:
with:
credentials_json: ${{ secrets.GCE_SA_KEY }}

- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v1
- id: 'get-credentials'
uses: google-github-actions/get-gke-credentials@v1
with:
project_id: ${{ env.PROJECT_ID }}
install_components: gke-gcloud-auth-plugin
cluster_name: autopilot-cluster-2
location: ${{ env.REGION }}

- name: Use gcloud CLI
run: gcloud info
Expand All @@ -53,14 +53,14 @@ jobs:
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'corretto'
distribution: 'temurin'

- name: Docker Build
if: success()
run: ../gradlew jib

- name: Deploy
run: |
gcloud container clusters get-credentials autopilot-cluster-2 --region ${{env.REGION}} --project ${{env.PROJECT_ID}}
sed "s,\${image},${{ env.IMAGE }}:${{env.VERSION}},g" resources.yaml > cronJob.yaml
sed "s,\${image},${{ env.IMAGE }},g" resources.yaml > cronJob.yaml
kubectl apply -f ./cronJob.yaml
9 changes: 9 additions & 0 deletions .github/workflows/transfer-service-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@ jobs:
- name: Check out Repository
uses: actions/checkout@v3

- name: cache
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-gradle

- name: set up JDK 17
uses: actions/setup-java@v3
with:
Expand Down
5 changes: 2 additions & 3 deletions click-service/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@ version = '1.0.1'

jib {
from {
image = "eclipse-temurin:17-jre"
image = "asia-northeast3-docker.pkg.dev/sanguine-theory-406607/clickme/click-service:latest"
}
to {
image = "asia-northeast3-docker.pkg.dev/sanguine-theory-406607/clickme/click-service"
tags = [version]
image = "asia-northeast3-docker.pkg.dev/sanguine-theory-406607/clickme/click-service:latest"
}
container {
jvmFlags = ["-Xms258m", "-Xmx1024m"]
Expand Down
2 changes: 1 addition & 1 deletion click-service/resources.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ spec:
spec:
containers:
- name: core
image: ${image}
image: ${image}:latest
imagePullPolicy: Always
ports:
- containerPort: 8080
Expand Down
5 changes: 2 additions & 3 deletions transfer-service/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@ version = '1.0.1'

jib {
from {
image = "eclipse-temurin:17-jre"
image = "asia-northeast3-docker.pkg.dev/sanguine-theory-406607/clickme/transfer-service:latest"
}
to {
image = "asia-northeast3-docker.pkg.dev/sanguine-theory-406607/clickme/click-service"
tags = [version]
image = "asia-northeast3-docker.pkg.dev/sanguine-theory-406607/clickme/transfer-service:latest"
}
container {
jvmFlags = ["-Xms258m", "-Xmx1024m"]
Expand Down
12 changes: 5 additions & 7 deletions transfer-service/resources.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,25 @@ spec:
spec:
containers:
- name: transfer-service1
image: ${image}
command: ["/bin/sh", "-c"]
image: ${image}:latest
args:
- "--spring.batch.job.name=syncRedisToMysqlJob createAt=$(date -u +'%Y-%m-%d)"
- "--spring.batch.job.name=syncRedisToMysqlJob createAt=$(date -u +'%Y-%m-%d')"
restartPolicy: OnFailure
---
apiVersion: batch/v1
kind: CronJob
metadata:
name: transfer-service2
spec:
schedule: 0 15 30 * *
schedule: 30 15 * * *
successfulJobsHistoryLimit: 5
jobTemplate:
spec:
template:
spec:
containers:
- name: transfer-service2
image: ${image}
command: ["/bin/sh", "-c"]
image: ${image}:latest
args:
- "--spring.batch.job.name=profileImageUpdateJob createAt=$(date -u +'%Y-%m-%d)"
- "--spring.batch.job.name=profileImageUpdateJob createAt=$(date -u +'%Y-%m-%d')"
restartPolicy: OnFailure
6 changes: 3 additions & 3 deletions transfer-service/src/main/resources/application-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ spring:
host: ${REDIS_HOST}
port: ${REDIS_PORT}
datasource:
url: ${MYSQL_URL}
username: ${MYSQL_USERNAME}
password: ${MYSQL_PASSWORD}
url: ${DATASOURCE_URL}
username: ${DATASOURCE_USERNAME}
password: ${DATASOURCE_PASSWORD}
driver-class-name: com.mysql.cj.jdbc.Driver
batch:
job:
Expand Down

0 comments on commit e119e04

Please sign in to comment.