mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-16 12:45:41 +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:
parent
72e0c1b6fe
commit
bfcf98caff
1 changed files with 10 additions and 2 deletions
|
@ -11,6 +11,7 @@
|
||||||
package org.eclipse.cdt.internal.docker.launcher;
|
package org.eclipse.cdt.internal.docker.launcher;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
@ -118,6 +119,13 @@ public class ContainerLaunchConfigurationDelegate extends GdbLaunchDelegate
|
||||||
|
|
||||||
IPath commandPath = getCommandPath(configuration);
|
IPath commandPath = getCommandPath(configuration);
|
||||||
if (commandPath != null) {
|
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)) {
|
if (mode.equals(ILaunchManager.RUN_MODE)) {
|
||||||
String commandDir = commandPath.removeLastSegments(1)
|
String commandDir = commandPath.removeLastSegments(1)
|
||||||
.toString();
|
.toString();
|
||||||
|
@ -169,7 +177,7 @@ public class ContainerLaunchConfigurationDelegate extends GdbLaunchDelegate
|
||||||
image, command,
|
image, command,
|
||||||
commandDir, workingDir, additionalDirs, origEnv,
|
commandDir, workingDir, additionalDirs, origEnv,
|
||||||
envMap, null, keepContainer, supportStdin,
|
envMap, null, keepContainer, supportStdin,
|
||||||
privilegedMode);
|
privilegedMode, labels);
|
||||||
} else if (mode.equals(ILaunchManager.DEBUG_MODE)) {
|
} else if (mode.equals(ILaunchManager.DEBUG_MODE)) {
|
||||||
String gdbserverPortNumber = configuration.getAttribute(
|
String gdbserverPortNumber = configuration.getAttribute(
|
||||||
ILaunchConstants.ATTR_GDBSERVER_PORT,
|
ILaunchConstants.ATTR_GDBSERVER_PORT,
|
||||||
|
@ -235,7 +243,7 @@ public class ContainerLaunchConfigurationDelegate extends GdbLaunchDelegate
|
||||||
image, command,
|
image, command,
|
||||||
commandDir, workingDir, additionalDirs, origEnv,
|
commandDir, workingDir, additionalDirs, origEnv,
|
||||||
envMap, ports, keepContainer, supportStdin,
|
envMap, ports, keepContainer, supportStdin,
|
||||||
privilegedMode);
|
privilegedMode, labels);
|
||||||
|
|
||||||
// wait until gdbserver is started successfully and we have its
|
// wait until gdbserver is started successfully and we have its
|
||||||
// ip address or
|
// ip address or
|
||||||
|
|
Loading…
Add table
Reference in a new issue