1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-30 21:55:31 +02:00

Bug 497779 - Add labels to applications run as Docker containers

- add CDTLaunch label (no value) and CDTProject label (with project)
  for containers created by the CDT Run in Container launch

Change-Id: Ic9a1ccb3c998083eccb6b16098c4a443c7d040bc
This commit is contained in:
Jeff Johnston 2016-07-13 13:09:57 -04:00
parent 72e0c1b6fe
commit bfcf98caff

View file

@ -11,6 +11,7 @@
package org.eclipse.cdt.internal.docker.launcher;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -118,6 +119,13 @@ public class ContainerLaunchConfigurationDelegate extends GdbLaunchDelegate
IPath commandPath = getCommandPath(configuration);
if (commandPath != null) {
// create some labels to allow user to filter out such Containers if
// kept
Map<String, String> labels = new HashMap<>();
labels.put("CDTLaunch", ""); //$NON-NLS-1$ //$NON-NLS-2$
String projectName = configuration.getAttribute(
ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, ""); //$NON-NLS-1$
labels.put("CDTProject", projectName); //$NON-NLS-1$
if (mode.equals(ILaunchManager.RUN_MODE)) {
String commandDir = commandPath.removeLastSegments(1)
.toString();
@ -169,7 +177,7 @@ public class ContainerLaunchConfigurationDelegate extends GdbLaunchDelegate
image, command,
commandDir, workingDir, additionalDirs, origEnv,
envMap, null, keepContainer, supportStdin,
privilegedMode);
privilegedMode, labels);
} else if (mode.equals(ILaunchManager.DEBUG_MODE)) {
String gdbserverPortNumber = configuration.getAttribute(
ILaunchConstants.ATTR_GDBSERVER_PORT,
@ -235,7 +243,7 @@ public class ContainerLaunchConfigurationDelegate extends GdbLaunchDelegate
image, command,
commandDir, workingDir, additionalDirs, origEnv,
envMap, ports, keepContainer, supportStdin,
privilegedMode);
privilegedMode, labels);
// wait until gdbserver is started successfully and we have its
// ip address or