Skip to content

Commit 6fd7ad1

Browse files
Fix Docker build contexts and validation workflows for service dependencies (#417)
* Enhance GitHub workflows and PR template - Updated pull request template to improve clarity and structure. - Modified Docker validation workflows to include shared paths and improve context handling. - Adjusted publish workflows for consistency in path handling and Docker context. - Refined validation workflows for orchestration engine, policy decision point, and portal backend to ensure shared paths are included. - Standardized quotes in YAML files for consistency. - Improved security workflow to streamline branch specifications. * Fix Dockerfile paths for audit, consent, orchestration, policy, and portal services * Refactor enum loading and default handling in audit service configuration * Fix Dockerfile paths to correctly reference shared packages in consent engine, policy decision point, orchestration engine, and portal backend * Address PR comments * Add script to test Docker builds for all services
1 parent 9f8a5e9 commit 6fd7ad1

31 files changed

+395
-232
lines changed

.github/pull_request_template.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
## Summary
2+
23
Provide a brief description of what this PR accomplishes and why these changes are needed.
34

45
## Type of Change
6+
57
- [ ] Bug fix (non-breaking change which fixes an issue)
68
- [ ] New feature (non-breaking change which adds functionality)
79
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
@@ -11,17 +13,20 @@ Provide a brief description of what this PR accomplishes and why these changes a
1113
- [ ] Other (please describe):
1214

1315
## Changes Made
16+
1417
- List the main changes made in this PR
1518
- Be specific about what was modified, added, or removed
1619
- Include any architectural changes
1720

1821
## Testing
22+
1923
- [ ] I have tested this change locally
2024
- [ ] I have added unit tests for new functionality
2125
- [ ] I have tested edge cases
2226
- [ ] All existing tests pass
2327

2428
## Checklist
29+
2530
- [ ] My code follows the project's style guidelines
2631
- [ ] I have performed a self-review of my code
2732
- [ ] I have commented my code, particularly in hard-to-understand areas
@@ -30,15 +35,19 @@ Provide a brief description of what this PR accomplishes and why these changes a
3035
- [ ] I have checked that there are no merge conflicts
3136

3237
## Related Issues
38+
3339
Closes #123 <!-- Replace 123 with the relevant issue number -->
3440
Fixes #123 <!-- Replace 123 with the relevant issue number -->
3541
Related to #123 <!-- Replace 123 with the relevant issue number -->
3642

3743
## Screenshots/Demo
44+
3845
(If applicable, add screenshots or GIFs to help explain your changes)
3946

4047
## Additional Notes
48+
4149
Any additional context, concerns, or notes for reviewers.
4250

4351
## Deployment Notes
44-
(If applicable, include any special deployment instructions or environment considerations)
52+
53+
(If applicable, include any special deployment instructions or environment considerations)

.github/workflows/audit-service-docker-validate.yml

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,22 @@ name: Validate Audit Service Docker
33
on:
44
pull_request:
55
paths:
6-
- 'audit-service/Dockerfile'
7-
- '.github/workflows/audit-service-docker-validate.yml'
6+
- "audit-service/**"
7+
- "shared/**"
8+
- ".github/workflows/audit-service-docker-validate.yml"
89
workflow_dispatch:
910

1011
env:
1112
# === Service-specific variables ===
12-
SERVICE_PATH: 'audit-service'
13+
SERVICE_PATH: "audit-service"
1314
# ================================
1415
REGISTRY: ghcr.io
1516

1617
jobs:
1718
docker-validate:
1819
runs-on: ubuntu-latest
1920
permissions:
20-
contents: read # To check out the code
21+
contents: read # To check out the code
2122
security-events: write # To upload Trivy SARIF results
2223

2324
steps:
@@ -34,9 +35,10 @@ jobs:
3435
- name: Build Docker image (validation only)
3536
uses: docker/build-push-action@v5
3637
with:
37-
context: ${{ env.SERVICE_PATH }}
38-
push: false # Don't push, just validate build
39-
load: true # Load image locally for security scanning
38+
context: .
39+
file: ${{ env.SERVICE_PATH }}/Dockerfile
40+
push: false # Don't push, just validate build
41+
load: true # Load image locally for security scanning
4042
tags: ${{ env.REGISTRY }}/${{ steps.repo.outputs.name }}/audit-service:pr-${{ github.event.pull_request.number || 'manual' }}
4143
build-args: |
4244
SERVICE_PATH=${{ env.SERVICE_PATH }}
@@ -50,11 +52,11 @@ jobs:
5052
uses: aquasecurity/trivy-action@master
5153
with:
5254
image-ref: ${{ env.REGISTRY }}/${{ steps.repo.outputs.name }}/audit-service:pr-${{ github.event.pull_request.number || 'manual' }}
53-
format: 'sarif'
54-
output: 'trivy-results.sarif'
55+
format: "sarif"
56+
output: "trivy-results.sarif"
5557

5658
- name: Upload Trivy scan results to GitHub Security tab
5759
uses: github/codeql-action/upload-sarif@v3
5860
if: always()
5961
with:
60-
sarif_file: 'trivy-results.sarif'
62+
sarif_file: "trivy-results.sarif"

.github/workflows/audit-service-publish.yml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,17 @@ on:
55
branches:
66
- main
77
paths:
8-
- 'audit-service/**'
9-
- '.github/workflows/audit-service-publish.yml'
8+
- "audit-service/**"
9+
- "shared/**"
10+
- ".github/workflows/audit-service-publish.yml"
1011
tags:
11-
- 'audit-service-v*'
12-
- 'v*'
12+
- "audit-service-v*"
13+
- "v*"
1314
workflow_dispatch:
1415

1516
env:
1617
# === Service-specific variables ===
17-
SERVICE_PATH: 'audit-service'
18+
SERVICE_PATH: "audit-service"
1819
IMAGE_NAME: ${{ github.repository }}/audit-service
1920
# ================================
2021
REGISTRY: ghcr.io
@@ -23,8 +24,8 @@ jobs:
2324
publish:
2425
runs-on: ubuntu-latest
2526
permissions:
26-
contents: read # To check out the code
27-
packages: write # To push images to GHCR
27+
contents: read # To check out the code
28+
packages: write # To push images to GHCR
2829

2930
steps:
3031
- name: Checkout repository
@@ -61,7 +62,8 @@ jobs:
6162
id: build-push
6263
uses: docker/build-push-action@v5
6364
with:
64-
context: ${{ env.SERVICE_PATH }}
65+
context: .
66+
file: ${{ env.SERVICE_PATH }}/Dockerfile
6567
push: true
6668
tags: ${{ steps.meta.outputs.tags }}
6769
labels: ${{ steps.meta.outputs.labels }}
@@ -71,4 +73,4 @@ jobs:
7173
BUILD_TIME=${{ github.event.head_commit.timestamp || github.event.repository.pushed_at || '2025-01-01T00:00:00Z' }}
7274
GIT_COMMIT=${{ github.sha }}
7375
cache-from: type=gha
74-
cache-to: type=gha,mode=max
76+
cache-to: type=gha,mode=max

.github/workflows/audit-service-validate.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ name: Validate Audit Service
33
on:
44
pull_request:
55
paths:
6-
- 'audit-service/**'
7-
- '.github/workflows/audit-service-validate.yml'
6+
- "audit-service/**"
7+
- "shared/**"
8+
- ".github/workflows/audit-service-validate.yml"
89
workflow_dispatch:
910

1011
concurrency:
@@ -13,19 +14,19 @@ concurrency:
1314

1415
env:
1516
# === Service-specific variables ===
16-
SERVICE_PATH: 'audit-service'
17+
SERVICE_PATH: "audit-service"
1718
TEST_DB_NAME: audit_service_test
1819
# ================================
1920
REGISTRY: ghcr.io
20-
GO_VERSION: '1.24'
21+
GO_VERSION: "1.24"
2122
TEST_DB_USER: postgres
2223
TEST_DB_PASS: password
2324

2425
jobs:
2526
validate:
2627
runs-on: ubuntu-latest
2728
permissions:
28-
contents: read # To check out the code
29+
contents: read # To check out the code
2930

3031
services:
3132
postgres:
@@ -85,5 +86,3 @@ jobs:
8586
TEST_DB_DATABASE: ${{ env.TEST_DB_NAME }}
8687
TEST_DB_SSLMODE: disable
8788
run: cd ${{ env.SERVICE_PATH }} && go test ./... -count=1
88-
89-

.github/workflows/consent-engine-docker-validate.yml

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,22 @@ name: Validate Consent Engine Docker
33
on:
44
pull_request:
55
paths:
6-
- 'exchange/consent-engine/Dockerfile'
7-
- '.github/workflows/consent-engine-docker-validate.yml'
6+
- "exchange/consent-engine/**"
7+
- "exchange/shared/**"
8+
- ".github/workflows/consent-engine-docker-validate.yml"
89
workflow_dispatch:
910

1011
env:
1112
# === Service-specific variables ===
12-
SERVICE_PATH: 'exchange/consent-engine'
13+
SERVICE_PATH: "exchange/consent-engine"
1314
# ================================
1415
REGISTRY: ghcr.io
1516

1617
jobs:
1718
docker-validate:
1819
runs-on: ubuntu-latest
1920
permissions:
20-
contents: read # To check out the code
21+
contents: read # To check out the code
2122
security-events: write # To upload Trivy SARIF results
2223

2324
steps:
@@ -34,10 +35,10 @@ jobs:
3435
- name: Build Docker image (validation only)
3536
uses: docker/build-push-action@v5
3637
with:
37-
context: exchange
38+
context: .
3839
file: ${{ env.SERVICE_PATH }}/Dockerfile
39-
push: false # Don't push, just validate build
40-
load: true # Load image locally for security scanning
40+
push: false # Don't push, just validate build
41+
load: true # Load image locally for security scanning
4142
tags: ${{ env.REGISTRY }}/${{ steps.repo.outputs.name }}/consent-engine:pr-${{ github.event.pull_request.number || 'manual' }}
4243
build-args: |
4344
SERVICE_PATH=${{ env.SERVICE_PATH }}
@@ -51,11 +52,11 @@ jobs:
5152
uses: aquasecurity/trivy-action@master
5253
with:
5354
image-ref: ${{ env.REGISTRY }}/${{ steps.repo.outputs.name }}/consent-engine:pr-${{ github.event.pull_request.number || 'manual' }}
54-
format: 'sarif'
55-
output: 'trivy-results.sarif'
55+
format: "sarif"
56+
output: "trivy-results.sarif"
5657

5758
- name: Upload Trivy scan results to GitHub Security tab
5859
uses: github/codeql-action/upload-sarif@v3
5960
if: always()
6061
with:
61-
sarif_file: 'trivy-results.sarif'
62+
sarif_file: "trivy-results.sarif"

.github/workflows/consent-engine-publish.yml

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,18 @@ on:
55
branches:
66
- main
77
paths:
8-
- 'exchange/consent-engine/**'
9-
- 'exchange/shared/**'
10-
- '.github/workflows/consent-engine-publish.yml'
8+
- "exchange/consent-engine/**"
9+
- "exchange/shared/**"
10+
- "shared/**"
11+
- ".github/workflows/consent-engine-publish.yml"
1112
tags:
12-
- 'consent-engine-v*'
13-
- 'v*'
13+
- "consent-engine-v*"
14+
- "v*"
1415
workflow_dispatch:
1516

1617
env:
1718
# === Service-specific variables ===
18-
SERVICE_PATH: 'exchange/consent-engine'
19+
SERVICE_PATH: "exchange/consent-engine"
1920
IMAGE_NAME: ${{ github.repository }}/consent-engine
2021
# ================================
2122
REGISTRY: ghcr.io
@@ -24,8 +25,8 @@ jobs:
2425
publish:
2526
runs-on: ubuntu-latest
2627
permissions:
27-
contents: read # To check out the code
28-
packages: write # To push images to GHCR
28+
contents: read # To check out the code
29+
packages: write # To push images to GHCR
2930

3031
steps:
3132
- name: Checkout repository
@@ -62,7 +63,7 @@ jobs:
6263
id: build-push
6364
uses: docker/build-push-action@v5
6465
with:
65-
context: exchange
66+
context: .
6667
file: ${{ env.SERVICE_PATH }}/Dockerfile
6768
push: true
6869
tags: ${{ steps.meta.outputs.tags }}
@@ -73,4 +74,4 @@ jobs:
7374
BUILD_TIME=${{ github.event.head_commit.timestamp || github.event.repository.pushed_at || '2025-01-01T00:00:00Z' }}
7475
GIT_COMMIT=${{ github.sha }}
7576
cache-from: type=gha
76-
cache-to: type=gha,mode=max
77+
cache-to: type=gha,mode=max

.github/workflows/consent-engine-validate.yml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ name: Validate Consent Engine
33
on:
44
pull_request:
55
paths:
6-
- 'exchange/consent-engine/**'
7-
- 'exchange/shared/**'
8-
- '.github/workflows/consent-engine-validate.yml'
6+
- "exchange/consent-engine/**"
7+
- "exchange/shared/**"
8+
- "shared/**"
9+
- ".github/workflows/consent-engine-validate.yml"
910
workflow_dispatch:
1011

1112
concurrency:
@@ -14,19 +15,19 @@ concurrency:
1415

1516
env:
1617
# === Service-specific variables ===
17-
SERVICE_PATH: 'exchange/consent-engine'
18+
SERVICE_PATH: "exchange/consent-engine"
1819
TEST_DB_NAME: consent_engine_test
1920
# ================================
2021
REGISTRY: ghcr.io
21-
GO_VERSION: '1.24'
22+
GO_VERSION: "1.24"
2223
TEST_DB_USER: postgres
2324
TEST_DB_PASS: password
2425

2526
jobs:
2627
validate:
2728
runs-on: ubuntu-latest
2829
permissions:
29-
contents: read # To check out the code
30+
contents: read # To check out the code
3031

3132
services:
3233
postgres:
@@ -86,5 +87,3 @@ jobs:
8687
TEST_DB_DATABASE: ${{ env.TEST_DB_NAME }}
8788
TEST_DB_SSLMODE: disable
8889
run: cd ${{ env.SERVICE_PATH }} && go test ./... -count=1
89-
90-

.github/workflows/frontends-docker-validate.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ name: Validate Frontends Docker
33
on:
44
pull_request:
55
paths:
6-
- 'portals/**/Dockerfile'
7-
- 'portals/**/nginx.conf'
8-
- 'portals/**/entrypoint.sh'
9-
- '.github/workflows/frontends-docker-validate.yml'
6+
- "portals/**/Dockerfile"
7+
- "portals/**/nginx.conf"
8+
- "portals/**/entrypoint.sh"
9+
- ".github/workflows/frontends-docker-validate.yml"
1010
workflow_dispatch:
1111

1212
env:
@@ -47,12 +47,12 @@ jobs:
4747
uses: aquasecurity/trivy-action@master
4848
with:
4949
image-ref: ${{ env.REGISTRY }}/${{ steps.repo.outputs.name }}/${{ matrix.portal }}:pr-${{ github.event.pull_request.number || 'manual' }}
50-
format: 'sarif'
51-
output: 'trivy-results.sarif'
50+
format: "sarif"
51+
output: "trivy-results.sarif"
5252

5353
- name: Upload Trivy scan results
5454
uses: github/codeql-action/upload-sarif@v3
5555
if: always()
5656
with:
57-
sarif_file: 'trivy-results.sarif'
57+
sarif_file: "trivy-results.sarif"
5858
category: ${{ matrix.portal }}

.github/workflows/frontends-publish.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ on:
55
branches:
66
- main
77
paths:
8-
- 'portals/**'
9-
- '.github/workflows/frontends-publish.yml'
8+
- "portals/**"
9+
- ".github/workflows/frontends-publish.yml"
1010
tags:
11-
- 'v*'
11+
- "v*"
1212
workflow_dispatch:
1313

1414
env:

0 commit comments

Comments
 (0)