Skip to content

Commit

Permalink
feat: add --push and --load to supersetbot docker
Browse files Browse the repository at this point in the history
  • Loading branch information
mistercrunch committed Dec 17, 2024
1 parent dd79310 commit f2c8aa1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,8 @@ export default function getCLI(context) {
.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('-l, --load', 'Whether to --load the image after building')
.option('-u, --push', 'Whether to --push the image after building')
.option('-x, --extra-flags <extraFlags>', 'Pass a extra flags to the docker build command')
.option('-v, --verbose', 'Print more info')
.action(async function () {
Expand All @@ -219,7 +221,6 @@ export default function getCLI(context) {
}

// --------------------------------------------------------------------
// await runDockerCommand('superset-node');
await runDockerCommand(opts.preset);
// --------------------------------------------------------------------
});
Expand Down
6 changes: 4 additions & 2 deletions src/docker.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export function getDockerTags({

export async function getDockerCommand({
preset, platform, buildContext, buildContextRef, forceLatest = false, latestRelease = null,
extraFlags = '',
extraFlags = '', push, load,
}) {
const platforms = platform;

Expand Down Expand Up @@ -114,7 +114,9 @@ export async function getDockerCommand({
}).map((tag) => `-t ${tag}`).join(' \\\n ');
const isAuthenticated = !!(process.env.DOCKERHUB_TOKEN);

const dockerArgs = isAuthenticated ? '--push --load' : '--load';
let dockerArgs = "";

Check failure on line 117 in src/docker.js

View workflow job for this annotation

GitHub Actions / build

Strings must use singlequote
dockerArgs += push || isAuthenticated ? ' --push ' : '';
dockerArgs += load ? ' --load ' : '';
const targetArgument = buildTarget ? `--target ${buildTarget}` : '';
const cacheRef = `${CACHE_REPO}:${pyVer}`;
const platformArg = `--platform ${platforms.join(',')}`;
Expand Down
3 changes: 2 additions & 1 deletion src/docker.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ jest.mock('./github.js', () => jest.fn().mockImplementation(() => NEW_REL));

beforeEach(() => {
process.env.TEST_ENV = 'true';
process.env.DOCKERHUB_TOKEN = 'dummy';
});

afterEach(() => {
Expand Down Expand Up @@ -240,7 +241,7 @@ describe('getDockerCommand', () => {
'push',
'master',
'',
['--load', `-t ${REPO}:master-dev `],
['--push', `-t ${REPO}:master-dev `],
],
[
'dev',
Expand Down

0 comments on commit f2c8aa1

Please sign in to comment.