Skip to content

Commit

Permalink
feat : build native image
Browse files Browse the repository at this point in the history
  • Loading branch information
rajadilipkolli committed Dec 22, 2024
1 parent 195a953 commit 867e94e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/boot-strategy-plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:

- if: ${{ github.ref == 'refs/heads/main' }}
name: Build container image
run: ./mvnw spring-boot:build-image -Dspring-boot.build-image.imageName=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/boot-strategy-plugin:${{ env.VERSION }}
run: ./mvnw -Pnative spring-boot:build-image -Dspring-boot.build-image.imageName=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/boot-strategy-plugin:${{ env.VERSION }}

- if: ${{ github.ref == 'refs/heads/main' }}
name: OCI image vulnerability scanning
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseStatus;

import java.net.URI;
import java.util.Comparator;
import java.util.List;
import java.util.Objects;
Expand All @@ -26,19 +27,23 @@ ProblemDetail onException(MethodArgumentNotValidException methodArgumentNotValid
ProblemDetail problemDetail =
ProblemDetail.forStatusAndDetail(
HttpStatusCode.valueOf(400), "Invalid request content.");
problemDetail.setType(URI.create("https://api.example.com/errors/validation"));
problemDetail.setTitle("Constraint Violation");
List<ApiValidationError> validationErrorsList =
methodArgumentNotValidException.getAllErrors().stream()
.map(
objectError -> {
FieldError fieldError = (FieldError) objectError;
return new ApiValidationError(
fieldError.getObjectName(),
fieldError.getField(),
fieldError.getRejectedValue(),
Objects.requireNonNull(
fieldError.getDefaultMessage(), ""));
if (objectError instanceof FieldError fieldError) {
return new ApiValidationError(
fieldError.getObjectName(),
fieldError.getField(),
fieldError.getRejectedValue(),
Objects.requireNonNull(
fieldError.getDefaultMessage(), ""));
}
return null;
})
.filter(Objects::nonNull)
.sorted(Comparator.comparing(ApiValidationError::field))
.toList();
problemDetail.setProperty("violations", validationErrorsList);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import java.time.Instant;

public class PluginNotFoundException extends ErrorResponseException {

public PluginNotFoundException(String message) {
super(
HttpStatus.BAD_REQUEST,
Expand Down

0 comments on commit 867e94e

Please sign in to comment.