From c9651cdd5968f886f418946c22cb0c581ad566aa Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Fri, 16 Aug 2024 18:44:12 -0400 Subject: [PATCH] feat(ci): include build numbers in container envars (#1528) Co-authored-by: Craig Yu --- backend/Dockerfile | 4 ++++ .../ca/bc/gov/backendstartapi/service/SeedlotService.java | 8 ++++---- frontend/Dockerfile | 4 ++++ .../views/Seedlot/SeedlotReview/SeedlotReviewContent.tsx | 2 ++ oracle-api/Dockerfile | 4 ++++ 5 files changed, 18 insertions(+), 4 deletions(-) diff --git a/backend/Dockerfile b/backend/Dockerfile index 6bf1415b6..4c875881b 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -15,6 +15,10 @@ RUN ./mvnw -B package -Pnative -DskipTests FROM gcr.io/distroless/java-base:nonroot AS deploy ARG PORT=8090 +# Receive build number as argument, retain as environment variable +ARG BUILD_NUMBER +ENV BUILD_NUMBER=${BUILD_NUMBER} + # Copy WORKDIR /app COPY --from=build /app/target/nr-spar-backend ./nr-spar-backend diff --git a/backend/src/main/java/ca/bc/gov/backendstartapi/service/SeedlotService.java b/backend/src/main/java/ca/bc/gov/backendstartapi/service/SeedlotService.java index 90d1c512d..fd95fb6de 100644 --- a/backend/src/main/java/ca/bc/gov/backendstartapi/service/SeedlotService.java +++ b/backend/src/main/java/ca/bc/gov/backendstartapi/service/SeedlotService.java @@ -575,7 +575,9 @@ public SeedlotAclassFormDto getAclassSeedlotFormInfo(@NonNull String seedlotNumb owner.getOriginalPercentageOwned(), owner.getOriginalPercentageReserved(), owner.getOriginalPercentageSurplus(), - owner.getMethodOfPayment().getMethodOfPaymentCode(), + owner.getMethodOfPayment() != null + ? owner.getMethodOfPayment().getMethodOfPaymentCode() + : null, owner.getFundingSourceCode())) .collect(Collectors.toList()); @@ -598,9 +600,7 @@ public SeedlotAclassFormDto getAclassSeedlotFormInfo(@NonNull String seedlotNumb seedlotOrchards.stream().filter(so -> so.getIsPrimary()).toList(); primaryOrchardId = - filteredPrimaryOrchard.isEmpty() - ? null - : filteredPrimaryOrchard.get(0).getOrchardId(); + filteredPrimaryOrchard.isEmpty() ? null : filteredPrimaryOrchard.get(0).getOrchardId(); } Optional secondaryOrchardId = Optional.empty(); diff --git a/frontend/Dockerfile b/frontend/Dockerfile index 8fe570325..fab4771b2 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -17,6 +17,10 @@ RUN npm ci --ignore-scripts --no-update-notifier --omit=dev && \ FROM caddy:2.8.4-alpine RUN apk add --no-cache ca-certificates curl +# Receive build number as argument, retain as environment variable +ARG BUILD_NUMBER +ENV BUILD_NUMBER=${BUILD_NUMBER} + # Copy files and run formatting COPY --from=build /app/build/ /app/dist COPY Caddyfile /etc/caddy/Caddyfile diff --git a/frontend/src/views/Seedlot/SeedlotReview/SeedlotReviewContent.tsx b/frontend/src/views/Seedlot/SeedlotReview/SeedlotReviewContent.tsx index a9ef439a1..c1c6f4db2 100644 --- a/frontend/src/views/Seedlot/SeedlotReview/SeedlotReviewContent.tsx +++ b/frontend/src/views/Seedlot/SeedlotReview/SeedlotReviewContent.tsx @@ -715,6 +715,8 @@ const SeedlotReviewContent = () => { : null } { + // this and its related code such as createDraftForPendMutation + // needs to be deleted in the future (luxon.local().setZone('America/Vancouver').toISODate() ?? '' < '2024-08-17') ? ( diff --git a/oracle-api/Dockerfile b/oracle-api/Dockerfile index e8449b0fc..dfd777ba9 100644 --- a/oracle-api/Dockerfile +++ b/oracle-api/Dockerfile @@ -12,6 +12,10 @@ RUN ./mvnw package -Pnative -DskipTests -Dskip.unit.tests=true && \ ### Deployer FROM eclipse-temurin:17.0.11_9-jdk-jammy AS deploy +# Receive build number as argument, retain as environment variable +ARG BUILD_NUMBER +ENV BUILD_NUMBER=${BUILD_NUMBER} + # Java vars ENV LANG=en_CA.UTF-8 ENV LANGUAGE=en_CA.UTF-8