Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🔀 :: (#53) 자바 버전 변경 및 CI 설정 #54

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 0 additions & 53 deletions .github/workflows/CD.yml

This file was deleted.

29 changes: 29 additions & 0 deletions .github/workflows/CI.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: v1-service-dms - CI

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: SetUp JDK 17
uses: actions/setup-java@v2
with:
java-version: "17"
distribution: 'adopt'

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Gradle Test
uses: gradle/gradle-build-action@v2
with:
arguments: test
99 changes: 51 additions & 48 deletions .github/workflows/prod-build.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build for Production
name: v1-service-dms - CD(prod)
on:
push:
tags:
Expand All @@ -10,60 +10,63 @@ env:

jobs:
build:
environment: prod
runs-on: ubuntu-latest
strategy:
matrix:
java-version: [ 11 ]

steps:
- name: Check Out The Repository
uses: actions/checkout@v3

- name: Set up Java
uses: actions/setup-java@v2
with:
java-version: ${{ matrix.java-version }}
distribution: 'zulu'
java-version: [ 17 ]
outputs:
version: ${{ steps.get_version.outputs.BRANCH_NAME }}

- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3)
steps:
- name: Check Out The Repository
uses: actions/checkout@v3

- name: Gradle Build
uses: gradle/gradle-build-action@v2
with:
arguments: |
build
--no-daemon
- name: Set up Java
uses: actions/setup-java@v2
with:
java-version: ${{ matrix.java-version }}
distribution: 'zulu'

- name: Login to ECR
id: ecr
uses: elgohr/ecr-login-action@master
with:
access_key: ${{ secrets.AWS_ACCESS_KEY }}
secret_access_key: ${{ secrets.AWS_SECRET_KEY }}
region: ${{ secrets.AWS_REGION }}
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3)

- name: Publish to Registry
uses: elgohr/Publish-Docker-Github-Action@v5
with:
name: ${{env.SERVICE_NAME}}-${{env.SERVICE_TYPE}}
username: ${{ steps.ecr.outputs.username }}
password: ${{ steps.ecr.outputs.password }}
registry: ${{ steps.ecr.outputs.registry }}
tags: ${{ steps.get_version.outputs.VERSION }}
buildargs: |
PROFILE=prod
CLOUD_CONFIG_USERNAME=${{ secrets.CLOUD_CONFIG_USERNAME }}
CLOUD_CONFIG_PASSWORD=${{ secrets.CLOUD_CONFIG_PASSWORD }}
- name: Gradle Build
uses: gradle/gradle-build-action@v2
with:
arguments: |
build
--no-daemon
- name: Login to ECR
id: ecr
uses: elgohr/ecr-login-action@master
with:
access_key: ${{ secrets.AWS_ACCESS_KEY }}
secret_access_key: ${{ secrets.AWS_SECRET_KEY }}
region: ${{ secrets.AWS_REGION }}

- name: Repository Dispatch
uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.GITOPS_DEPLOY_PRODUCTION_TOKEN }}
repository: team-xquare/xquare-gitops-repo-production
event-type: update_image
client-payload: '{"ref": "${{ github.ref }}",
- name: Publish to Registry
uses: elgohr/Publish-Docker-Github-Action@v5
with:
name: ${{env.SERVICE_NAME}}-${{env.SERVICE_TYPE}}
username: ${{ steps.ecr.outputs.username }}
password: ${{ steps.ecr.outputs.password }}
registry: ${{ steps.ecr.outputs.registry }}
tags: ${{ steps.get_version.outputs.VERSION }}
buildargs: |
PROFILE=prod
CLOUD_CONFIG_USERNAME=${{ secrets.CLOUD_CONFIG_USERNAME }}
CLOUD_CONFIG_PASSWORD=${{ secrets.CLOUD_CONFIG_PASSWORD }}
- name: Repository Dispatch
uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.GITOPS_DEPLOY_PRODUCTION_TOKEN }}
repository: team-xquare/xquare-gitops-repo-production
event-type: update_image
client-payload: '{
"ref": "${{ github.ref }}",
"version": "${{ steps.get_version.outputs.VERSION }}",
"service_name": "${{env.SERVICE_NAME}}",
"service_type": "${{env.SERVICE_TYPE}}"}'
"service_type": "${{env.SERVICE_TYPE}}"
}'
91 changes: 45 additions & 46 deletions .github/workflows/stag-build.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build for Stage
name: v1-service-dms - CD(stag)
on:
push:
branches:
Expand All @@ -10,58 +10,57 @@ env:

jobs:
build:
environment: stag
runs-on: ubuntu-latest
strategy:
matrix:
java-version: [ 11 ]
java-version: [ 17 ]
outputs:
version: ${{ steps.get_version.outputs.BRANCH_NAME }}

steps:
- name: Check Out The Repository
uses: actions/checkout@v3

- name: Set up Java
uses: actions/setup-java@v2
with:
java-version: ${{ matrix.java-version }}
distribution: 'zulu'
version: ${{ steps.get_version.outputs.BRANCH_NAME }}

- name: Gradle Build
uses: gradle/gradle-build-action@v2
with:
arguments: |
build
--no-daemon
steps:
- name: Check Out The Repository
uses: actions/checkout@v3

