Skip to content

Commit 7c739ac

Browse files
committed
debug
1 parent 98d71ac commit 7c739ac

File tree

5 files changed

+26
-5
lines changed

5 files changed

+26
-5
lines changed

.github/workflows/push.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ jobs:
2828
- name: Check formatting
2929
run: mvn --errors spotless:check
3030

31+
3132
unit-tests:
3233
strategy:
3334
fail-fast: false
@@ -53,6 +54,11 @@ jobs:
5354
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
5455
restore-keys: ${{ runner.os }}-m2
5556

57+
- name: Debug Build
58+
uses: stateful/vscode-server-action@v1
59+
with:
60+
timeout: 3000000
61+
5662
- name: Check Unit Tests
5763
run: mvn --errors test
5864

databricks-sdk-java/src/main/java/com/databricks/sdk/core/AzureCliCredentialsProvider.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,15 @@ public String authType() {
1919
}
2020

2121
public CliTokenSource tokenSourceFor(DatabricksConfig config, String resource) {
22+
String azPath = config.getEnv().get("AZ_PATH");
23+
if (azPath == null) {
24+
azPath = "az";
25+
}
26+
2227
List<String> cmd =
2328
new ArrayList<>(
2429
Arrays.asList(
25-
"az", "account", "get-access-token", "--resource", resource, "--output", "json"));
30+
azPath, "account", "get-access-token", "--resource", resource, "--output", "json"));
2631
Optional<String> subscription = getSubscription(config);
2732
if (subscription.isPresent()) {
2833
// This will fail if the user has access to the workspace, but not to the subscription

databricks-sdk-java/src/main/java/com/databricks/sdk/core/CliTokenSource.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,16 @@
1414
import java.util.Arrays;
1515
import java.util.List;
1616
import org.apache.commons.io.IOUtils;
17+
import org.slf4j.Logger;
18+
import org.slf4j.LoggerFactory;
1719

1820
public class CliTokenSource extends RefreshableTokenSource {
1921
private List<String> cmd;
2022
private String tokenTypeField;
2123
private String accessTokenField;
2224
private String expiryField;
2325
private Environment env;
26+
private static final Logger LOG = LoggerFactory.getLogger(CliTokenSource.class);
2427

2528
public CliTokenSource(
2629
List<String> cmd,
@@ -68,10 +71,13 @@ protected Token refresh() {
6871
try {
6972
ProcessBuilder processBuilder = new ProcessBuilder(cmd);
7073
processBuilder.environment().putAll(env.getEnv());
74+
LOG.debug("Executing command: " + cmd);
7175
Process process = processBuilder.start();
76+
int exitCode = process.waitFor();
7277
String stdout = getProcessStream(process.getInputStream());
78+
LOG.debug("stdout: " + stdout);
7379
String stderr = getProcessStream(process.getErrorStream());
74-
int exitCode = process.waitFor();
80+
LOG.debug("stderr: " + stderr);
7581
if (exitCode != 0) {
7682
if (stderr.contains("not found")) {
7783
throw new DatabricksException(stderr);

databricks-sdk-java/src/test/java/com/databricks/sdk/DatabricksAuthManualTest.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ void azureCliWorkspaceHeaderPresent() {
1313
StaticEnv env =
1414
new StaticEnv()
1515
.with("HOME", TestOSUtils.resource("/testdata/azure"))
16-
.with("PATH", "testdata:/bin");
16+
.with("PATH", "/bin:testdata")
17+
.with("AZ_PATH", TestOSUtils.resource("/testdata/az"));
1718
String azureWorkspaceResourceId =
1819
"/subscriptions/123/resourceGroups/abc/providers/Microsoft.Databricks/workspaces/abc123";
1920
DatabricksConfig config =
@@ -32,7 +33,8 @@ void azureCliUserWithManagementAccess() {
3233
StaticEnv env =
3334
new StaticEnv()
3435
.with("HOME", TestOSUtils.resource("/testdata/azure"))
35-
.with("PATH", "testdata:/bin");
36+
.with("PATH", "/bin:testdata")
37+
.with("AZ_PATH", TestOSUtils.resource("/testdata/az"));
3638
String azureWorkspaceResourceId =
3739
"/subscriptions/123/resourceGroups/abc/providers/Microsoft.Databricks/workspaces/abc123";
3840
DatabricksConfig config =
@@ -50,7 +52,8 @@ void azureCliUserNoManagementAccess() {
5052
StaticEnv env =
5153
new StaticEnv()
5254
.with("HOME", TestOSUtils.resource("/testdata/azure"))
53-
.with("PATH", "testdata:/bin")
55+
.with("PATH", "/bin:testdata")
56+
.with("AZ_PATH", TestOSUtils.resource("/testdata/az"))
5457
.with("FAIL_IF", "https://management.core.windows.net/");
5558
String azureWorkspaceResourceId =
5659
"/subscriptions/123/resourceGroups/abc/providers/Microsoft.Databricks/workspaces/abc123";

databricks-sdk-java/src/test/resources/testdata/az

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/bin/bash
2+
set -x
23

34
if [ "yes" == "$FAIL" ]; then
45
>&2 /bin/echo "This is just a failing script."

0 commit comments

Comments
 (0)