Skip to content
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

Prevent buildpack inception style builds #24995

Merged
merged 1 commit into from
Apr 25, 2022
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 @@ -42,6 +42,8 @@
public class BuildpackProcessor {

private static final Logger log = Logger.getLogger(BuildpackProcessor.class);
private static final String QUARKUS_CONTAINER_IMAGE_BUILD = "QUARKUS_CONTAINER_IMAGE_BUILD";
private static final String QUARKUS_CONTAINER_IMAGE_PUSH = "QUARKUS_CONTAINER_IMAGE_PUSH";

public static final String BUILDPACK = "buildpack";

Expand Down Expand Up @@ -160,11 +162,15 @@ private String runBuildpackBuild(BuildpackConfig buildpackConfig,
String targetImageName = containerImage.getImage().toString();
log.debug("Using Destination image of " + targetImageName);

Map<String, String> envMap = buildpackConfig.builderEnv;
Map<String, String> envMap = new HashMap<>(buildpackConfig.builderEnv);
if (!envMap.isEmpty()) {
log.info("Using builder environment of " + envMap);
}

// Let's explicitly disable build and push during the build to avoid inception style builds
envMap.put(QUARKUS_CONTAINER_IMAGE_BUILD, "false");
envMap.put(QUARKUS_CONTAINER_IMAGE_PUSH, "false");

log.info("Initiating Buildpack build");
Buildpack buildpack = Buildpack.builder()
.addNewFileContent(dirs.get(ProjectDirs.ROOT).toFile())
Expand Down