Compare commits

..

10 commits

6 changed files with 42 additions and 20 deletions

View file

@ -1,11 +1,9 @@
stages:
- package
- compile
- test
- build
.setup-mvn: &setup-mvn
- chmod a+x mvnw
variables:
MAVEN_OPTS: "-Dmaven.repo.local=.m2/repository"
@ -14,18 +12,30 @@ cache:
- .m2/repository/
- "**/target/"
container:
stage: package
image: $CI_REGISTRY/ict/images/alpine/ci:latest
variables:
BUILDAH_ISOLATION: chroot
IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
before_script:
- apk add buildah fuse-overlayfs
- buildah login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- buildah info
script:
- buildah build --tag $IMAGE_TAG -f Dockerfile
- buildah push $IMAGE_TAG
compile:
stage: compile
image: maven:3.8.6-openjdk-18
script:
- *setup-mvn
- ./mvnw clean compile
test:
stage: test
image: markhobson/maven-chrome:jdk-18
script:
- *setup-mvn
- ./mvnw test
artifacts:
name: "Surefire test reports from $CI_PROJECT_NAME on $CI_COMMIT_REF_SLUG"
@ -38,15 +48,13 @@ check:
stage: build
image: markhobson/maven-chrome:jdk-18
script:
- *setup-mvn
- ./mvnw clean compile
- ./mvnw clean compile # dependency-check:aggregate
- ./mvnw sonar:sonar -Dsonar.projectKey=$SONAR_PROJECT -Dsonar.projectName=$SONAR_PROJECT -Dsonar.host.url=$SONAR_URL -Dsonar.token=$SONAR_TOKEN
build:
stage: build
image: maven:3.8.6-openjdk-18
script:
- *setup-mvn
- ./mvnw package -DskipTests
artifacts:
name: "Maven artifacts from $CI_PROJECT_NAME on $CI_COMMIT_REF_SLUG"

5
Dockerfile Normal file
View file

@ -0,0 +1,5 @@
FROM eclipse-temurin:17-jre-jammy
ARG JAR_FILE=app/target/*.jar
COPY ${JAR_FILE} app.jar
EXPOSE 8081
ENTRYPOINT ["java","-jar","/app.jar"]

View file

@ -9,15 +9,18 @@ import java.util.List;
@Component
@Profile("stub")
public class ClubDatabaseDaoStub implements ClubDatabaseDao {
public static final String PILOT_ROLE = "PILOT";
public static final String BACKOFFICE_ROLE = "BACKOFFICE";
@Override
public List<User> getUsers() {
return Arrays.asList(
new User(1L, "Kamila", "Spoustová", Arrays.asList("PILOT")),
new User(2L, "Naděžda", "Pavelková", Arrays.asList("PILOT")),
new User(3L, "Silvie", "Hronová", Arrays.asList("PILOT")),
new User(9L, "Miloš", "Korbel", Arrays.asList("PILOT", "BACKOFFICE")),
new User(10L, "Petr", "Hrubec", Arrays.asList("PILOT", "BACKOFFICE")),
new User(13L, "Michal", "Vyvlečka", Arrays.asList("BACKOFFICE"))
new User(1L, "Kamila", "Spoustová", Arrays.asList(PILOT_ROLE)),
new User(2L, "Naděžda", "Pavelková", Arrays.asList(PILOT_ROLE)),
new User(3L, "Silvie", "Hronová", Arrays.asList(PILOT_ROLE)),
new User(9L, "Miloš", "Korbel", Arrays.asList(PILOT_ROLE, BACKOFFICE_ROLE)),
new User(10L, "Petr", "Hrubec", Arrays.asList(PILOT_ROLE, BACKOFFICE_ROLE)),
new User(13L, "Michal", "Vyvlečka", Arrays.asList(BACKOFFICE_ROLE))
);
}
}

12
pom.xml
View file

@ -93,5 +93,17 @@
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.owasp</groupId>
<artifactId>dependency-check-maven</artifactId>
<version>8.4.0</version>
<configuration>
<format>ALL</format>
</configuration>
</plugin>
</plugins>
</build>
</project>

View file

@ -51,10 +51,6 @@ public class FlightController {
@PostMapping("/flight/takeoff")
public ResponseEntity<Serializable> takeoff(@RequestBody FlightTakeoffTo start) {
// TODO tutorial-4.2: Remove this commented-out code
// for (int i = 0; i <= 10; i++) {
// System.out.println("Just printing i:" + i);
// }
log.debug("Start\n{}", start);
flightService.takeoff(start);

View file

@ -32,12 +32,10 @@ public class CsvExportServiceImpl implements CsvExportService {
private final FlightRepository flightRepository;
private final String fileName;
private String neverUsedField;
public CsvExportServiceImpl(FlightRepository flightRepository, @Value("${csv.export.flight.fileName}") String fileName) {
this.flightRepository = flightRepository;
this.fileName = fileName;
this.neverUsedField = "redundant";
}
@Override