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

fix: Sort directories and files to ensure they are always processed in the same order #177

Merged
merged 1 commit into from
Aug 30, 2021

Conversation

pdecat
Copy link
Contributor

@pdecat pdecat commented Jul 15, 2021

Description

Sort directories and files to ensure they are always processed in the same order during hashing and zip file creation.

Motivation and Context

The order files are walked is not determined by default which can result in different archives created from different workspaces:

# diff -y -W 160 <(unzip -vl
.terraform/lambda-start-scheduled-execution-builds/81c20fecbe4e25f6e7dce7b8ee1a151ea6c76e84eeb25cc937f8ddbeeff54777.zip) <(unzip -vl .terraform/lambda-start-scheduled-exe
cution-builds/f6c01d9d2d57cd416967d66704cc421eb24f72aab55da0fd18f7e676ab8a5491.zip)
Archive:  .terraform/lambda-start-scheduled-execution-builds/81c20fecbe4e25f6 | Archive:  .terraform/lambda-start-scheduled-execution-builds/f6c01d9d2d57cd41
 Length   Method    Size  Cmpr    Date    Time   CRC-32   Name                   Length   Method    Size  Cmpr    Date    Time   CRC-32   Name
--------  ------  ------- ---- ---------- ----- --------  ----                  --------  ------  ------- ---- ---------- ----- --------  ----
       0  Defl:N        2   0% 2021-07-05 15:51 00000000  __init__.py         |      901  Defl:N      473  48% 2021-07-12 12:11 cc20a2a7  main.py
     901  Defl:N      473  48% 2021-07-05 17:21 cc20a2a7  main.py             |        0  Defl:N        2   0% 2021-07-12 12:11 00000000  __init__.py
--------          -------  ---                            -------               --------          -------  ---                            -------
     901              475  47%                            2 files                    901              475  47%                            2 files

Breaking Changes

N/A

How Has This Been Tested?

  • I have tested and validated these changes using one or more of the provided examples/* projects

Tested with examples/build-package.

@pdecat pdecat marked this pull request as ready for review July 16, 2021 09:50
@pdecat pdecat changed the title Sort directories and files to ensure they are always processed in the same order fix: Sort directories and files to ensure they are always processed in the same order Jul 22, 2021
@antonbabenko
Copy link
Member

This is a good idea to be consistent with ordering. Merging this one.

@antonbabenko antonbabenko merged commit c5ab779 into terraform-aws-modules:master Aug 30, 2021
@antonbabenko
Copy link
Member

v2.13.0 has been just released.

@pdecat pdecat deleted the sort_files branch August 30, 2021 12:48
@github-actions
Copy link

github-actions bot commented Nov 9, 2022

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants