Skip to content

Commit a5af644

Browse files
authored
tools: update OpenSSL on the selected branch
Use the selected workflow branch as the PR base and prefix PR titles for branches other than the repository's default branch. Signed-off-by: Filip Skokan <panva.ip@gmail.com> Assisted-by: Codex PR-URL: #66704 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Richard Lau <richard.lau@ibm.com>
1 parent 38aa1f3 commit a5af644

2 files changed

Lines changed: 64 additions & 63 deletions

File tree

‎.github/workflows/update-openssl.yml‎

Lines changed: 36 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -12,58 +12,60 @@ permissions:
1212
jobs:
1313
openssl-update:
1414
if: github.repository == 'nodejs/node'
15+
name: OpenSSL update (${{ github.ref_name }})
1516
# Cannot use ubuntu-slim here because the update script requires Docker
1617
runs-on: ubuntu-latest
18+
concurrency:
19+
group: openssl-update-${{ github.ref_name }}
20+
cancel-in-progress: false
21+
env:
22+
TARGET_BRANCH: ${{ github.ref_name }}
23+
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
1724
steps:
1825
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
1926
with:
2027
persist-credentials: false
28+
- name: Setup Git config
29+
run: |
30+
git config user.name "Node.js GitHub Bot"
31+
git config user.email "github-bot@iojs.org"
32+
if [ "$TARGET_BRANCH" != "$DEFAULT_BRANCH" ]; then
33+
echo "PR_TITLE_PREFIX=[${TARGET_BRANCH%-staging}] " >> "$GITHUB_ENV"
34+
fi
2135
- name: Check and download new OpenSSL version
2236
run: |
23-
./tools/dep_updaters/update-openssl.sh download > temp-output
24-
cat temp-output
25-
tail -n1 temp-output | grep "NEW_VERSION=" >> "$GITHUB_ENV" || true
26-
rm temp-output
37+
./tools/dep_updaters/update-openssl.sh download \
38+
| tee /dev/stderr \
39+
| tail -n1 \
40+
| sed -n '/^NEW_VERSION=/p' >> "$GITHUB_ENV"
41+
shell: bash
2742
env:
2843
GITHUB_TOKEN: ${{ secrets.GH_USER_TOKEN }}
29-
- name: Create PR with first commit
30-
id: create-pull-request
44+
- name: Commit OpenSSL sources
3145
if: env.NEW_VERSION
32-
uses: gr2m/create-or-update-pull-request-action@b65137ca591da0b9f43bad7b24df13050ea45d1b # v1.10.1
33-
# Creates a PR with the new OpenSSL source code committed
34-
env:
35-
GITHUB_TOKEN: ${{ secrets.GH_USER_TOKEN }}
36-
with:
37-
author: Node.js GitHub Bot <github-bot@iojs.org>
38-
body: This is an automated update of OpenSSL to ${{ env.NEW_VERSION }}.
39-
branch: actions/tools-update-openssl # Custom branch *just* for this Action.
40-
commit-message: 'deps: upgrade openssl sources to openssl-${{ env.NEW_VERSION }}'
41-
labels: dependencies, openssl
42-
title: 'deps: update OpenSSL to ${{ env.NEW_VERSION }}'
43-
path: deps/openssl
44-
update-pull-request-title-and-body: true
45-
draft: true
46+
run: |
47+
git add -A deps/openssl/openssl
48+
git commit -m "deps: upgrade openssl sources to openssl-$NEW_VERSION"
4649
- name: Regenerate platform specific files
4750
if: env.NEW_VERSION
4851
run: |
4952
sudo apt update && sudo apt install -y nasm libtext-template-perl
5053
./tools/dep_updaters/update-openssl.sh regenerate
5154
env:
5255
GITHUB_TOKEN: ${{ secrets.GH_USER_TOKEN }}
53-
- name: Add second commit
54-
# Adds a second commit to the PR with the generated platform-dependent files
56+
- name: Commit generated files
5557
if: env.NEW_VERSION
56-
uses: gr2m/create-or-update-pull-request-action@b65137ca591da0b9f43bad7b24df13050ea45d1b # v1.10.1
57-
env:
58-
GITHUB_TOKEN: ${{ secrets.GH_USER_TOKEN }}
58+
run: |
59+
git add -A deps/openssl
60+
git commit -m "deps: update archs files for openssl-$NEW_VERSION"
61+
- name: Create or update PR
62+
if: env.NEW_VERSION
63+
uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1
5964
with:
65+
token: ${{ secrets.GH_USER_TOKEN }}
6066
author: Node.js GitHub Bot <github-bot@iojs.org>
61-
branch: actions/tools-update-openssl # Custom branch *just* for this Action.
62-
commit-message: 'deps: update archs files for openssl-${{ env.NEW_VERSION }}'
63-
path: deps/openssl
64-
- name: Mark PR as ready for review
65-
if: env.NEW_VERSION
66-
env:
67-
GITHUB_TOKEN: ${{ secrets.GH_USER_TOKEN }}
68-
PR_ID: ${{ steps.create-pull-request.outputs.pull-request-number }}
69-
run: gh --repo "$GITHUB_REPOSITORY" pr ready "$PR_ID"
67+
committer: Node.js GitHub Bot <github-bot@iojs.org>
68+
body: This is an automated update of OpenSSL to ${{ env.NEW_VERSION }} for ${{ github.ref_name }}.
69+
branch: actions/${{ github.ref_name != github.event.repository.default_branch && format('{0}/', github.ref_name) || '' }}tools-update-openssl
70+
labels: dependencies, openssl
71+
title: '${{ env.PR_TITLE_PREFIX }}deps: update OpenSSL to ${{ env.NEW_VERSION }}'

