Skip to content

Commit 14158d6

Browse files
Merge branch 'dev' into feat/concept-svc
2 parents 93a0057 + a6caf00 commit 14158d6

File tree

5 files changed

+141
-118
lines changed

5 files changed

+141
-118
lines changed

.github/workflows/build_docker.yml

Lines changed: 71 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@ on:
44
push:
55
branches:
66
- main
7+
- dev
78
pull_request:
89
branches:
910
- main
11+
- dev
1012

1113
jobs:
1214
generate_api_code:
@@ -43,11 +45,56 @@ jobs:
4345
chmod +x api/scripts/gen-all.sh
4446
./api/scripts/gen-all.sh
4547
46-
- name: Upload entire repository as artifact
48+
# Upload separate artifacts for each service
49+
- name: Upload client artifact
4750
uses: actions/upload-artifact@v4
4851
with:
49-
name: full-repository
50-
path: .
52+
name: client-code
53+
path: ./client
54+
if-no-files-found: error
55+
56+
- name: Set executable permissions for gradlew files
57+
run: |
58+
chmod +x gateway/gradlew
59+
chmod +x user-svc/gradlew
60+
chmod +x concept-svc/gradlew
61+
ls -la gateway/gradlew
62+
ls -la user-svc/gradlew
63+
ls -la concept-svc/gradlew
64+
65+
- name: Upload gateway artifact
66+
uses: actions/upload-artifact@v4
67+
with:
68+
name: gateway-code
69+
path: |
70+
./gateway
71+
./gateway/gradle/wrapper/
72+
if-no-files-found: error
73+
74+
- name: Upload user-svc artifact
75+
uses: actions/upload-artifact@v4
76+
with:
77+
name: user-svc-code
78+
path: |
79+
./user-svc
80+
./user-svc/gradle/wrapper/
81+
if-no-files-found: error
82+
83+
- name: Upload concept-svc artifact
84+
uses: actions/upload-artifact@v4
85+
with:
86+
name: concept-svc-code
87+
path: |
88+
./concept-svc
89+
./concept-svc/gradle/wrapper/
90+
if-no-files-found: error
91+
92+
- name: Upload genai-svc artifact
93+
uses: actions/upload-artifact@v4
94+
with:
95+
name: genai-svc-code
96+
path: ./genai-svc
97+
if-no-files-found: error
5198

5299
test-java:
53100
name: Run Java Tests
@@ -57,11 +104,11 @@ jobs:
57104
matrix:
58105
service: [gateway, user-svc, concept-svc]
59106
steps:
60-
- name: Download full repository artifact
107+
- name: Download service artifact
61108
uses: actions/download-artifact@v4
62109
with:
63-
name: full-repository
64-
path: .
110+
name: ${{ matrix.service }}-code
111+
path: ./${{ matrix.service }}
65112

66113
- uses: actions/setup-java@v4
67114
with:
@@ -71,19 +118,30 @@ jobs:
71118
- name: Setup Gradle
72119
uses: gradle/actions/setup-gradle@v4
73120

121+
- name: Set executable permissions for gradlew
122+
run: |
123+
echo "Setting executable permissions for ${{ matrix.service }}/gradlew"
124+
ls -la ${{ matrix.service }}
125+
chmod +x ${{ matrix.service }}/gradlew
126+
ls -la ${{ matrix.service }}/gradlew
127+
74128
- name: Build and test with Gradle
75-
run: cd ${{ matrix.service }} && ./gradlew build test
129+
run: |
130+
cd ${{ matrix.service }}
131+
pwd
132+
ls -la
133+
./gradlew build test
76134
77135
test-python:
78136
name: Run Python Tests
79137
needs: generate_api_code
80138
runs-on: ubuntu-latest
81139
steps:
82-
- name: Download full repository artifact
140+
- name: Download genai-svc artifact
83141
uses: actions/download-artifact@v4
84142
with:
85-
name: full-repository
86-
path: .
143+
name: genai-svc-code
144+
path: ./genai-svc
87145

