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 3eaec82
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
7 changes: 5 additions & 2 deletions config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,11 @@ 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'.
terraform-provider-harvester: ''
# 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: '0.0.0-dev'

# Backup Target S3
s3-endpoint: ''
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" # noqa: E501
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 3eaec82

Please sign in to comment.