Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support master branch terraform-provider-harvester #1374

Merged
merged 1 commit into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +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'.
# Harvester provider version:
# '' for the latest released version.
# '0.0.0-dev' for the latest version from master branch.
lanfon72 marked this conversation as resolved.
Show resolved Hide resolved
# '0.0.0-dev' requires Docker, because we will get plugin executable file from the container.
# '0.6.3' for the specific version.
terraform-provider-harvester: ''

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

# cleanup terraform plugin cache
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}",
shell=True, stdout=PIPE, stderr=PIPE, cwd=self.workdir)
assert not remove_ansicode(rv.stderr) and 0 == rv.returncode

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
rv = run(
f"docker run --pull=always -q --rm --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/"',
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