88146
- name: Setup Python
89147
uses: actions/setup-python@v5
@@ -108,13 +166,12 @@ jobs:
108166
strategy:
109167
matrix:
110168
service: [client, gateway, user-svc, concept-svc, genai-svc]
111-
max-parallel: 1
112169
steps:
113-
- name: Download full repository artifact
170+
- name: Download service artifact
114171
uses: actions/download-artifact@v4
115172
with:
116-
name: full-repository
117-
path: .
173+
name: ${{ matrix.service }}-code
174+
path: ./${{ matrix.service }}
118175

119176
- name: Log in to the Container registry
120177
uses: docker/login-action@v3

.github/workflows/deploy_kubernetes.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ on:
55
workflows: [Build Docker Images]
66
types:
77
- completed
8+
branches:
9+
- main
10+
conclusion: success
811

912
jobs:
1013
deployment:

.github/workflows/deploy_staging_kubernetes.yaml

Lines changed: 29 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -1,116 +1,26 @@
11
name: Deploy to Staging Kubernetes
22

33
on:
4-
push:
4+
workflow_run:
5+
workflows: [Build Docker Images]
6+
types:
7+
- completed
58
branches:
69
- dev
10+
conclusion: success
711
pull_request:
812
branches:
913
- dev
1014

1115
jobs:
12-
generate_api_code:
16+
deployment:
1317
runs-on: ubuntu-latest
14-
steps:
15-
- name: Checkout code
16-
uses: actions/checkout@v4
17-
18-
- name: Setup Java
19-
uses: actions/setup-java@v4
20-
with:
21-
java-version: '21'
22-
distribution: 'temurin'
23-
24-
- name: Setup Node.js
25-
uses: actions/setup-node@v4
26-
with:
27-
node-version: '22'
28-
cache: 'npm'
29-
30-
- name: Setup Python
31-
uses: actions/setup-python@v4
32-
with:
33-
python-version: '3.13'
34-
cache: 'pip'
35-
36-
- name: Install OpenAPI Generator
37-
run: |
38-
npm install -g @openapitools/openapi-generator-cli
39-
pip install openapi-python-client
40-
41-
- name: Generate Code
42-
run: |
43-
chmod +x api/scripts/gen-all.sh
44-
./api/scripts/gen-all.sh
45-
46-
- name: Upload entire repository as artifact
47-
uses: actions/upload-artifact@v4
48-
with:
49-
name: full-repository
50-
path: .
51-
52-
build_images:
53-
runs-on: ubuntu-latest
54-
needs: generate_api_code
55-
strategy:
56-
matrix:
57-
service: [client, gateway, user-svc, concept-svc, genai-svc]
58-
max-parallel: 1
59-
steps:
60-
- name: Download full repository artifact
61-
uses: actions/download-artifact@v4
62-
with:
63-
name: full-repository
64-
path: .
65-
66-
- name: Log in to the Container registry
67-
uses: docker/login-action@v3
68-
with:
69-
registry: ghcr.io
70-
username: ${{ github.actor }}
71-
password: ${{ secrets.GITHUB_TOKEN }}
72-
73-
- name: Set up QEMU
74-
uses: docker/setup-qemu-action@v3
75-
with:
76-
platforms: all
77-
78-
- name: Install Docker Buildx
79-
uses: docker/setup-buildx-action@v3
80-
81-
- name: Extract metadata (tags, labels) for Docker
82-
id: meta
83-
uses: docker/metadata-action@v5
84-
with:
85-
images: ghcr.io/${{ github.repository }}/${{ matrix.service }}
86-
tags: |
87-
type=raw,value=pr-${{ github.event.pull_request.number }},enable=${{ github.event_name == 'pull_request' }}
88-
type=raw,value=latest,enable=${{ github.event_name == 'push' && github.ref == 'refs/heads/dev' }}
89-
90-
- name: Build and push Docker Image
91-
uses: docker/build-push-action@v5
92-
with:
93-
platforms: linux/amd64,linux/arm64
94-
context: ./${{ matrix.service }}
95-
file: ./${{ matrix.service }}/Dockerfile
96-
push: true
97-
tags: ${{ steps.meta.outputs.tags }}
98-
labels: ${{ steps.meta.outputs.labels }}
99-
cache-from: type=gha,scope=${{ matrix.service }}
100-
cache-to: type=gha,scope=${{ matrix.service }},mode=max
101-
102-
deploy:
103-
runs-on: ubuntu-latest
104-
needs: build_images
10518
environment:
10619
name: staging
10720

