This repository was archived by the owner on Mar 23, 2026. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
134 lines (115 loc) · 6.67 KB
/
asf-updates.yml
File metadata and controls
134 lines (115 loc) · 6.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
name: Update ASF APIs
on:
schedule:
- cron: 0 5 * * MON
workflow_dispatch:
jobs:
update-asf:
name: Update ASF APIs
runs-on: ubuntu-latest
steps:
- name: Checkout Open Source
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Set up system wide dependencies
run: |
sudo apt-get update
sudo apt-get install jq
- name: Set up Python
id: setup-python
uses: actions/setup-python@v6
with:
python-version-file: '.python-version'
- name: Install release helper dependencies
run: python3 -m pip install --upgrade setuptools setuptools_scm uv
- name: Cache LocalStack community dependencies (venv)
uses: actions/cache@v5
with:
path: .venv
key: ${{ runner.os }}-python-${{ steps.setup-python.outputs.python-version }}-venv-${{ hashFiles('requirements-dev.txt') }}
- name: Install dependencies
run: make install-dev
- name: Update botocore (specs)
run: |
source .venv/bin/activate
python3 -m pip install --upgrade botocore
- name: Update ASF APIs
run: |
make asf-regenerate
- name: Check for changes
id: check-for-changes
run: |
# Check if there are changed files and store the result in target/diff-check.log
# Check against the PR branch if it exists, otherwise against the main
# Store the result in target/diff-check.log and store the diff count in the GitHub Action output "diff-count"
mkdir -p target
(git diff --name-only origin/asf-auto-updates localstack-core/localstack/aws/api/ 2>/dev/null || git diff --name-only origin/main localstack-core/localstack/aws/api/ 2>/dev/null) | tee target/diff-check.log
echo "diff-count=$(cat target/diff-check.log | wc -l)" >> $GITHUB_OUTPUT
# Store a (multiline-sanitized) list of changed services (compared to the main) in the GitHub Action output "changed-services"
echo "changed-services<<EOF" >> $GITHUB_OUTPUT
echo "$(git diff --name-only origin/main localstack-core/localstack/aws/api/ | sed 's#localstack-core/localstack/aws/api/#- #g' | sed 's#/__init__.py##g' | sed 's/_/-/g')" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Update botocore and transitive pins
# only update the pin if we have updates in the ASF code
if: ${{ success() && steps.check-for-changes.outputs.diff-count != '0' && steps.check-for-changes.outputs.diff-count != '' }}
run: |
source .venv/bin/activate
# determine botocore version in venv
BOTOCORE_VERSION=$(python -c "import botocore; print(botocore.__version__)");
echo "Pinning botocore to version $BOTOCORE_VERSION"
bin/release-helper.sh set-dep-ver botocore "==$BOTOCORE_VERSION"
# determine boto3 version that works with $BOTOCORE_VERSION
uv venv /tmp/boto3-ver-venv
source /tmp/boto3-ver-venv/bin/activate
uv pip install "botocore==$BOTOCORE_VERSION" boto3
export BOTO3_VERSION=$(uv pip list --format=json | jq -r '.[] | select(.name=="boto3") | .version')
deactivate
# pin boto3 to that predetermined version
source .venv/bin/activate
echo "Pinning boto3 to version $BOTO3_VERSION"
bin/release-helper.sh set-dep-ver boto3 "==$BOTO3_VERSION"
# determine awscli version that works with $BOTOCORE_VERSION
uv venv /tmp/awscli-ver-venv
source /tmp/awscli-ver-venv/bin/activate
uv pip install "botocore==$BOTOCORE_VERSION" awscli
export AWSCLI_VERSION=$(uv pip list --format=json | jq -r '.[] | select(.name=="awscli") | .version')
deactivate
# pin awscli to that predetermined version
source .venv/bin/activate
echo "Pinning awscli to version $AWSCLI_VERSION"
bin/release-helper.sh set-dep-ver awscli "==$AWSCLI_VERSION"
# upgrade the requirements files only for the botocore package
python3 -m pip install --upgrade "pip<26.0" pip-tools
pip-compile --strip-extras --upgrade-package "botocore==$BOTOCORE_VERSION" --upgrade-package "boto3==$BOTO3_VERSION" --extra base-runtime -o requirements-base-runtime.txt pyproject.toml
pip-compile --strip-extras --upgrade-package "botocore==$BOTOCORE_VERSION" --upgrade-package "boto3==$BOTO3_VERSION" --upgrade-package "awscli==$AWSCLI_VERSION" --extra runtime -o requirements-runtime.txt pyproject.toml
pip-compile --strip-extras --upgrade-package "botocore==$BOTOCORE_VERSION" --upgrade-package "boto3==$BOTO3_VERSION" --upgrade-package "awscli==$AWSCLI_VERSION" --extra test -o requirements-test.txt pyproject.toml
pip-compile --strip-extras --upgrade-package "botocore==$BOTOCORE_VERSION" --upgrade-package "boto3==$BOTO3_VERSION" --upgrade-package "awscli==$AWSCLI_VERSION" --extra dev -o requirements-dev.txt pyproject.toml
pip-compile --strip-extras --upgrade-package "botocore==$BOTOCORE_VERSION" --upgrade-package "boto3==$BOTO3_VERSION" --upgrade-package "awscli==$AWSCLI_VERSION" --extra typehint -o requirements-typehint.txt pyproject.toml
- name: Read PR markdown template
if: ${{ success() && steps.check-for-changes.outputs.diff-count != '0' && steps.check-for-changes.outputs.diff-count != '' }}
id: template
uses: juliangruber/read-file-action@v1
with:
path: .github/bot_templates/ASF_UPGRADE_PR.md
- name: Add changed services to template
if: ${{ success() && steps.check-for-changes.outputs.diff-count != '0' && steps.check-for-changes.outputs.diff-count != '' }}
id: markdown
uses: mad9000/actions-find-and-replace-string@5
with:
source: ${{ steps.template.outputs.content }}
find: '{{ SERVICES }}'
replace: ${{ steps.check-for-changes.outputs.changed-services }}
- name: Create PR
uses: peter-evans/create-pull-request@v8
if: ${{ success() && steps.check-for-changes.outputs.diff-count != '0' && steps.check-for-changes.outputs.diff-count != '' }}
with:
title: "Update ASF APIs"
body: "${{ steps.markdown.outputs.value }}"
branch: "asf-auto-updates"
author: "LocalStack Bot <localstack-bot@users.noreply.github.com>"
committer: "LocalStack Bot <localstack-bot@users.noreply.github.com>"
commit-message: "update generated ASF APIs to latest version"
labels: "area: asf, area: dependencies, semver: patch, docs: skip, notes: skip"
token: ${{ secrets.PRO_ACCESS_TOKEN }}
reviewers: silv-io,alexrashed