Skip to content

Commit e13b4a8

Browse files
Integrated code lifecycle: Insert repository content consistently when preparing for building (#9521)
1 parent 3b1b15e commit e13b4a8

File tree

4 files changed

+18
-8
lines changed

4 files changed

+18
-8
lines changed

src/main/java/de/tum/cit/aet/artemis/buildagent/service/BuildJobContainerService.java

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -300,16 +300,17 @@ public void populateBuildJobContainer(String buildJobContainerId, Path assignmen
300300
executeDockerCommand(buildJobContainerId, null, false, false, true, "chmod", "-R", "777", LOCALCI_WORKING_DIRECTORY + "/testing-dir");
301301

302302
// Copy the test repository to the container and move it to the test checkout path (may be the working directory)
303-
addAndPrepareDirectory(buildJobContainerId, testRepositoryPath, LOCALCI_WORKING_DIRECTORY + "/testing-dir/" + testCheckoutPath);
303+
addAndPrepareDirectoryAndReplaceContent(buildJobContainerId, testRepositoryPath, LOCALCI_WORKING_DIRECTORY + "/testing-dir/" + testCheckoutPath);
304304
// Copy the assignment repository to the container and move it to the assignment checkout path
305-
addAndPrepareDirectory(buildJobContainerId, assignmentRepositoryPath, LOCALCI_WORKING_DIRECTORY + "/testing-dir/" + assignmentCheckoutPath);
305+
addAndPrepareDirectoryAndReplaceContent(buildJobContainerId, assignmentRepositoryPath, LOCALCI_WORKING_DIRECTORY + "/testing-dir/" + assignmentCheckoutPath);
306306
if (solutionRepositoryPath != null) {
307307
solutionCheckoutPath = (!StringUtils.isBlank(solutionCheckoutPath)) ? solutionCheckoutPath
308308
: RepositoryCheckoutPath.SOLUTION.forProgrammingLanguage(programmingLanguage);
309-
addAndPrepareDirectory(buildJobContainerId, solutionRepositoryPath, LOCALCI_WORKING_DIRECTORY + "/testing-dir/" + solutionCheckoutPath);
309+
addAndPrepareDirectoryAndReplaceContent(buildJobContainerId, solutionRepositoryPath, LOCALCI_WORKING_DIRECTORY + "/testing-dir/" + solutionCheckoutPath);
310310
}
311311
for (int i = 0; i < auxiliaryRepositoriesPaths.length; i++) {
312-
addAndPrepareDirectory(buildJobContainerId, auxiliaryRepositoriesPaths[i], LOCALCI_WORKING_DIRECTORY + "/testing-dir/" + auxiliaryRepositoryCheckoutDirectories[i]);
312+
addAndPrepareDirectoryAndReplaceContent(buildJobContainerId, auxiliaryRepositoriesPaths[i],
313+
LOCALCI_WORKING_DIRECTORY + "/testing-dir/" + auxiliaryRepositoryCheckoutDirectories[i]);
313314
}
314315

315316
createScriptFile(buildJobContainerId);
@@ -320,12 +321,17 @@ private void createScriptFile(String buildJobContainerId) {
320321
executeDockerCommand(buildJobContainerId, null, false, false, true, "bash", "-c", "chmod +x " + LOCALCI_WORKING_DIRECTORY + "/script.sh");
321322
}
322323

323-
private void addAndPrepareDirectory(String containerId, Path repositoryPath, String newDirectoryName) {
324+
private void addAndPrepareDirectoryAndReplaceContent(String containerId, Path repositoryPath, String newDirectoryName) {
324325
copyToContainer(repositoryPath.toString(), containerId);
325-
addDirectory(containerId, getParentFolderPath(newDirectoryName), true);
326+
addDirectory(containerId, newDirectoryName, true);
327+
removeDirectoryAndFiles(containerId, newDirectoryName);
326328
renameDirectoryOrFile(containerId, LOCALCI_WORKING_DIRECTORY + "/" + repositoryPath.getFileName().toString(), newDirectoryName);
327329
}
328330

331+
private void removeDirectoryAndFiles(String containerId, String newName) {
332+
executeDockerCommand(containerId, null, false, false, true, "rm", "-rf", newName);
333+
}
334+
329335
private void renameDirectoryOrFile(String containerId, String oldName, String newName) {
330336
executeDockerCommand(containerId, null, false, false, true, "mv", oldName, newName);
331337
}
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
#creation-config-selector {
22
position: relative;
33
}
4+
5+
::ng-deep .tooltip-inner {
6+
max-width: 600px;
7+
}

src/main/webapp/i18n/de/programmingExercise.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@
535535
"auxiliaryRepository": {
536536
"error": "Es gibt ein Problem mit den Hilfs-Repositories!",
537537
"addAuxiliaryRepository": "Hilfs-Repository anlegen",
538-
"usageDescription": "Du kannst Hilfsrepositorys verwenden, um zusätzlichen Code bereitzustellen, den Studierende nicht sehen oder ändern können. Der zusätzliche Code wird während des Builds der Abgabe am angegebenen Checkout-Verzeichnis eingefügt.",
538+
"usageDescription": "Du kannst Hilfsrepositorien verwenden, um zusätzlichen Code bereitzustellen, den die Studierenden nicht sehen oder ändern können. Der zusätzliche Code wird im angegebenen Checkout-Verzeichnis eingefügt, bevor der Build erstellt wird. Der eingefügte Code überschreibt alles, was sich an der durch das Checkout-Verzeichnis angegebenen Stelle befindet. Wenn du die Dateien der Studierenden nur teilweise überschreiben willst, muss das Build-Skript angepasst werden.",
539539
"repositoryName": "Name des Repositorys",
540540
"checkoutDirectory": "Checkout-Verzeichnis",
541541
"description": "Beschreibung",

src/main/webapp/i18n/en/programmingExercise.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@
535535
"auxiliaryRepository": {
536536
"error": "There is a problem with the auxiliary repository.",
537537
"addAuxiliaryRepository": "Add Auxiliary Repository",
538-
"usageDescription": "You can use auxiliary repositories to provide additional code that students cannot see or modify. The additional code is inserted at the specified Checkout Directory during the build of the submission.",
538+
"usageDescription": "You can use auxiliary repositories to provide additional code that students cannot see or modify. The additional code is inserted into the specified checkout directory before the submission is built. The inserted code overwrites everything which lies at the location specified by the checkout directory. If you only need to overwrite student files partially, you need to adapt the build script.",
539539
"repositoryName": "Repository Name",
540540
"checkoutDirectory": "Checkout Directory",
541541
"description": "Description",

0 commit comments

Comments
 (0)