Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
5faeb34
migrate: SonarCloud configs
Ming1309 Apr 21, 2026
53331b5
update projectKey
Ming1309 Apr 21, 2026
86e33b4
chore: fix owasp check
Ming1309 Apr 22, 2026
5f5a6a0
fix: correct trivy action tag
Ming1309 Apr 22, 2026
9f52c1c
ci: disable central analyzer in owasp
Ming1309 Apr 22, 2026
b1bba3b
ci: pin trivy and add spring repos
Ming1309 Apr 22, 2026
1da2bf1
Merge pull request #14 from Ming1309/feat/setup-sonar
Ming1309 Apr 22, 2026
77f979e
ci: make GHCR image namespace fork-safe via github.repository_owner
Ming1309 Apr 22, 2026
bb31867
ci: add checks: write permission to fix checkstyle and test-reporter …
Ming1309 Apr 22, 2026
7c92172
Merge pull request #15 from Ming1309/fix/ghcr-owner-namespace
Ming1309 Apr 22, 2026
c196028
ci: fix Docker tag lowercase
Ming1309 Apr 22, 2026
6e36c30
Merge pull request #16 from Ming1309/fix/ghcr-owner-namespace-part2
Ming1309 Apr 22, 2026
b74d78e
ci(backoffice): add checks: write and security-events: write permissions
Ming1309 Apr 22, 2026
9c11235
Merge pull request #17 from Ming1309/chore/add-backoffice-ci-permission
Ming1309 Apr 22, 2026
9cbb0b2
Update pipeline có 2 phase test và build
nhatlank23 Apr 26, 2026
fc3e254
feat(ci): implement test pipeline with coverage enforcement and artif…
nhatlank23 Apr 26, 2026
f733111
sua cac file phu hop context
nhatlank23 Apr 27, 2026
d84abb0
fix loi dispatch
nhatlank23 Apr 27, 2026
d8f58b4
pipeline bị fail do coverage thấp (common-library ~54%)- tạm thời giả…
nhatlank23 Apr 27, 2026
48ad416
build fail, fix loi thieu target
nhatlank23 Apr 27, 2026
274b530
restore: coverage threshold back to 70%
nhatlank23 Apr 27, 2026
165a08d
delete: Task.md file before merge PR
Ming1309 Apr 27, 2026
dc7f117
Merge pull request #19 from Ming1309/feat/RenovatePipeline-NL
Ming1309 Apr 27, 2026
7a122d5
feature: Run pipeline on all branches
hcmus-phat Apr 29, 2026
b39fd20
chore(ci): update test-coverage.yml to trigger only on common-library…
Ming1309 Apr 29, 2026
5913a8e
Merge pull request #21 from Ming1309/feat/configure-pipeline-branches
Ming1309 Apr 29, 2026
614610a
ci: update gitleaks workflow configuration
Ming1309 May 1, 2026
20f5987
ci: update gitleaks triggers and job name
Ming1309 May 1, 2026
e32439b
ci(gitleaks): improve workflow stability and prevent CI failure
Ming1309 May 1, 2026
52a6678
Merge pull request #29 from Ming1309/feat/enhance-gitleak
Ming1309 May 1, 2026
d4ee572
add flatten plugin
Ming1309 May 2, 2026
50a5547
ci(search): fix jacoco bot permissions
Ming1309 May 1, 2026
dc6d0cf
ci(search): fix maven commands to prevent failing on common-library j…
Ming1309 May 1, 2026
e374b0e
test(search): add missing unit tests for sync service and consumer to…
Ming1309 May 1, 2026
28f9341
test(search): add test for null criteria fields to push coverage > 90
Ming1309 May 1, 2026
2318016
test(search): add tests for constants and configs to reach 90 percent…
Ming1309 May 1, 2026
3f05ab8
ci(search): fix sonar project context and add jacoco enforcement
Ming1309 May 2, 2026
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
107 changes: 93 additions & 14 deletions .github/workflows/backoffice-bff-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ name: backoffice-bff service ci

on:
push:
branches: [ "main" ]
branches: ["**"]
paths:
- "backoffice-bff/**"
- ".github/workflows/actions/action.yaml"
- ".github/workflows/backoffice-bff-ci.yaml"
- "pom.xml"
pull_request:
branches: [ "main" ]
branches: ["**"]
paths:
- "backoffice-bff/**"
- ".github/workflows/actions/action.yaml"
Expand All @@ -18,25 +18,54 @@ on:
workflow_dispatch:

jobs:
Build:
# ============================================================================
# PHASE 1: TEST - Run unit tests, code quality checks, security analysis
# ============================================================================
Test:
runs-on: ubuntu-latest
permissions:
contents: read
checks: write
env:
FROM_ORIGINAL_REPOSITORY: ${{ github.event.pull_request.head.repo.full_name == github.repository || github.ref == 'refs/heads/main' }}
steps:
- uses: actions/checkout@v4
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- uses: ./.github/workflows/actions
fetch-depth: 0

- name: Setup JDK environment
uses: ./.github/workflows/actions

- name: Run Maven Checkstyle
if: ${{ env.FROM_ORIGINAL_REPOSITORY == 'true' }}
run: mvn checkstyle:checkstyle -f backoffice-bff -Dcheckstyle.output.file=backoffice-bff-checkstyle-result.xml
- name: Upload Checkstyle Result
if: ${{ env.FROM_ORIGINAL_REPOSITORY == 'true' }}
uses: jwgmeligmeyling/checkstyle-github-action@master
with:
path: '**/backoffice-bff-checkstyle-result.xml'
path: "**/backoffice-bff-checkstyle-result.xml"
- name: Run Maven Verify
run: mvn clean verify -f backoffice-bff

- name: Publish Test Results
uses: dorny/test-reporter@v1
if: ${{ env.FROM_ORIGINAL_REPOSITORY == 'true' && (success() || failure()) && hashFiles('backoffice-bff/**/target/surefire-reports/TEST-*.xml', 'backoffice-bff/**/target/failsafe-reports/TEST-*.xml') != '' }}
with:
name: Backoffice-BFF-Test-Results
path: "backoffice-bff/**/*-reports/TEST*.xml"
reporter: java-junit

- name: Upload JUnit Test Results
uses: actions/upload-artifact@v4
if: ${{ always() }}
with:
name: backoffice-bff-junit-test-results
path: |
backoffice-bff/**/target/surefire-reports/TEST-*.xml
backoffice-bff/**/target/failsafe-reports/TEST-*.xml
if-no-files-found: warn
retention-days: 14
- name: Analyze with sonar cloud
if: ${{ env.FROM_ORIGINAL_REPOSITORY == 'true' }}
env:
Expand All @@ -48,26 +77,76 @@ jobs:
env:
JAVA_HOME: /opt/jdk
with:
project: 'yas'
path: '.'
format: 'HTML'
project: "yas"
path: "."
format: "HTML"
args: --disableCentral
- name: Upload OWASP Dependency Check results
if: ${{ env.FROM_ORIGINAL_REPOSITORY == 'true' }}
uses: actions/upload-artifact@master
uses: actions/upload-artifact@v4
with:
name: OWASP Dependency Check Report
path: ${{github.workspace}}/reports
if-no-files-found: warn
retention-days: 14

- name: Add coverage report to PR
uses: madrapps/jacoco-report@v1.6.1
if: ${{ env.FROM_ORIGINAL_REPOSITORY == 'true' && github.event_name == 'pull_request' && hashFiles('backoffice-bff/target/site/jacoco/jacoco.xml') != '' }}
with:
paths: ${{github.workspace}}/backoffice-bff/target/site/jacoco/jacoco.xml
token: ${{secrets.GITHUB_TOKEN}}
min-coverage-overall: 70
min-coverage-changed-files: 70
title: "Backoffice BFF Coverage Report"
update-comment: true

- name: Upload JaCoCo Coverage Report
uses: actions/upload-artifact@v4
if: ${{ always() }}
with:
name: backoffice-bff-jacoco-coverage-report
path: |
backoffice-bff/target/site/jacoco/jacoco.xml
backoffice-bff/target/site/jacoco-it/jacoco.xml
backoffice-bff/target/site/jacoco/index.html
backoffice-bff/target/site/jacoco-it/index.html
if-no-files-found: warn
retention-days: 14