‎doc/contributing/maintaining/maintaining-openssl.md‎

Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -30,39 +30,49 @@ NASM version 2.11.08
3030

3131
## 1. Obtain and extract new OpenSSL sources
3232

33-
Get a new source from <https://github.com/openssl/openssl/tree/openssl-3.0.16>
34-
and copy all files into `deps/openssl/openssl`. Then add all files and commit
35-
them. (The link above, and the branch, will change with each new OpenSSL
36-
release).
33+
Get the sources for the desired `openssl-<version>` tag from
34+
<https://github.com/openssl/openssl> and copy all files into
35+
`deps/openssl/openssl`. Then add all files and commit them.
3736

3837
```bash
3938
git clone https://github.com/openssl/openssl
4039
cd openssl
40+
git checkout openssl-<version>
4141
cd ../node/deps/openssl
4242
rm -rf openssl
4343
cp -R ../../../openssl openssl
44-
rm -rf openssl/.git*
44+
rm -rf openssl/.git
4545
git add --all openssl
4646
git commit openssl
4747
```
4848

4949
```text
50-
deps: upgrade openssl sources to openssl-3.0.16
50+
deps: upgrade openssl sources to openssl-<version>
5151
5252
This updates all sources in deps/openssl/openssl by:
5353
$ git clone git@github.com:openssl/openssl.git
5454
$ cd openssl
55-
$ git checkout openssl-3.0.16
55+
$ git checkout openssl-<version>
5656
$ cd ../node/deps/openssl
5757
$ rm -rf openssl
5858
$ cp -R ../../../openssl openssl
59-
$ rm -rf openssl/.git*
59+
$ rm -rf openssl/.git
6060
$ git add --all openssl
6161
$ git commit openssl
6262
```
6363

6464
## 2. Execute `make` in `deps/openssl/config` directory
6565

66+
Fix up 32-bit Windows assembler directives. This will allow the commits to be
67+
cherry-picked to older release lines that still provide binaries on 32-bit Windows.
68+
69+
```bash
70+
# Edit deps/openssl/openssl/crypto/perlasm/x86asm.pl changing
71+
# #ifdef/#endif to %ifdef/%endif for nasm on 32-bit Windows.
72+
# See: https://github.com/nodejs/node/pull/43603#issuecomment-1170670844
73+
# Reference: https://github.com/openssl/openssl/issues/18459
74+
```
75+
6676
Use `make` to regenerate all platform dependent files in
6777
`deps/openssl/config/archs/`:
6878

@@ -75,17 +85,6 @@ make -C deps/openssl/config clean
7585
make -C deps/openssl/config
7686
```
7787

78-
Fix up 32-bit Windows assembler directives. This will allow the commits to be
79-
cherry-picked to older release lines that still provide binaries on 32-bit Windows.
80-
81-
```bash
82-
make -C deps/openssl/config clean
83-
# Edit deps/openssl/openssl/crypto/perlasm/x86asm.pl changing
84-
# #ifdef to %ifdef to make it compatible to nasm on 32-bit Windows.
85-
# See: https://github.com/nodejs/node/pull/43603#issuecomment-1170670844
86-
# Reference: https://github.com/openssl/openssl/issues/18459
87-
```
88-
8988
## 3. Check diffs
9089

9190
Check diffs to ensure updates are right. Even if there are no updates in openssl
@@ -98,36 +97,36 @@ git diff -- deps/openssl
9897

9998
_Note_: On Windows, OpenSSL Configure generates a `makefile` that can be
10099
used for the `nmake` command. The `make` command in step 2 (above) uses
101-
`Makefile_VC-WIN64A` and `Makefile_VC-WIN32` that are manually
102-
created. When source files or build options are updated in Windows,
103-
it needs to change these two Makefiles by hand. If you are not sure,
100+
`Makefile_VC-WIN64A`, `Makefile_VC-WIN32`, and `Makefile_VC-WIN64-ARM`,
101+
which are manually created. When source files or build options are updated in
102+
Windows, these Makefiles need to be changed by hand. If you are not sure,
104103
please ask @shigeki for details.
105104

106-
## 4. Commit and make test
105+
## 4. Commit and test
107106

108107
Update all architecture dependent files. Do not forget to git add or remove
109108
files if they are changed before committing:
110109

111110
```bash
112-
git add deps/openssl/config/archs
113-
git add deps/openssl/openssl
111+
git add -A deps/openssl/config/archs
112+
git add -A deps/openssl/openssl
114113
git commit
115114
```
116115

117116
The commit message can be written as (with the openssl version set
118117
to the relevant value):
119118

120119
```text
121-
deps: update archs files for openssl-3.0.16
120+
deps: update archs files for openssl-<version>
122121
123122
After an OpenSSL source update, all the config files need to be
124123
regenerated and committed by:
125124
$ make -C deps/openssl/config
126-
$ git add deps/openssl/config/archs
127-
$ git add deps/openssl/openssl
125+
$ git add -A deps/openssl/config/archs
126+
$ git add -A deps/openssl/openssl
128127
$ git commit
129128
```
130129

131-
Finally, build Node.js and run the tests.
130+
Finally, build Node.js with the bundled OpenSSL and run the tests.
132131

133132
[update-openssl-action]: ../../../.github/workflows/update-openssl.yml

0 commit comments

Comments
 (0)