Merge branch 'main' into develop

This commit is contained in:
kittapath 2025-01-10 16:02:44 +07:00
commit d856e44648
3 changed files with 23 additions and 59 deletions

View file

@ -1,6 +1,6 @@
version: 37 version: 37
jobs: jobs:
- name: CI for Checkin [UAT] - name: CI for UAT
steps: steps:
- !CheckoutStep - !CheckoutStep
name: checkout code name: checkout code
@ -33,32 +33,44 @@ jobs:
dotnet test -l trx --collect:"XPlat Code Coverage" dotnet test -l trx --collect:"XPlat Code Coverage"
#/root/.dotnet/tools/roslynator analyze -o roslynator-analysis.xml #/root/.dotnet/tools/roslynator analyze -o roslynator-analysis.xml
useTTY: true useTTY: true
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL condition: NEVER
- !PublishTRXReportStep - !PublishTRXReportStep
name: publish unit test report name: publish unit test report
reportName: Unit Test reportName: Unit Test
filePatterns: '**/*.trx' filePatterns: '**/*.trx'
condition: ALWAYS condition: NEVER
- !PublishCoberturaReportStep - !PublishCoberturaReportStep
name: publish code coverage report name: publish code coverage report
reportName: Code Coverage reportName: Code Coverage
filePatterns: '**/coverage.cobertura.xml' filePatterns: '**/coverage.cobertura.xml'
condition: ALWAYS condition: NEVER
- !PublishRoslynatorReportStep - !PublishRoslynatorReportStep
name: publish code problem report name: publish code problem report
reportName: Code Problems reportName: Code Problems
filePatterns: roslynator-analysis.xml filePatterns: roslynator-analysis.xml
failThreshold: HIGH failThreshold: HIGH
condition: ALWAYS condition: NEVER
- !SetBuildVersionStep - !SetBuildVersionStep
name: set build version name: set build version
buildVersion: '@tag@' buildVersion: '@tag@'
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !BuildImageStep - !BuildImageStep
name: build docker image name: build docker image - Leave
dockerfile: ./BMA.EHR.Leave/Dockerfile
output: !RegistryOutput
tags: hrms-git.chin.in.th/bma-hrms/hrms-api-leave:@build_version@ hrms-git.chin.in.th/bma-hrms/hrms-api-leave:latest
condition: NEVER
- !BuildImageStep
name: build docker image - Checkin
dockerfile: ./BMA.EHR.CheckInConsumer/Dockerfile dockerfile: ./BMA.EHR.CheckInConsumer/Dockerfile
output: !RegistryOutput output: !RegistryOutput
tags: hrms-git.chin.in.th/bma-hrms/hrms-api-checkin:@build_version@ hrms-git.chin.in.th/bma-hrms/hrms-api-checkin:latest tags: hrms-git.chin.in.th/bma-hrms/hrms-api-checkin:@build_version@ hrms-git.chin.in.th/bma-hrms/hrms-api-checkin:latest
condition: NEVER
- !BuildImageStep
name: build docker image - Insignia
dockerfile: ./BMA.EHR.Insignia/Dockerfile
output: !RegistryOutput
tags: hrms-git.chin.in.th/bma-hrms/hrms-api-insignia:@build_version@ hrms-git.chin.in.th/bma-hrms/hrms-api-insignia:latest
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
triggers: triggers:
- !TagCreateTrigger - !TagCreateTrigger
@ -68,53 +80,3 @@ jobs:
maxRetries: 3 maxRetries: 3
retryDelay: 30 retryDelay: 30
timeout: 14400 timeout: 14400
- name: CI for PROD
steps:
- !CheckoutStep
name: checkout code
cloneCredential: !DefaultCredential {}
withLfs: false
withSubmodules: false
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !GenerateChecksumStep
name: generate package checksum
files: package-lock.json yarn.lock
targetFile: checksum
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !SetupCacheStep
name: set up npm cache
key: node_modules_@file:checksum@
loadKeys:
- node_modules
paths:
- node_modules
uploadStrategy: UPLOAD_IF_NOT_HIT
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !SetBuildVersionStep
name: set build version
buildVersion: '@tag@'
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !CommandStep
name: build & test
runInContainer: true
image: node
interpreter: !DefaultInterpreter
commands: |
npm install
npm run build
useTTY: true
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !BuildImageStep
name: build docker image
dockerfile: ./docker/Dockerfile
output: !RegistryOutput
tags: hrms-git.bangkok.go.th/bma-hrms/hrms-api-checkin:@build_version@ hrms-git.bangkok.go.th/bma-hrms/hrms-api-checkin:latest
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
triggers:
- !TagCreateTrigger
tags: prod-*
branches: main
retryCondition: never
maxRetries: 3
retryDelay: 30
timeout: 14400

View file

@ -42,6 +42,8 @@ RUN dotnet restore
# คัดลอกไฟล์ทั้งหมดและ build # คัดลอกไฟล์ทั้งหมดและ build
COPY . ./ COPY . ./
RUN dotnet build -c Release -o /app/build RUN dotnet build -c Release -o /app/build
# WORKDIR "/src/BMA.EHR.CheckInConsumer"
# RUN dotnet build "BMA.EHR.CheckInConsumer.csproj" -c Release -o /app/build
# ใช้ stage ใหม่สำหรับการ runtime # ใช้ stage ใหม่สำหรับการ runtime
FROM mcr.microsoft.com/dotnet/runtime:8.0 AS runtime FROM mcr.microsoft.com/dotnet/runtime:8.0 AS runtime
@ -53,4 +55,4 @@ WORKDIR /app
COPY --from=build /app/build . COPY --from=build /app/build .
# ระบุ entry point ของแอปพลิเคชัน # ระบุ entry point ของแอปพลิเคชัน
ENTRYPOINT ["dotnet", "BMA.EHR.CheckInConsumer.dll"] ENTRYPOINT ["dotnet", "BMA.EHR.CheckInConsumer.dll"]

View file

@ -13,7 +13,7 @@ COPY ["BMA.EHR.Application/BMA.EHR.Application.csproj", "BMA.EHR.Application/"]
COPY ["BMA.EHR.Infrastructure/BMA.EHR.Infrastructure.csproj", "BMA.EHR.Infrastructure/"] COPY ["BMA.EHR.Infrastructure/BMA.EHR.Infrastructure.csproj", "BMA.EHR.Infrastructure/"]
COPY ["BMA.EHR.Leave/BMA.EHR.Leave.csproj", "BMA.EHR.Leave/"] COPY ["BMA.EHR.Leave/BMA.EHR.Leave.csproj", "BMA.EHR.Leave/"]
RUN dotnet restore "BMA.EHR.Leave/BMA.EHR.Leave.csproj" RUN dotnet restore "BMA.EHR.Leave/BMA.EHR.Leave.csproj"
COPY . . COPY . .
WORKDIR "/src/BMA.EHR.Leave" WORKDIR "/src/BMA.EHR.Leave"
RUN dotnet build "BMA.EHR.Leave.csproj" -c Release -o /app/build RUN dotnet build "BMA.EHR.Leave.csproj" -c Release -o /app/build
@ -24,4 +24,4 @@ RUN dotnet publish "BMA.EHR.Leave.csproj" -c Release -o /app/publish /p:UseAppHo
FROM base AS final FROM base AS final
WORKDIR /app WORKDIR /app
COPY --from=publish /app/publish . COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "BMA.EHR.Leave.dll"] ENTRYPOINT ["dotnet", "BMA.EHR.Leave.dll"]