From c3d4706de75c322d117adeae7ee45e1c7159bcdb Mon Sep 17 00:00:00 2001 From: Andreas Resch Date: Sat, 14 Oct 2023 14:24:35 +0200 Subject: [PATCH 1/2] only set import to true if importing from a file --- .../service/programming/ProgrammingExerciseImportService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/de/tum/in/www1/artemis/service/programming/ProgrammingExerciseImportService.java b/src/main/java/de/tum/in/www1/artemis/service/programming/ProgrammingExerciseImportService.java index 4cc23398df63..e061f54e99d7 100644 --- a/src/main/java/de/tum/in/www1/artemis/service/programming/ProgrammingExerciseImportService.java +++ b/src/main/java/de/tum/in/www1/artemis/service/programming/ProgrammingExerciseImportService.java @@ -286,7 +286,7 @@ public ProgrammingExercise importProgrammingExercise(ProgrammingExercise origina if (recreateBuildPlans) { // Create completely new build plans for the exercise - programmingExerciseService.setupBuildPlansForNewExercise(importedProgrammingExercise, true); + programmingExerciseService.setupBuildPlansForNewExercise(importedProgrammingExercise, false); } else { // We have removed the automatic build trigger from test to base for new programming exercises. From ddd97b0d42ae87f632a6fa322815ead7ac0f7370 Mon Sep 17 00:00:00 2001 From: Andreas Resch Date: Sat, 14 Oct 2023 15:20:20 +0200 Subject: [PATCH 2/2] rename argument --- .../programming/ProgrammingExerciseService.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/de/tum/in/www1/artemis/service/programming/ProgrammingExerciseService.java b/src/main/java/de/tum/in/www1/artemis/service/programming/ProgrammingExerciseService.java index bfad5dbc39e4..3805305e6917 100644 --- a/src/main/java/de/tum/in/www1/artemis/service/programming/ProgrammingExerciseService.java +++ b/src/main/java/de/tum/in/www1/artemis/service/programming/ProgrammingExerciseService.java @@ -193,14 +193,14 @@ public ProgrammingExerciseService(ProgrammingExerciseRepository programmingExerc * * * @param programmingExercise The programmingExercise that should be setup - * @param imported defines if the programming exercise is imported + * @param isImportedFromFile defines if the programming exercise is imported from a file * @return The new setup exercise * @throws GitAPIException If something during the communication with the remote Git repository went wrong * @throws IOException If the template files couldn't be read */ @Transactional // TODO: apply the transaction on a smaller scope // ok because we create many objects in a rather complex way and need a rollback in case of exceptions - public ProgrammingExercise createProgrammingExercise(ProgrammingExercise programmingExercise, boolean imported) throws GitAPIException, IOException { + public ProgrammingExercise createProgrammingExercise(ProgrammingExercise programmingExercise, boolean isImportedFromFile) throws GitAPIException, IOException { programmingExercise.generateAndSetProjectKey(); final User exerciseCreator = userRepository.getUser(); @@ -223,7 +223,7 @@ public ProgrammingExercise createProgrammingExercise(ProgrammingExercise program channelService.createExerciseChannel(savedProgrammingExercise, Optional.ofNullable(programmingExercise.getChannelName())); - setupBuildPlansForNewExercise(savedProgrammingExercise, imported); + setupBuildPlansForNewExercise(savedProgrammingExercise, isImportedFromFile); // save to get the id required for the webhook savedProgrammingExercise = programmingExerciseRepository.saveAndFlush(savedProgrammingExercise); @@ -346,10 +346,10 @@ public void validateStaticCodeAnalysisSettings(ProgrammingExercise programmingEx * * @param programmingExercise Programming exercise for the build plans should be generated. The programming * exercise should contain a fully initialized template and solution participation. - * @param isImported defines if the programming exercise is imported from a source exercise, if the + * @param isImportedFromFile defines if the programming exercise is imported from a file, if the * exercise is imported, the build plans will not be triggered to prevent erroneous builds */ - public void setupBuildPlansForNewExercise(ProgrammingExercise programmingExercise, boolean isImported) { + public void setupBuildPlansForNewExercise(ProgrammingExercise programmingExercise, boolean isImportedFromFile) { String projectKey = programmingExercise.getProjectKey(); // Get URLs for repos var exerciseRepoUrl = programmingExercise.getVcsTemplateRepositoryUrl(); @@ -370,7 +370,7 @@ public void setupBuildPlansForNewExercise(ProgrammingExercise programmingExercis // if the exercise is imported from a file, the changes fixing the project name will trigger a first build anyway, so // we do not trigger them here - if (!isImported) { + if (!isImportedFromFile) { // trigger BASE and SOLUTION build plans once here continuousIntegrationTriggerService.orElseThrow().triggerBuild(programmingExercise.getTemplateParticipation()); continuousIntegrationTriggerService.orElseThrow().triggerBuild(programmingExercise.getSolutionParticipation());