You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ma...@apache.org on 2024/03/21 19:23:03 UTC

(superset) branch master updated: fix(docker): error around missing requirements/base.txt (#27608)

This is an automated email from the ASF dual-hosted git repository.

maximebeauchemin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git


The following commit(s) were added to refs/heads/master by this push:
     new 6f3afab01d fix(docker): error around missing requirements/base.txt (#27608)
6f3afab01d is described below

commit 6f3afab01d94694f4b014337ec6fb0a13786ce55
Author: Maxime Beauchemin <ma...@gmail.com>
AuthorDate: Thu Mar 21 12:22:57 2024 -0700

    fix(docker): error around missing requirements/base.txt (#27608)
---
 .github/supersetbot/package.json    |  2 +-
 .github/supersetbot/src/cli.js      |  8 ++++----
 .github/supersetbot/src/cli.test.js | 12 ++++++++++++
 Dockerfile                          | 11 ++++++-----
 4 files changed, 23 insertions(+), 10 deletions(-)

diff --git a/.github/supersetbot/package.json b/.github/supersetbot/package.json
index ee9d008801..af6469a26b 100644
--- a/.github/supersetbot/package.json
+++ b/.github/supersetbot/package.json
@@ -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",
diff --git a/.github/supersetbot/src/cli.js b/.github/supersetbot/src/cli.js
index b8344d6ac3..4b4612ee97 100755
--- a/.github/supersetbot/src/cli.js
+++ b/.github/supersetbot/src/cli.js
@@ -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);
diff --git a/.github/supersetbot/src/cli.test.js b/.github/supersetbot/src/cli.test.js
new file mode 100644
index 0000000000..60ad8c94cd
--- /dev/null
+++ b/.github/supersetbot/src/cli.test.js
@@ -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);
+  });
+});
diff --git a/Dockerfile b/Dockerfile
index e5387d6779..5e7dceed4d 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -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