Skip to content

Commit 86f3159

Browse files
authored
Merge pull request #1261 from github/update-v2.1.25-ff5ca122
Merge main into releases/v2
2 parents 904260d + d1e2e02 commit 86f3159

10 files changed

+104
-39
lines changed

.github/update-release-branch.py

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -67,40 +67,48 @@ def open_pr(
6767
body.append('Merging ' + source_branch_short_sha + ' into ' + target_branch)
6868

6969
body.append('')
70-
body.append('Conductor for this PR is @' + conductor)
70+
body.append(f'Conductor for this PR is @{conductor}.')
7171

7272
# List all PRs merged
7373
if len(pull_requests) > 0:
7474
body.append('')
7575
body.append('Contains the following pull requests:')
7676
for pr in pull_requests:
7777
merger = get_merger_of_pr(repo, pr)
78-
body.append('- #' + str(pr.number) + ' - ' + pr.title +' (@' + merger + ')')
78+
body.append(f'- #{pr.number} (@{merger})')
7979

8080
# List all commits not part of a PR
8181
if len(commits_without_pull_requests) > 0:
8282
body.append('')
8383
body.append('Contains the following commits not from a pull request:')
8484
for commit in commits_without_pull_requests:
85-
author_description = ' (@' + commit.author.login + ')' if commit.author is not None else ''
86-
body.append('- ' + commit.sha + ' - ' + get_truncated_commit_message(commit) + author_description)
85+
author_description = f' (@{commit.author.login})' if commit.author is not None else ''
86+
body.append(f'- {commit.sha} - {get_truncated_commit_message(commit)}{author_description}')
8787

8888
body.append('')
89-
body.append('Please review the following:')
89+
body.append('Please do the following:')
9090
if len(conflicted_files) > 0:
91-
body.append(' - [ ] The `package.json` file contains the correct version.')
92-
body.append(' - [ ] You have added commits to this branch that resolve the merge conflicts ' +
91+
body.append(' - [ ] Ensure `package.json` file contains the correct version.')
92+
body.append(' - [ ] Add commits to this branch to resolve the merge conflicts ' +
9393
'in the following files:')
9494
body.extend([f' - [ ] `{file}`' for file in conflicted_files])
95-
body.append(' - [ ] Another maintainer has reviewed the additional commits you added to this ' +
95+
body.append(' - [ ] Ensure another maintainer has reviewed the additional commits you added to this ' +
9696
'branch to resolve the merge conflicts.')
97-
body.append(' - [ ] The CHANGELOG displays the correct version and date.')
98-
body.append(' - [ ] The CHANGELOG includes all relevant, user-facing changes since the last release.')
99-
body.append(' - [ ] There are no unexpected commits being merged into the ' + target_branch + ' branch.')
100-
body.append(' - [ ] The docs team is aware of any documentation changes that need to be released.')
97+
body.append(' - [ ] Ensure the CHANGELOG displays the correct version and date.')
98+
body.append(' - [ ] Ensure the CHANGELOG includes all relevant, user-facing changes since the last release.')
99+
body.append(' - [ ] Check that there are not any unexpected commits being merged into the ' + target_branch + ' branch.')
100+
body.append(' - [ ] Ensure the docs team is aware of any documentation changes that need to be released.')
101+
102+
if not is_v2_release:
103+
body.append(' - [ ] Remove and re-add the "Update dependencies" label to the PR to trigger just this workflow.')
104+
body.append(' - [ ] Wait for the "Update dependencies" workflow to push a commit updating the dependencies.')
105+
body.append(' - [ ] Mark the PR as ready for review to trigger the full set of PR checks.')
106+
107+
body.append(' - [ ] Approve and merge this PR.')
108+
101109
if is_v2_release:
102-
body.append(' - [ ] The mergeback PR is merged back into ' + source_branch + ' after this PR is merged.')
103-
body.append(' - [ ] The v1 release PR is merged after this PR is merged.')
110+
body.append(' - [ ] Merge the mergeback PR that will automatically be created once this PR is merged.')
111+
body.append(' - [ ] Merge the v1 release PR that will automatically be created once this PR is merged.')
104112

105113
title = 'Merge ' + source_branch + ' into ' + target_branch
106114

.github/workflows/post-release-mergeback.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,17 @@ jobs:
114114
run: |
115115
set -exu
116116
pr_title="Mergeback ${VERSION} ${HEAD_BRANCH} into ${BASE_BRANCH}"
117-
pr_body="Updates version and changelog."
117+
pr_body=$(cat << EOF
118+
This PR bumps the version number and updates the changelog after the ${VERSION} release.
119+
120+
Please do the following:
121+
122+
- [ ] Remove and re-add the "Update dependencies" label to the PR to trigger just this workflow.
123+
- [ ] Wait for the "Update dependencies" workflow to push a commit updating the dependencies.
124+
- [ ] Mark the PR as ready for review to trigger the full set of PR checks.
125+
- [ ] Approve and merge the PR.
126+
EOF
127+
)
118128
119129
# Update the version number ready for the next release
120130
npm version patch --no-git-tag-version
@@ -134,4 +144,5 @@ jobs:
134144
--title "${pr_title}" \
135145
--label "Update dependencies" \
136146
--body "${pr_body}" \
147+
--assignee "${GITHUB_ACTOR}" \
137148
--draft

.github/workflows/python-deps.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
strategy:
2727
fail-fast: false
2828
matrix:
29-
os: [ubuntu-latest, macos-latest]
29+
os: [ubuntu-latest, ubuntu-22.04, macos-latest]
3030
python_deps_type: [pipenv, poetry, requirements, setup_py]
3131
python_version: [2, 3]
3232
exclude:
@@ -36,6 +36,9 @@ jobs:
3636
# Python2 and pipenv are not supported since pipenv v2021.11.5
3737
- python_version: 2
3838
python_deps_type: pipenv
39+
# Python2 is not available on ubuntu-22.04 by default -- see https://github.com/github/codeql-action/pull/1257
40+
- python_version: 2
41+
os: ubuntu-22.04
3942

4043

4144
env:
@@ -63,6 +66,7 @@ jobs:
6366
6467
case ${{ matrix.os }} in
6568
ubuntu-latest*) basePath="/opt";;
69+
ubuntu-22.04*) basePath="/opt";;
6670
macos-latest*) basePath="/Users/runner";;
6771
esac
6872
echo ${basePath}
@@ -86,7 +90,7 @@ jobs:
8690
strategy:
8791
fail-fast: false
8892
matrix:
89-
os: [ubuntu-latest, macos-latest]
93+
os: [ubuntu-latest, ubuntu-22.04, macos-latest]
9094

9195
steps:
9296
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
@@ -109,6 +113,7 @@ jobs:
109113
110114
case ${{ matrix.os }} in
111115
ubuntu-latest*) basePath="/opt";;
116+
ubuntu-22.04*) basePath="/opt";;
112117
macos-latest*) basePath="/Users/runner";;
113118
esac
114119
echo ${basePath}

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# CodeQL Action Changelog
22

3+
## 2.1.25 - 21 Sep 2022
4+
5+
- We will soon be rolling out a feature of the CodeQL Action that stores some information used to make future runs faster in the GitHub Actions cache. Initially, this will only be enabled on JavaScript repositories, but we plan to add more languages to this soon. The new feature can be disabled by passing the `trap-caching: false` option to your workflow's `init` step, for example if you are already using the GitHub Actions cache for a different purpose and are near the storage limit for it.
6+
- Add support for Python automatic dependency installation with Poetry 1.2 [#1258](https://github.com/github/codeql-action/pull/1258).
7+
38
## 2.1.24 - 16 Sep 2022
49

510
No user facing changes.

node_modules/.package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "codeql",
3-
"version": "2.1.24",
3+
"version": "2.1.25",
44
"private": true,
55
"description": "CodeQL action",
66
"scripts": {

python-setup/auto_install_packages.py

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,46 @@
55
import subprocess
66
from tempfile import mkdtemp
77
from typing import Optional
8+
import shutil
89

910
import extractor_version
1011

1112

12-
def _check_call(command):
13+
def _check_call(command, extra_env={}):
1314
print('+ {}'.format(' '.join(command)), flush=True)
14-
subprocess.check_call(command, stdin=subprocess.DEVNULL)
15+
16+
env = os.environ.copy()
17+
env.update(extra_env)
18+
subprocess.check_call(command, stdin=subprocess.DEVNULL, env=env)
19+
sys.stdout.flush()
20+
sys.stderr.flush()
1521

1622

17-
def _check_output(command):
23+
def _check_output(command, extra_env={}):
1824
print('+ {}'.format(' '.join(command)), flush=True)
19-
out = subprocess.check_output(command, stdin=subprocess.DEVNULL)
25+
26+
env = os.environ.copy()
27+
env.update(extra_env)
28+
out = subprocess.check_output(command, stdin=subprocess.DEVNULL, env=env)
2029
print(out, flush=True)
2130
sys.stderr.flush()
2231
return out
2332

2433

2534
def install_packages_with_poetry():
35+
36+
# To handle poetry 1.2, which started to use keyring interaction MUCH more, we need
37+
# add a workaround. See
38+
# https://github.com/python-poetry/poetry/issues/2692#issuecomment-1235683370
39+
extra_poetry_env = {"PYTHON_KEYRING_BACKEND": "keyring.backends.null.Keyring"}
40+
2641
command = [sys.executable, '-m', 'poetry']
2742
if sys.platform.startswith('win32'):
2843
# In windows the default path were the deps are installed gets wiped out between steps,
2944
# so we have to set it up to a folder that will be kept
3045
os.environ['POETRY_VIRTUALENVS_PATH'] = os.path.join(os.environ['RUNNER_WORKSPACE'], 'virtualenvs')
3146
try:
32-
_check_call(command + ['install', '--no-root'])
47+
_check_call(command + ['install', '--no-root'], extra_env=extra_poetry_env)
3348
except subprocess.CalledProcessError:
3449
sys.exit('package installation with poetry failed, see error above')
3550

@@ -38,7 +53,7 @@ def install_packages_with_poetry():
3853
# virtualenv for the package, which was the case for using poetry for Python 2 when
3954
# default system interpreter was Python 3 :/
4055

41-
poetry_out = _check_output(command + ['run', 'which', 'python'])
56+
poetry_out = _check_output(command + ['run', 'which', 'python'], extra_env=extra_poetry_env)
4257
python_executable_path = poetry_out.decode('utf-8').splitlines()[-1]
4358

4459
if sys.platform.startswith('win32'):
@@ -153,6 +168,19 @@ def install_packages(codeql_base_dir) -> Optional[str]:
153168

154169
# get_extractor_version returns the Python version the extractor thinks this repo is using
155170
version = extractor_version.get_extractor_version(codeql_base_dir, quiet=False)
171+
sys.stdout.flush()
172+
sys.stderr.flush()
173+
174+
if version == 2 and not sys.platform.startswith('win32'):
175+
# On Ubuntu 22.04 'python2' is not available by default. We want to give a slightly better
176+
# error message than a traceback + `No such file or directory: 'python2'`
177+
if shutil.which("python2") is None:
178+
sys.exit(
179+
"Python package installation failed: we detected this code as Python 2, but the 'python2' executable was not available. "
180+
"To enable automatic package installation, please install 'python2' before the 'github/codeql-action/init' step, "
181+
"for example by running 'sudo apt install python2' (Ubuntu 22.04). "
182+
"If your code is not Python 2, but actually Python 3, please file a bug report at https://github.com/github/codeql-action/issues/new"
183+
)
156184

157185
if os.path.exists('requirements.txt'):
158186
print('Found requirements.txt, will install packages with pip', flush=True)

python-setup/install_tools.ps1

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
#! /usr/bin/pwsh
22

3-
py -2 -m pip install --user --upgrade pip setuptools wheel
4-
py -3 -m pip install --user --upgrade pip setuptools wheel
3+
# while waiting for the next release of `virtualenv` after v20.16.5, we install an older
4+
# version of `setuptools` to ensure that binaries are always put under
5+
# `<venv-path>/bin`, which wouldn't always happen with the GitHub actions version of
6+
# Ubuntu 22.04. See https://github.com/github/codeql-action/issues/1249
7+
py -2 -m pip install --user --upgrade pip 'setuptools<60' wheel
8+
py -3 -m pip install --user --upgrade pip 'setuptools<60' wheel
59

610
# virtualenv is a bit nicer for setting up virtual environment, since it will provide up-to-date versions of
711
# pip/setuptools/wheel which basic `python3 -m venv venv` won't
8-
py -2 -m pip install --user 'virtualenv<20.11'
9-
py -3 -m pip install --user 'virtualenv<20.11'
12+
py -2 -m pip install --user 'virtualenv!=20.12.0'
13+
py -3 -m pip install --user virtualenv
1014

11-
# We aren't compatible with poetry 1.2
12-
py -3 -m pip install --user "poetry>=1.1,<1.2"
15+
py -3 -m pip install --user "poetry>=1.1"
1316
py -3 -m pip install --user pipenv

python-setup/install_tools.sh

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,17 @@ set -e
1111
export PATH="$HOME/.local/bin:$PATH"
1212

1313
# Setup Python 3 dependency installation tools.
14-
python3 -m pip install --user --upgrade pip setuptools wheel
14+
15+
# we install an older version of `setuptools` to ensure that binaries are always put
16+
# under `<venv-path>/bin`, which wouldn't always happen with the GitHub actions version
17+
# of Ubuntu 22.04. See https://github.com/github/codeql-action/issues/1249. The the next
18+
# release of `virtualenv` after v20.16.5 will include a fix for this, so we can remove
19+
# this bit of the logic again.
20+
python3 -m pip install --user --upgrade pip 'setuptools<60' wheel
1521

1622
# virtualenv is a bit nicer for setting up virtual environment, since it will provide up-to-date versions of
1723
# pip/setuptools/wheel which basic `python3 -m venv venv` won't
18-
python3 -m pip install --user 'virtualenv<20.11'
24+
python3 -m pip install --user virtualenv
1925

2026
# We install poetry with pip instead of the recommended way, since the recommended way
2127
# caused some problem since `poetry run` gives output like:
@@ -24,8 +30,7 @@ python3 -m pip install --user 'virtualenv<20.11'
2430
# "program uses threads.", RuntimeWarning)
2531
# LGTM_PYTHON_SETUP_VERSION=The currently activated Python version 2.7.18 is not supported by the project (^3.5). Trying to find and use a compatible version. Using python3 (3.8.2) 3
2632

27-
# We aren't compatible with poetry 1.2
28-
python3 -m pip install --user "poetry>=1.1,<1.2"
33+
python3 -m pip install --user "poetry>=1.1"
2934
python3 -m pip install --user pipenv
3035

3136
if command -v python2 >/dev/null 2>&1; then
@@ -40,7 +45,7 @@ if command -v python2 >/dev/null 2>&1; then
4045
curl --location --fail https://bootstrap.pypa.io/pip/2.7/get-pip.py | python2
4146
fi
4247

43-
python2 -m pip install --user --upgrade pip setuptools wheel
48+
python2 -m pip install --user --upgrade pip 'setuptools<60' wheel
4449

45-
python2 -m pip install --user 'virtualenv<20.11'
50+
python2 -m pip install --user 'virtualenv!=20.12.0'
4651
fi

0 commit comments

Comments
 (0)