fix(docker): error around missing requirements/base.txt (#27608)

This commit is contained in:
Maxime Beauchemin 2024-03-21 12:22:57 -07:00 committed by GitHub
parent 6e528426dd
commit 6f3afab01d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 23 additions and 10 deletions

View File

@ -1,6 +1,6 @@
{
"name": "supersetbot",
"version": "0.4.1",
"version": "0.4.2",
"description": "A bot for the Superset GitHub repo",
"type": "module",
"main": "src/index.js",

View File

@ -154,16 +154,16 @@ export default function getCLI(context) {
program.command('docker')
.description('Generates/run docker build commands use in CI')
.option('-t, --preset', 'Build preset', /^(lean|dev|dockerize|websocket|py310|ci)$/i, 'lean')
.option('-t, --preset <preset>', 'Build preset', /^(lean|dev|dockerize|websocket|py310|ci)$/i, 'lean')
.option('-c, --context <context>', 'Build context', /^(push|pull_request|release)$/i, 'local')
.option('-r, --context-ref <ref>', 'Reference to the PR, release, or branch')
.option('-p, --platform <platform...>', 'Platforms (multiple values allowed)')
.option('-f, --force-latest', 'Force the "latest" tag on the release')
.option('-v, --verbose', 'Print more info')
.action(function (preset) {
const opts = context.processOptions(this);
.action(function () {
const opts = context.processOptions(this, ['preset']);
opts.platform = opts.platform || ['linux/arm64'];
const cmd = docker.getDockerCommand({ preset, ...opts });
const cmd = docker.getDockerCommand({ ...opts });
context.log(cmd);
if (!opts.dryRun) {
utils.runShellCommand(cmd, false);

12
.github/supersetbot/src/cli.test.js vendored Normal file
View File

@ -0,0 +1,12 @@
import { spawnSync } from 'child_process';
describe('CLI Test', () => {
test.each([
['./src/supersetbot', ['docker', '--preset', 'dev', '--dry-run'], '--target dev'],
['./src/supersetbot', ['docker', '--dry-run'], '--target lean'],
])('returns %s for release %s', (command, arg, contains) => {
const result = spawnSync(command, arg);
const output = result.stdout.toString();
expect(result.stdout.toString()).toContain(contains);
});
});

View File

@ -61,7 +61,7 @@ ENV LANG=C.UTF-8 \
SUPERSET_HOME="/app/superset_home" \
SUPERSET_PORT=8088
RUN mkdir -p ${PYTHONPATH} superset/static superset-frontend apache_superset.egg-info requirements \
RUN mkdir -p ${PYTHONPATH} superset/static requirements superset-frontend apache_superset.egg-info requirements \
&& useradd --user-group -d ${SUPERSET_HOME} -m --no-log-init --shell /bin/bash superset \
&& apt-get update -qq && apt-get install -yqq --no-install-recommends \
build-essential \
@ -79,8 +79,8 @@ RUN mkdir -p ${PYTHONPATH} superset/static superset-frontend apache_superset.egg
COPY --chown=superset:superset setup.py MANIFEST.in README.md ./
# setup.py uses the version information in package.json
COPY --chown=superset:superset superset-frontend/package.json superset-frontend/
RUN --mount=type=bind,target=./requirements/base.txt,src=./requirements/base.txt \
--mount=type=cache,target=/root/.cache/pip \
COPY --chown=superset:superset requirements/base.txt requirements/
RUN --mount=type=cache,target=/root/.cache/pip \
pip install --upgrade setuptools pip && \
pip install -r requirements/base.txt
@ -126,8 +126,9 @@ RUN apt-get update -qq \
&& ln -s /opt/firefox/firefox /usr/local/bin/firefox \
&& apt-get autoremove -yqq --purge wget && rm -rf /var/[log,tmp]/* /tmp/* /var/lib/apt/lists/*
# Cache everything for dev purposes...
RUN --mount=type=bind,target=./requirements/development.txt,src=./requirements/development.txt \
--mount=type=cache,target=/root/.cache/pip \
COPY --chown=superset:superset requirements/development.txt requirements/
RUN --mount=type=cache,target=/root/.cache/pip \
pip install -r requirements/development.txt
USER superset