Skip to content

Commit bf3fbb5

Browse files
committed
add ssh key and remote repo dir
1 parent d170ef0 commit bf3fbb5

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

internal/provider/cached_image_data_source.go

+1
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,7 @@ func (d *CachedImageDataSource) Read(ctx context.Context, req datasource.ReadReq
303303
Verbose: data.Verbose.ValueBool(),
304304
WorkspaceFolder: workspaceFolder,
305305
RemoteRepoBuildMode: true,
306+
RemoteRepoDir: filepath.Join(tmpDir, "repo"), // Hidden option used by this provider.
306307

307308
// Options related to compiling the devcontainer
308309
BuildContextPath: data.BuildContextPath.ValueString(),

internal/provider/cached_image_data_source_test.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,13 @@ func TestAccCachedImageDataSource(t *testing.T) {
3030
builder_image = %q
3131
workspace_folder = %q
3232
git_url = %q
33+
git_ssh_private_key_path = %q
3334
extra_env = {
3435
"FOO" : "bar"
3536
}
3637
cache_repo = %q
3738
verbose = true
38-
}`, deps.BuilderImage, "/workspace", deps.RepoURL, deps.CacheRepo)
39+
}`, deps.BuilderImage, "/workspace", deps.RepoURL, deps.SSHKey, deps.CacheRepo)
3940
resource.Test(t, resource.TestCase{
4041
PreCheck: func() { testAccPreCheck(t) },
4142
ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
@@ -89,12 +90,13 @@ func TestAccCachedImageDataSource(t *testing.T) {
8990
builder_image = %q
9091
workspace_folder = %q
9192
git_url = %q
93+
git_ssh_private_key_path = %q
9294
extra_env = {
9395
"FOO" : "bar"
9496
}
9597
cache_repo = %q
9698
verbose = true
97-
}`, deps.BuilderImage, "/workspace", deps.RepoURL, deps.CacheRepo)
99+
}`, deps.BuilderImage, "/workspace", deps.RepoURL, deps.SSHKey, deps.CacheRepo)
98100
resource.Test(t, resource.TestCase{
99101
PreCheck: func() { testAccPreCheck(t) },
100102
ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,

internal/provider/provider_test.go

+2
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ type testDependencies struct {
7676
GitImage string
7777
SSHDir string
7878
SSHPort string
79+
SSHKey string
7980
}
8081

8182
func setup(t testing.TB, files map[string]string) testDependencies {
@@ -111,6 +112,7 @@ func setup(t testing.TB, files map[string]string) testDependencies {
111112
GitImage: gitImageRef,
112113
SSHDir: sshDir,
113114
SSHPort: sshPort,
115+
SSHKey: filepath.Join(sshDir, "id_ed25519"),
114116
}
115117
}
116118

0 commit comments

Comments
 (0)