Skip to content

[localstack] Add testcontainer marker labels to additional localstack flags #9531

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,10 @@ protected void configure() {
@Override
protected void containerIsStarting(InspectContainerResponse containerInfo) {
String command = "#!/bin/bash\n";
command += "export LAMBDA_DOCKER_FLAGS=" + configureLambdaContainerLabels() + "\n";
command += "export LAMBDA_DOCKER_FLAGS=" + configureServiceContainerLabels("LAMBDA_DOCKER_FLAGS") + "\n";
command += "export ECS_DOCKER_FLAGS=" + configureServiceContainerLabels("ECS_DOCKER_FLAGS") + "\n";
command += "export EC2_DOCKER_FLAGS=" + configureServiceContainerLabels("EC2_DOCKER_FLAGS") + "\n";
command += "export BATCH_DOCKER_FLAGS=" + configureServiceContainerLabels("BATCH_DOCKER_FLAGS") + "\n";
command += "/usr/local/bin/docker-entrypoint.sh\n";
copyFileToContainer(Transferable.of(command, 0777), STARTER_SCRIPT);
}
Expand All @@ -214,13 +217,13 @@ protected void containerIsStarting(InspectContainerResponse containerInfo) {
* chance.
* @return the lambda container labels as a string
*/
private String configureLambdaContainerLabels() {
String lambdaDockerFlags = internalMarkerLabels();
String existingLambdaDockerFlags = getEnvMap().get("LAMBDA_DOCKER_FLAGS");
if (existingLambdaDockerFlags != null) {
lambdaDockerFlags = existingLambdaDockerFlags + " " + lambdaDockerFlags;
private String configureServiceContainerLabels(String existingEnvFlagKey) {
String internalMarkerFlags = internalMarkerLabels();
String existingFlags = getEnvMap().get(existingEnvFlagKey);
if (existingFlags != null) {
internalMarkerFlags = existingFlags + " " + internalMarkerFlags;
}
return "\"" + lambdaDockerFlags + "\"";
return "\"" + internalMarkerFlags + "\"";
}

/**
Expand Down
Loading