Terraform Installer | Unable to locate executable file: 'unzip'
Closed this issue · 6 comments
Describe the bug
An intermittent issue while using Terraform installer task on YAML pipeline with the extension azure pipelines tasks terraform on Azure DevOps. While running the pipeline, the Terraform installer step is randomly working at times and at others giving the following error:
##[error]Error: Unable to locate executable file: 'unzip'. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.
Full Error:
Starting: TerraformInstaller
Task : Terraform Installer
Description : Installs a specific version of terraform
Version : 1.0.2
Author : Charles Zipp
Help :
Getting latest version
Terraform not installed, downloading from: https://releases.hashicorp.com/terraform/1.5.7/terraform_1.5.7_linux_amd64.zip
Terraform file name as: terraform-1.5.7-757480a1-7e00-4d47-9698-ddd78a1aa4ed.zip
Downloading: https://releases.hashicorp.com/terraform/1.5.7/terraform_1.5.7_linux_amd64.zip
Terraform downloaded to path: ///_temp/terraform-1.5.7-757480a1-7e00-4d47-9698-ddd78a1aa4ed.zip
Extracting archive
##[error]Error: Unable to locate executable file: 'unzip'. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.
Finishing: TerraformInstaller
To Reproduce
Steps to reproduce the behavior:
- Step in YAML:
- task: JasonBJohnson.azure-pipelines-tasks-terraform.azure-pipelines-tasks-terraform-installer.TerraformInstaller@1
inputs:
terraformVersion: 'latest'
- task: JasonBJohnson.azure-pipelines-tasks-terraform.azure-pipelines-tasks-terraform-installer.TerraformInstaller@1
- Execute pipeline
- See error
Expected behavior
Install terraform on the DevOps agent every time the pipeline is run
Agent Configuration
- OS: Ubuntu
- Self Hosted
- Terraform version: latest
Hi. I think this has to be related to the agent. Some agents either don't have the unzip program or it's not in the path. We don't package it with this tool so we run it if we find it in the path.
In case of issue with the agent, shouldn't it be failing on every run. It is running successfully at times and then suddenly stops working.
Do you get the same agent every time? I'm assuming it's getting different agents, some which have unzip and some which don't. I can have a look if we can request it as a requirement or something. You could also list it as a requirement in the pipeline definition and see if it works consistently then.
The agent is coming from a virtual machine scale set. It is spun up every time a new run is made.
Unzip can be packaged with the installer given that it is actually needed before the installer can be used.
We won't be packaging unix tools with the extension. This is the concern of the pipeline environments to manage. If I can find a way to tell the agent that we need this to be present before the extension can run then I'll do that.
Ok, so it seems Agent Capabilities are something that needs to be configured in the pipeline and can't be done from the pipeline task.
Closing the issue as this has nothing to do with the task. I know the docker strategy is to package all requirements with the image, but Azure Devops extensions do not work that way. In fact there is a strict requirement on the size of the extension, so even if we wanted to we couldn't package any executables with the extension.
The solution is either to ensure all private agents have the tools required to run their pipelines or define the pipelines to retrieve the tools they need to run the tasks they use.