Skip to content

Commit

Permalink
kubectlbuildwrapper: simplify, set context in common path
Browse files Browse the repository at this point in the history
  • Loading branch information
colemickens committed Mar 20, 2018
1 parent 4d5f93c commit a565ff6
Showing 1 changed file with 3 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ public void setUp(Context context, Run<?, ?> build, FilePath workspace, Launcher
FilePath configFile = workspace.createTempFile(".kube", "config");
Set<String> tempFiles = newHashSet(configFile.getRemote());

context.env("KUBECONFIG", configFile.getRemote());
context.setDisposer(new CleanupDisposer(tempFiles));

String tlsConfig;
if (caCertificate != null && !caCertificate.isEmpty()) {
FilePath caCrtFile = workspace.createTempFile("cert-auth", "crt");
Expand Down Expand Up @@ -130,9 +133,6 @@ public void setUp(Context context, Run<?, ?> build, FilePath workspace, Launcher
} finally {
reader.close();
}

context.setDisposer(new CleanupDisposer(tempFiles));
context.env("KUBECONFIG", configFile.getRemote());
return;
}

Expand Down Expand Up @@ -191,10 +191,6 @@ public void setUp(Context context, Run<?, ?> build, FilePath workspace, Launcher
.cmdAsSingleString("kubectl config --kubeconfig=\"" + configFile.getRemote() + "\" use-context k8s")
.join();
if (status != 0) throw new IOException("Failed to run kubectl config "+status);

context.setDisposer(new CleanupDisposer(tempFiles));

context.env("KUBECONFIG", configFile.getRemote());
}

/**
Expand Down

0 comments on commit a565ff6

Please sign in to comment.