Skip to content
Merged
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
14 changes: 14 additions & 0 deletions apis/openapi-spec/pipeline-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,10 @@ components:
type: array
items:
$ref: "#/components/schemas/Stage"
required:
- id
Comment thread
SuvabrataChowdhury marked this conversation as resolved.
Resolved
- name
- stages
PipelineBuild:
type: object
properties:
Expand All @@ -275,6 +279,16 @@ components:
type: array
items:
$ref: "#/components/schemas/StageBuild"
startedAt:
type: string
format: date-time
required:
- currentState
- id
- pipelineId
- pipelineName
- stageBuilds
- startedAt
PipelineExecuteRequest:
type: object
properties:
Expand Down
18 changes: 6 additions & 12 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,6 @@ services:
- "8016:8016"
networks:
- app
healthcheck:
test: ["CMD-SHELL", "exec 3<>/dev/tcp/127.0.0.1/8014 && echo -e 'GET /readyz HTTP/1.1\\r\\nHost: localhost\\r\\nConnection: close\\r\\n\\r\\n' >&3 && grep -q 'HTTP/1.1 200' <&3"]
interval: 10s
timeout: 5s
retries: 3
start_period: 10s
pipeline-app:
build:
context: .
Expand Down Expand Up @@ -101,15 +95,15 @@ services:
auth-service:
condition: service_healthy
flagd:
condition: service_healthy
condition: service_started
pipeline-ui:
build:
context: ./pipeline-ui
dockerfile: Dockerfile
context: .
dockerfile: pipeline-ui/Dockerfile
args:
VITE_API_BASE_URL: http://pipeline-app:8080/api/v1
VITE_API_BASE_URL: http://localhost:8080/api/v1
VITE_IDP: keycloak
VITE_KC_URL: http://auth-service:8080
VITE_KC_URL: http://localhost:8180
VITE_KC_REALM: SpringBootRealm
VITE_KC_CLIENTID: pipeline-app
image: pipeline-ui
Expand All @@ -119,4 +113,4 @@ services:
- app
depends_on:
pipeline-app:
condition: service_started
condition: service_started
22 changes: 13 additions & 9 deletions pipeline-ui/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,21 @@
#
FROM node:22-alpine AS build
WORKDIR /app
COPY package*.json ./
RUN apk add --no-cache openjdk17-jre-headless
COPY pipeline-ui/package*.json ./
RUN npm ci
COPY src ./src
COPY public ./public
COPY index.html .
COPY vite.config.ts .
COPY tsconfig*.json ./
COPY tailwind.config.js postcss.config.js ./
ARG VITE_API_BASE_URL=http://pipeline-app:8080/api/v1
COPY pipeline-ui/src ./src
COPY pipeline-ui/public ./public
COPY pipeline-ui/index.html .
COPY pipeline-ui/vite.config.ts .
COPY pipeline-ui/tsconfig*.json ./
COPY pipeline-ui/tailwind.config.js pipeline-ui/postcss.config.js ./
COPY pipeline-ui/openapitools.json .
COPY apis/openapi-spec /apis/openapi-spec
RUN npm run generate:client-code
ARG VITE_API_BASE_URL=http://localhost:8080/api/v1
ARG VITE_IDP=keycloak
ARG VITE_KC_URL=http://auth-service:8080
ARG VITE_KC_URL=http://localhost:8180
ARG VITE_KC_REALM=SpringBootRealm
ARG VITE_KC_CLIENTID=pipeline-app
ENV VITE_API_BASE_URL=${VITE_API_BASE_URL}
Expand Down
2 changes: 1 addition & 1 deletion pipeline-ui/tsconfig.app.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"erasableSyntaxOnly": true,
"erasableSyntaxOnly": false,
"noFallthroughCasesInSwitch": true,
"noUncheckedSideEffectImports": true
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@
import org.springframework.stereotype.Component;

import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.media.DateTimeSchema;
import io.swagger.v3.oas.models.media.Schema;

//TODO: Remove this as it is a complete anti pattern and makes introducing new fields very difficult

/**
* Cleans up the generated OpenAPI spec from proto internals.
*
Expand All @@ -37,7 +40,7 @@ public class ProtobufOpenApiCustomizer implements OpenApiCustomizer {
private static final Map<String, Set<String>> SCHEMA_ALLOWED_PROPERTIES = Map.of(
"Pipeline", Set.of("id", "name", "stagesList"),
"Stage", Set.of("id", "name", "scriptType", "stageOrder", "command"),
"PipelineBuild", Set.of("id", "pipelineId", "pipelineName", "currentState", "stageBuildsList"),
"PipelineBuild", Set.of("id", "pipelineId", "pipelineName", "currentState", "stageBuildsList", "startedAt"),
"StageBuild", Set.of("id", "stageId", "stageName", "stageOrder", "currentState")
);

Expand Down Expand Up @@ -108,7 +111,26 @@ public void customise(OpenAPI openApi) {
}
});

// Step 5: sort schemas alphabetically and sort properties within each schema
// Step 5: override Protobuf Timestamp fields to string/date-time
Schema<?> pipelineBuildSchema = schemas.get("PipelineBuild");
if (pipelineBuildSchema != null && pipelineBuildSchema.getProperties() != null) {
Map<String, Schema> props = (Map<String, Schema>) pipelineBuildSchema.getProperties();
props.put("startedAt", new DateTimeSchema());
}

// Step 6: mark required fields so the generated client types are non-optional
Map<String, List<String>> requiredFields = Map.of(
"Pipeline", List.of("id", "name", "stages"),
"PipelineBuild", List.of("id", "pipelineId", "pipelineName", "currentState", "startedAt", "stageBuilds")
);
requiredFields.forEach((schemaName, fields) -> {
Schema<?> schema = schemas.get(schemaName);
if (schema != null) {
schema.setRequired(fields);
}
});

// Step 7: sort schemas alphabetically and sort properties within each schema
schemas.forEach((name, schema) -> {
if (schema.getProperties() != null) {
schema.setProperties(new TreeMap<>(schema.getProperties()));
Expand Down
Loading