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

chore: auto update reproducible requirements when there is a dependency change #5677

Merged
merged 43 commits into from
Aug 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
687654e
chore: add reproducible gha
mndeveci Jul 31, 2023
09b2c79
format
mndeveci Jul 31, 2023
4c401ee
formatting v2
mndeveci Jul 31, 2023
f33fe98
format v3
mndeveci Jul 31, 2023
6b31812
use win make target
mndeveci Jul 31, 2023
5fb7727
update windows job
mndeveci Jul 31, 2023
2c3fa96
update win paths
mndeveci Jul 31, 2023
582ea7c
why windows why
mndeveci Jul 31, 2023
3739d32
remove if stmt for now
mndeveci Jul 31, 2023
e01438a
test with direct paths
mndeveci Aug 1, 2023
34dd507
update windows paths again
mndeveci Aug 1, 2023
163dea7
bring back activate
mndeveci Aug 1, 2023
8758a1a
add dummy win file and push changes
mndeveci Aug 1, 2023
cfc8ba7
update base.txt for testing
mndeveci Aug 1, 2023
f4209a9
Update reproducibles
actions-user Aug 1, 2023
0539b0b
run jobs sequentially
mndeveci Aug 1, 2023
3b3018c
print changed flag
mndeveci Aug 1, 2023
e0913cf
check changes again
mndeveci Aug 1, 2023
55576bd
run git status before moving forward
mndeveci Aug 1, 2023
3944819
refresh index before checking any changed files
mndeveci Aug 1, 2023
3e7fc24
Update reproducibles
actions-user Aug 1, 2023
be85569
commit or skip
mndeveci Aug 1, 2023
eba9651
Update reproducibles
actions-user Aug 1, 2023
3e2cec0
rerun build & pyinstaller jobs once update reproducible finishes
mndeveci Aug 1, 2023
9c80d5d
add more details to commit message
mndeveci Aug 1, 2023
4e618f7
nuke all reproducibles to trigger the CI
mndeveci Aug 1, 2023
fae3f56
Update reproducibles: update-reproducible-linux-reqs
actions-user Aug 1, 2023
d3aea9e
Update reproducibles: update-reproducible-mac-reqs
actions-user Aug 1, 2023
54c5dbb
Update reproducibles: update-reproducible-win-reqs
actions-user Aug 1, 2023
e2dce8b
Merge branch 'develop' into auto_req_update
mndeveci Aug 2, 2023
dea8b6d
change lb version for testing
mndeveci Aug 2, 2023
5f5616c
update permissions and limit only for aws/aws-sam-cli
mndeveci Aug 2, 2023
28f4c98
Update reproducibles: update-reproducible-linux-reqs
actions-user Aug 2, 2023
671a46b
Update reproducibles: update-reproducible-mac-reqs
actions-user Aug 2, 2023
d3f240e
Update reproducibles: update-reproducible-win-reqs
actions-user Aug 2, 2023
d82360c
update other jobs as well
mndeveci Aug 2, 2023
538e2c5
Merge branch 'develop' into auto_req_update
mndeveci Aug 2, 2023
74d059a
run without file filter
mndeveci Aug 2, 2023
32b350a
Update reproducibles: update-reproducible-linux-reqs
actions-user Aug 2, 2023
8ebed17
Update reproducibles: update-reproducible-mac-reqs
actions-user Aug 2, 2023
f70f8c3
Update reproducibles: update-reproducible-win-reqs
actions-user Aug 2, 2023
5f4ac01
put the file filter back
mndeveci Aug 2, 2023
db0593c
Merge branch 'develop' into auto_req_update
mndeveci Aug 3, 2023
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
16 changes: 2 additions & 14 deletions .github/workflows/automated-updates-to-sam-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,6 @@ jobs:
with:
repository: aws/aws-sam-cli
path: aws-sam-cli

- uses: actions/setup-python@v4 # used for make update-reproducible-reqs below
with:
python-version: |
3.8
3.11

