microsoft / azure-pipelines-terraform

Azure Pipelines tasks for installing Terraform and running Terraform commands in a build or release pipeline.
MIT License
95 stars 59 forks source link

TerraformInstaller@1 fails on Azure pipelines with image ubuntu-latest #197

Closed codeustad closed 5 months ago

codeustad commented 8 months ago

Using ubuntu-latest as the vmImage in the yml file, TerraformInstaller fails to install.

`stages:

Error is:

##[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.

mericstam commented 8 months ago

hi, we use azure-pipelines-tool-lib to unpack zip files. my guess is that lib uses unzip. I will check if there are new release of the lib.

codeustad commented 8 months ago

Hi @mericstam,

I created my own Azure Virtual Machine Scale Set using Ubuntu 22.04 and I receive the same error as mentioned above.

mericstam commented 8 months ago

Hi, did you see install unzip in the Azure VMSS? like ‘sudo apt install unzip’

why I ask is because I am not sure it is installed by default you could look for the binary location using: “which unzip’

codeustad commented 8 months ago

I tried creating a custom self hosted Ubuntu 22.04 image. At first which unzip returned no value. Then I ran the pipeline and it failed as expected.

When I installed unzip and re-run my pipeline, it failed again with the same error message.

image
mericstam commented 8 months ago

running MS hosted pipelines I get no issue. image

Do you still have the issue on ubuntu-latest?

codeustad commented 8 months ago

Just tried a couple times with ubuntu-latest but still failing. I noticed you get version 1.216.94 while I have 1.216.24. Could that make a difference?

mericstam commented 8 months ago

I have a dev version of the task installed on my azure devops.. I switched to public version. still see no issue image

Do you know which region you Azure Devops organization has?

codeustad commented 8 months ago

That's very strange. Our DevOps location is North Europe.

mericstam commented 8 months ago

please send me the info you get from Initialize job ( the first thing in the log) ex. image

codeustad commented 8 months ago

Here is the log:

2023-10-29T11:06:30.3797196Z ##[section]Starting: Initialize job
2023-10-29T11:06:30.3801210Z Agent name: 'Hosted Agent'
2023-10-29T11:06:30.3801791Z Agent machine name: 'fv-az626-91'
2023-10-29T11:06:30.3802141Z Current agent version: '3.227.2'
2023-10-29T11:06:30.3839250Z ##[group]Operating System
2023-10-29T11:06:30.3839607Z Ubuntu
2023-10-29T11:06:30.3839726Z 22.04.3
2023-10-29T11:06:30.3839857Z LTS
2023-10-29T11:06:30.3839973Z ##[endgroup]
2023-10-29T11:06:30.3840143Z ##[group]Runner Image
2023-10-29T11:06:30.3840357Z Image: ubuntu-22.04
2023-10-29T11:06:30.3840570Z Version: 20231025.1.0
2023-10-29T11:06:30.3841508Z Included Software: https://github.com/actions/runner-images/blob/ubuntu22/20231025.1/images/linux/Ubuntu2204-Readme.md
2023-10-29T11:06:30.3843057Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu22%2F20231025.1
2023-10-29T11:06:30.3843856Z ##[endgroup]
2023-10-29T11:06:30.3844037Z ##[group]Runner Image Provisioner
2023-10-29T11:06:30.3844503Z 2.0.312.1
2023-10-29T11:06:30.3844631Z ##[endgroup]
2023-10-29T11:06:30.3845630Z Current image version: '20231025.1.0'
2023-10-29T11:06:30.3847241Z Agent running as: 'vsts'
2023-10-29T11:06:30.3894908Z Prepare build directory.
2023-10-29T11:06:30.4224209Z Set build variables.
2023-10-29T11:06:30.4262101Z Download all required tasks.
2023-10-29T11:06:30.4434189Z Downloading task: TerraformInstaller (1.216.24)
2023-10-29T11:06:30.8061293Z Downloading task: TerraformTaskV4 (4.227.24)
2023-10-29T11:06:31.1696393Z Checking job knob settings.
2023-10-29T11:06:31.1709073Z    Knob: DockerActionRetries = true Source: $(VSTSAGENT_DOCKER_ACTION_RETRIES) 
2023-10-29T11:06:31.1710766Z    Knob: AgentToolsDirectory = /opt/hostedtoolcache Source: ${AGENT_TOOLSDIRECTORY} 
2023-10-29T11:06:31.1713226Z    Knob: AgentPerflog = /home/vsts/perflog Source: ${VSTS_AGENT_PERFLOG} 
2023-10-29T11:06:31.1715655Z    Knob: AgentEnablePipelineArtifactLargeChunkSize = true Source: $(AGENT_ENABLE_PIPELINEARTIFACT_LARGE_CHUNK_SIZE) 
2023-10-29T11:06:31.1719972Z    Knob: ContinueAfterCancelProcessTreeKillAttempt = true Source: $(VSTSAGENT_CONTINUE_AFTER_CANCEL_PROCESSTREEKILL_ATTEMPT) 
2023-10-29T11:06:31.1723931Z    Knob: ProcessHandlerTelemetry = true Source: $(AZP_75787_ENABLE_COLLECT) 
2023-10-29T11:06:31.1725649Z    Knob: IgnoreVSTSTaskLib = true Source: $(AZP_AGENT_IGNORE_VSTSTASKLIB) 
2023-10-29T11:06:31.1726326Z Finished checking job knob settings.
2023-10-29T11:06:31.2208308Z Start tracking orphan processes.
2023-10-29T11:06:31.2501877Z ##[section]Finishing: Initialize job
mericstam commented 8 months ago

My region is west europe, but seems to be identical version of the runner image,

this is how I use the the step. you do the same, right?

- task: TerraformInstaller@1
      displayName: 'terraform latest'
      inputs:
        terraformVersion: 'latest'
codeustad commented 8 months ago

Yes, exactly the same:

stages:
  - stage: tfvalidate
    jobs:
      - job: validate
        continueOnError: false
        steps:
          - task: TerraformInstaller@1
            displayName: Install Terraform latest
            inputs:
              terraformVersion: latest
mericstam commented 8 months ago

This is indeed strange. An idea: Do you have access to any other Azure DevOps organization? if not you can create a personal org with any Microsoft Live account. And just run a simple build with the terraforminstaller task just to see it it makes a difference for you.

mericstam commented 5 months ago

closing due to inactivity. Br Manuel