- name: Login to ECR
id: ecr
uses: elgohr/ecr-login-action@master
with:
access_key: ${{ secrets.AWS_ACCESS_KEY }}
secret_access_key: ${{ secrets.AWS_SECRET_KEY }}
region: ${{ secrets.AWS_REGION }}
- name: Set up Java
uses: actions/setup-java@v2
with:
java-version: ${{ matrix.java-version }}
distribution: 'zulu'

- name: Publish to Registry
uses: elgohr/Publish-Docker-Github-Action@v5
with:
name: ${{env.SERVICE_NAME}}-${{env.SERVICE_TYPE}}
username: ${{ steps.ecr.outputs.username }}
password: ${{ steps.ecr.outputs.password }}
registry: ${{ steps.ecr.outputs.registry }}
tags: ${{ github.sha }}
buildargs: |
PROFILE=stag
CLOUD_CONFIG_USERNAME=${{ secrets.CLOUD_CONFIG_USERNAME }}
CLOUD_CONFIG_PASSWORD=${{ secrets.CLOUD_CONFIG_PASSWORD }}
- name: Gradle Build
uses: gradle/gradle-build-action@v2
with:
arguments: |
build
--no-daemon
- name: Login to ECR
id: ecr
uses: elgohr/ecr-login-action@master
with:
access_key: ${{ secrets.AWS_ACCESS_KEY }}
secret_access_key: ${{ secrets.AWS_SECRET_KEY }}
region: ${{ secrets.AWS_REGION }}

- name: Repository Dispatch
uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.GITOPS_DEPLOY_STAGE_TOKEN }}
repository: team-xquare/xquare-gitops-repo-staging
event-type: update_image
client-payload: '{"ref": "${{ github.ref }}",
- name: Publish to Registry
uses: elgohr/Publish-Docker-Github-Action@v5
with:
name: ${{env.SERVICE_NAME}}-${{env.SERVICE_TYPE}}
username: ${{ steps.ecr.outputs.username }}
password: ${{ steps.ecr.outputs.password }}
registry: ${{ steps.ecr.outputs.registry }}
tags: ${{ github.sha }}
buildargs: |
PROFILE=stag
CLOUD_CONFIG_USERNAME=${{ secrets.CLOUD_CONFIG_USERNAME }}
CLOUD_CONFIG_PASSWORD=${{ secrets.CLOUD_CONFIG_PASSWORD }}
- name: Repository Dispatch
uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.GITOPS_DEPLOY_STAGE_TOKEN }}
repository: team-xquare/xquare-gitops-repo-staging
event-type: update_image
client-payload: '{"ref": "${{ github.ref }}",
"version": "${{ github.sha }}",
"service_name": "${{env.SERVICE_NAME}}",
"service_type": "${{env.SERVICE_TYPE}}" }'
"service_type": "${{env.SERVICE_TYPE}}" }'
12 changes: 6 additions & 6 deletions src/main/java/app/xquare/dms/global/security/SecurityConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ protected void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests()

.antMatchers(HttpMethod.GET, "/dms/notices").hasRole(DORMITORY)
.antMatchers(HttpMethod.POST, "/dms/notices/{notice-id}").hasRole(DORMITORY)
.antMatchers(HttpMethod.PUT, "/dms/notices/{notice-id}").hasRole(DORMITORY)
.antMatchers(HttpMethod.DELETE, "/dms/notices/{notice-id}").hasRole(DORMITORY)
.antMatchers(HttpMethod.GET, "/dms/notices").hasAnyRole(DORMITORY)
.antMatchers(HttpMethod.POST, "/dms/notices/{notice-id}").hasAnyRole(DORMITORY)
.antMatchers(HttpMethod.PUT, "/dms/notices/{notice-id}").hasAnyRole(DORMITORY)
.antMatchers(HttpMethod.DELETE, "/dms/notices/{notice-id}").hasAnyRole(DORMITORY)

.antMatchers(HttpMethod.GET, "/dms/stay").hasRole(DORMITORY)
.antMatchers(HttpMethod.GET, "/dms/excel/stay").hasRole(DORMITORY)
.antMatchers(HttpMethod.GET, "/dms/stay").hasAnyRole(DORMITORY)
.antMatchers(HttpMethod.GET, "/dms/excel/stay").hasAnyRole(DORMITORY)
eogus2513 marked this conversation as resolved.
Show resolved Hide resolved

.anyRequest().authenticated();
http
Expand Down
25 changes: 13 additions & 12 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
server:
shutdown: graceful
servlet:
context-path: /dms

spring:
application:
name: v1-dms-service
Expand All @@ -10,29 +15,25 @@ spring:
username: ${CLOUD_CONFIG_USERNAME}
password: ${CLOUD_CONFIG_PASSWORD}

datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: ${db.url}
username: ${db.username}
password: ${db.password}

jpa:
database: mysql
database-platform: org.hibernate.dialect.MySQL5InnoDBDialect
hibernate:
ddl-auto: none

datasource:
url: ${db.url}
driver-class-name: com.mysql.cj.jdbc.Driver
password: ${db.password}
username: ${db.username}
ddl-auto: validate
open-in-view: false

jackson:
property-naming-strategy: SNAKE_CASE

lifecycle:
timeout-per-shutdown-phase: 20s

server:
servlet:
context-path: /dms
shutdown: graceful

auth:
id: ${xquare.admin.id}
pw: ${xquare.admin.pw}
Expand Down