runatlantis / atlantis

Terraform Pull Request Automation
https://www.runatlantis.io
Other
7.73k stars 1.05k forks source link

chore: pin terraform versions in CI #4645

Closed lukemassa closed 3 months ago

lukemassa commented 3 months ago

what

Add a script to add versions.tf to all test dirs that pin all necessary providers; run the script.

why

Help with CI stability if providers are pinned.

Adding a script means that we can easily bump all versions simultaneously in the future if we need to.

tests

Ran CI.

references

close #4484.

chenrui333 commented 3 months ago
            <details><summary>Show Output</summary>
        running "/usr/local/bin/terraform init -input=false" in "/tmp/TestSimpleWorkflow_terraformLockFileModified_.terraform.lock.hcl_triggers_autoplan_1120627109/001/repos/runatlantis/atlantis-tests/2/default": exit status 1

        Initializing the backend...

        Initializing provider plugins...
        - Reusing previous version of hashicorp/null from the dependency lock file
        ╷
        │ Error: Failed to query available provider packages
        │ 
        │ Could not retrieve the list of available versions for provider
        │ hashicorp/null: locked provider registry.terraform.io/hashicorp/null 3.1.0
        │ does not match configured version constraint 3.2.2; must use terraform init
        │ -upgrade to allow selection of new versions
        ╵


caused some test failure, https://github.com/runatlantis/atlantis/actions/runs/9470306781/job/26091248454
chenrui333 commented 3 months ago

missed lockfile update 😅

https://github.com/runatlantis/atlantis/blob/7999e1cdf4046ca1d4783631448bd6929d9eb6a1/server/controllers/events/testdata/null_provider_lockfile_old_version#L4-L6

chenrui333 commented 3 months ago
            <details><summary>Show Output</summary>
        running "/usr/local/bin/terraform init -input=false" in "/tmp/TestSimpleWorkflow_terraformLockFileModified_.terraform.lock.hcl_triggers_autoplan_1120627109/001/repos/runatlantis/atlantis-tests/2/default": exit status 1

        Initializing the backend...

        Initializing provider plugins...
        - Reusing previous version of hashicorp/null from the dependency lock file
        ╷
        │ Error: Failed to query available provider packages
        │ 
        │ Could not retrieve the list of available versions for provider
        │ hashicorp/null: locked provider registry.terraform.io/hashicorp/null 3.1.0
        │ does not match configured version constraint 3.2.2; must use terraform init
        │ -upgrade to allow selection of new versions
        ╵


caused some test failure, https://github.com/runatlantis/atlantis/actions/runs/9470306781/job/26091248454

this is handled by https://github.com/runatlantis/atlantis/pull/4653 along with other fixes