Skip to content

Commit

Permalink
feat: support master branch terraform-provider-harvester
Browse files Browse the repository at this point in the history
Signed-off-by: PoAn Yang <[email protected]>
  • Loading branch information
FrankYang0529 committed Jul 10, 2024
1 parent 982fea0 commit 7c11418
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
5 changes: 4 additions & 1 deletion config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ image-cache-url: ''
terraform-scripts-location: 'terraform_test_artifacts'
# Rancher provider version, leave empty for the latest version. e.g. '' or '3.1.1'.
terraform-provider-rancher: ''
# Harvester provider version, leave empty for the latest version. e.g. '' or '0.6.3'.
# Harvester provider version:
# '' for the latest released version.
# '0.0.0-dev' for the latest version from master branch.
# '0.6.3' for the specific version.
terraform-provider-harvester: ''

# Backup Target S3
Expand Down
17 changes: 17 additions & 0 deletions harvester_e2e_tests/fixtures/terraform.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,23 @@ def initial_provider(self, kubeconfig, provider_version):
provider_source="harvester/harvester", provider_version=provider_version
))

if provider_version == "0.0.0-dev":
docker_plugin_path = "/root/.terraform.d/plugins/terraform.local/local"
docker_plugin_tf = "harvester/0.0.0-dev/linux_amd64/terraform-provider-harvester_v0.0.0-dev"
local_plugin_path = "~/.terraform.d/plugins/registry.terraform.io"
local_plugin_tf = "harvester/harvester/0.0.0-dev/linux_amd64"
rv = run(
f"rm -rf ~/.terraform.d/plugins/registry.terraform.io/harvester/harvester &&"
f" mkdir -p {local_plugin_path}/{local_plugin_tf} &&"
f" docker run --name harv-tf-master-head"
f" -v {local_plugin_path}/{local_plugin_tf}:/_tf"
f" rancher/terraform-provider-harvester:master-head-amd64"
f' bash -c "cp {docker_plugin_path}/{docker_plugin_tf} /_tf/" &&'
f" docker rm harv-tf-master-head",
shell=True, stdout=PIPE, stderr=PIPE, cwd=self.workdir
)
assert not remove_ansicode(rv.stderr) and 0 == rv.returncode

return self.execute("init")

def save_as(self, content, filename, ext=".tf"):
Expand Down

0 comments on commit 7c11418

Please sign in to comment.