# ============================================================================
# PHASE 2: BUILD - Build Docker image and push to registry
# ============================================================================
Build:
needs: Test
runs-on: ubuntu-latest
if: ${{ github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch' }}
permissions:
contents: read
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup JDK environment
uses: ./.github/workflows/actions

- name: Build application (generate /target)
run: mvn clean package -pl backoffice-bff -am -DskipTests

- name: Set lowercase image owner
run: echo "IMAGE_OWNER=${GITHUB_REPOSITORY_OWNER,,}" >> $GITHUB_ENV

- name: Log in to the Container registry
if: ${{ github.ref == 'refs/heads/main' }}
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker images
if: ${{ github.ref == 'refs/heads/main' }}
uses: docker/build-push-action@v6
with:
context: ./backoffice-bff
push: true
tags: ghcr.io/nashtech-garage/yas-backoffice-bff:latest
tags: ghcr.io/${{ env.IMAGE_OWNER }}/yas-backoffice-bff:latest
98 changes: 60 additions & 38 deletions .github/workflows/backoffice-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,85 +2,107 @@ name: backoffice service ci

on:
push:
branches: [ "main" ]
branches: ["**"]
paths:
- "backoffice/**"
- ".github/workflows/actions/action.yaml"
- ".github/workflows/backoffice-ci.yaml"
pull_request:
branches: [ "main" ]
branches: ["**"]
paths:
- "backoffice/**"
- ".github/workflows/actions/action.yaml"
- ".github/workflows/backoffice-ci.yaml"
workflow_dispatch:

jobs:
Build:
# ============================================================================
# PHASE 1: TEST - Run linting, prettier, security checks, SonarCloud analysis
# ============================================================================
Test:
runs-on: ubuntu-latest
permissions:
contents: read
checks: write
security-events: write
env:
FROM_ORIGINAL_REPOSITORY: ${{ github.event.pull_request.head.repo.full_name == github.repository || github.ref == 'refs/heads/main' }}
steps:
- uses: actions/checkout@v4
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- uses: actions/setup-node@v4
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- run: npm ci

- name: Install dependencies
run: npm ci
working-directory: backoffice
- run: npm run build

- name: Build application
run: npm run build
working-directory: backoffice
- run: npm run lint

- name: Run linting
run: npm run lint
working-directory: backoffice
- run: npx prettier --check .

- name: Run Prettier check
run: npx prettier --check .
working-directory: backoffice
- run: npm audit --omit=dev

- name: Audit dependencies
run: npm audit --omit=dev
continue-on-error: true
working-directory: backoffice

- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@0.24.0
uses: aquasecurity/trivy-action@6e7b7d1fd3e4fef0c5fa8cce1229c54b2c9bd0d8 # v0.24.0
with:
scan-type: 'fs'
scan-ref: './backoffice'
format: 'sarif'
output: 'trivy-results.sarif'
scan-type: "fs"
scan-ref: "./backoffice"
format: "sarif"
output: "trivy-results.sarif"

- name: SonarCloud Scan
if: ${{ env.FROM_ORIGINAL_REPOSITORY == 'true' }}
uses: SonarSource/sonarcloud-github-action@master
with:
projectBaseDir: backoffice
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

# ============================================================================
# PHASE 2: BUILD - Build Docker image and push to registry
# ============================================================================
Build:
needs: Test
runs-on: ubuntu-latest
if: ${{ github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch' }}
permissions:
contents: read
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set lowercase image owner
run: echo "IMAGE_OWNER=${GITHUB_REPOSITORY_OWNER,,}" >> $GITHUB_ENV

- name: Log in to the Container registry
if: ${{ github.ref == 'refs/heads/main' }}
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build Docker image
if: ${{ github.ref == 'refs/heads/main' }}

- name: Build and push Docker images
uses: docker/build-push-action@v6
with:
context: ./backoffice
tags: ghcr.io/nashtech-garage/yas-backoffice:latest
- name: Run Trivy vulnerability scanner
if: ${{ github.ref == 'refs/heads/main' }}
uses: aquasecurity/trivy-action@0.24.0
with:
image-ref: 'ghcr.io/nashtech-garage/yas-backoffice:latest'
format: 'sarif'
output: 'trivy-results.sarif'
- name: Push Docker image
if: ${{ github.ref == 'refs/heads/main' }}
uses: docker/build-push-action@v6
with:
push: true
context: ./backoffice
tags: ghcr.io/nashtech-garage/yas-backoffice:latest
- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: 'trivy-results.sarif'
tags: ghcr.io/${{ env.IMAGE_OWNER }}/yas-backoffice:latest
Loading