10821
steps:
109-
- name: Download full repository artifact
110-
uses: actions/download-artifact@v4
111-
with:
112-
name: full-repository
113-
path: .
22+
- name: Checkout code
23+
uses: actions/checkout@v4
11424

11525
- name: Setup Helm
11626
uses: azure/setup-helm@v3
@@ -127,18 +37,33 @@ jobs:
12737
mkdir -p $HOME/.kube
12838
echo "${{ secrets.KUBECONFIG }}" > $HOME/.kube/config
12939
130-
- name: Run Helm Upgrade
40+
- name: Run Helm Upgrade for workflow_run
41+
if: github.event_name == 'workflow_run'
42+
run: |
43+
cd helm/ai-event-concepter
44+
helm upgrade --install ai-event-concepter . \
45+
--namespace team-git-push-force-dev \
46+
--create-namespace \
47+
--set ingress.host=dev-aieventconcepter.student.k8s.aet.cit.tum.de \
48+
--set client.image.tag=dev \
49+
--set gateway.image.tag=dev \
50+
--set usersvc.image.tag=dev \
51+
--set conceptsvc.image.tag=dev \
52+
--set genaisvc.image.tag=dev
53+
54+
- name: Run Helm Upgrade for pull_request
55+
if: github.event_name == 'pull_request'
13156
run: |
13257
cd helm/ai-event-concepter
13358
helm upgrade --install ai-event-concepter . \
13459
--namespace team-git-push-force-dev \
13560
--create-namespace \
13661
--set ingress.host=dev-aieventconcepter.student.k8s.aet.cit.tum.de \
137-
--set client.image.tag=pr-${{ github.event.pull_request.number || github.sha }} \
138-
--set gateway.image.tag=pr-${{ github.event.pull_request.number || github.sha }} \
139-
--set usersvc.image.tag=pr-${{ github.event.pull_request.number || github.sha }} \
140-
--set conceptsvc.image.tag=pr-${{ github.event.pull_request.number || github.sha }} \
141-
--set genaisvc.image.tag=pr-${{ github.event.pull_request.number || github.sha }}
62+
--set client.image.tag=pr-${{ github.event.pull_request.number }} \
63+
--set gateway.image.tag=pr-${{ github.event.pull_request.number }} \
64+
--set usersvc.image.tag=pr-${{ github.event.pull_request.number }} \
65+
--set conceptsvc.image.tag=pr-${{ github.event.pull_request.number }} \
66+
--set genaisvc.image.tag=pr-${{ github.event.pull_request.number }}
14267
14368
- name: Rollout Restart Deployments
14469
run: |
42.7 KB
Binary file not shown.
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
package de.tum.aet.devops25;
2+
3+
import de.tum.aet.devops25.api.generated.model.GetGatewayHealth200Response;
4+
import org.junit.jupiter.api.Test;
5+
import org.springframework.beans.factory.annotation.Autowired;
6+
import org.springframework.boot.test.context.SpringBootTest;
7+
import org.springframework.http.ResponseEntity;
8+
9+
import static org.junit.jupiter.api.Assertions.assertEquals;
10+
import static org.junit.jupiter.api.Assertions.assertNotNull;
11+
12+
@SpringBootTest
13+
class GatewayHealthControllerTest {
14+
15+
@Autowired
16+
private GatewayHealthController gatewayHealthController;
17+
18+
@Test
19+
void contextLoads() {
20+
// This test verifies that the Spring Boot application context can be loaded successfully
21+
}
22+
23+
@Test
24+
void testGetGatewayHealth() {
25+
// Test the getGatewayHealth method of the GatewayHealthController
26+
ResponseEntity<GetGatewayHealth200Response> response = gatewayHealthController.getGatewayHealth();
27+
28+
// Verify that the response is not null
29+
assertNotNull(response);
30+
assertNotNull(response.getBody());
31+
32+
// Verify that the status is "UP"
33+
assertEquals("UP", response.getBody().getStatus());
34+
35+
// Verify that the timestamp is not null
36+
assertNotNull(response.getBody().getTimestamp());
37+
}
38+
}

0 commit comments

Comments
 (0)