- name: Update aws-sam-translator & commit
run: |
Expand All @@ -90,7 +84,7 @@ jobs:
SAM_T_PRE_VERSION=$(grep "aws-sam-translator=" requirements/base.txt)
echo "SAM-T pre version is $SAM_T_PRE_VERSION"
git reset --hard develop
sed -i "s/$SAM_T_PRE_VERSION/aws-sam-translator==$SAM_T_CUR_VERSION/g" requirements/base.txt; make update-reproducible-reqs
sed -i "s/$SAM_T_PRE_VERSION/aws-sam-translator==$SAM_T_CUR_VERSION/g" requirements/base.txt
cp -r ../serverless-application-model/tests/translator/input ./tests/functional/commands/validate/lib/models
git status
git diff --quiet && exit 0 # exit if there is no change
Expand Down Expand Up @@ -129,12 +123,6 @@ jobs:
repository: aws/aws-sam-cli
path: aws-sam-cli

- uses: actions/setup-python@v4 # used for make update-reproducible-reqs below
with:
python-version: |
3.8
3.11

- name: Upgrade aws_lambda_builders & commit
run: |
git config --global user.email "[email protected]"
Expand All @@ -147,7 +135,7 @@ jobs:
BUILDERS_PRE_VERSION=$(grep "aws_lambda_builders=" requirements/base.txt)
echo "Lambda Builders pre version is $BUILDERS_PRE_VERSION"
git reset --hard develop
sed -i "s/$BUILDERS_PRE_VERSION/aws_lambda_builders==$BUILDERS_CUR_VERSION/g" requirements/base.txt; make update-reproducible-reqs
sed -i "s/$BUILDERS_PRE_VERSION/aws_lambda_builders==$BUILDERS_CUR_VERSION/g" requirements/base.txt
git status
git diff --quiet && exit 0 # exit if there is no change
echo "is_new_lambda_builders=1" >> $GITHUB_ENV # set env variable for next step run decision
Expand Down
42 changes: 42 additions & 0 deletions .github/workflows/update-reproducibles.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Update reproducible requirements
on:
pull_request:
branches: [develop]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are we going to update the PR itself, or update the develop branch, then we need to merge the PR branch from the develop branch?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will update the PR itself (see this commit for example in this PR: 32b350a)

But this GHA will only run if requirements/base.txt is updated (see line 6)

paths:
- requirements/base.txt # run this GHA only if requirements file is changed
Comment on lines +3 to +6
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just to make sure, we do not need this GHA to be executed in case of the dependencies got updated, or their dependencies got updated. Dependabot should handle that, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to keep our existing flow where we update these reproducibles when we update our requirements (for example when we bump SAMT version). If we run this for every PR there is a chance that we will have updates every day or so (for minor version updates), which might make harder for those PRs getting merged, and I will leave those updates to dependabot as it is been currently handled.


jobs:
update-reqs:
permissions:
pull-requests: write
contents: write
if: github.repository_owner == 'aws'
strategy:
matrix:
include:
- os: ubuntu-latest
python: 3.11
target: update-reproducible-linux-reqs
- os: macos-latest
python: 3.8
target: update-reproducible-mac-reqs
- os: windows-latest
python: 3.8
target: update-reproducible-win-reqs
max-parallel: 1
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- run: make ${{ matrix.target }}
- name: Push changes
run: |
git config --global user.email "[email protected]"
git config --global user.name "GitHub Action"
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
git commit -am "Update reproducibles: ${{ matrix.target }}" || echo "nothing to commit"
Comment on lines +40 to +41
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a general comment, butI think I had the same conversation with a team member about auto generating a JSON schema file, and whether or not this should be a message instead to manually run the generation rules, or something that Github Actions will do for us in the same PR.

The wrench that is thrown here is that Windows repro generation would in theory need to happen on a Windows machine.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason we put these updates into GHA is purely needing a Windows machine to update reproducibles. If these were not OS specific (like we can generate one and use it for every installer), then I would keep the existing flow where we will have a Makefile target which can be run on any OS so that contributors can run it after they update any dependency that we have.

git push
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,13 @@ update-reproducible-mac-reqs:
venv-update-reproducible-mac/bin/pip install -r requirements/base.txt
venv-update-reproducible-mac/bin/pip-compile --generate-hashes --allow-unsafe -o requirements/reproducible-mac.txt

# note that this should be run on a windows environment with python3.8 as default interpreter
update-reproducible-win-reqs:
python -m venv venv-update-reproducible-win
.\venv-update-reproducible-win\Scripts\activate
pip install --upgrade pip-tools pip
pip install -r requirements\base.txt
pip-compile --generate-hashes --allow-unsafe -o requirements\reproducible-win.txt


update-reproducible-reqs: update-reproducible-linux-reqs update-reproducible-mac-reqs
Loading
Loading