Skip to content

Commit f2c8aa1

Browse files
committed
feat: add --push and --load to supersetbot docker
1 parent dd79310 commit f2c8aa1

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

src/cli.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,8 @@ export default function getCLI(context) {
193193
.option('-r, --context-ref <ref>', 'Reference to the PR, release, or branch')
194194
.option('-p, --platform <platform...>', 'Platforms (multiple values allowed)')
195195
.option('-f, --force-latest', 'Force the "latest" tag on the release')
196+
.option('-l, --load', 'Whether to --load the image after building')
197+
.option('-u, --push', 'Whether to --push the image after building')
196198
.option('-x, --extra-flags <extraFlags>', 'Pass a extra flags to the docker build command')
197199
.option('-v, --verbose', 'Print more info')
198200
.action(async function () {
@@ -219,7 +221,6 @@ export default function getCLI(context) {
219221
}
220222

221223
// --------------------------------------------------------------------
222-
// await runDockerCommand('superset-node');
223224
await runDockerCommand(opts.preset);
224225
// --------------------------------------------------------------------
225226
});

src/docker.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export function getDockerTags({
7171

7272
export async function getDockerCommand({
7373
preset, platform, buildContext, buildContextRef, forceLatest = false, latestRelease = null,
74-
extraFlags = '',
74+
extraFlags = '', push, load,
7575
}) {
7676
const platforms = platform;
7777

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

117-
const dockerArgs = isAuthenticated ? '--push --load' : '--load';
117+
let dockerArgs = "";
118+
dockerArgs += push || isAuthenticated ? ' --push ' : '';
119+
dockerArgs += load ? ' --load ' : '';
118120
const targetArgument = buildTarget ? `--target ${buildTarget}` : '';
119121
const cacheRef = `${CACHE_REPO}:${pyVer}`;
120122
const platformArg = `--platform ${platforms.join(',')}`;

src/docker.test.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ jest.mock('./github.js', () => jest.fn().mockImplementation(() => NEW_REL));
1111

1212
beforeEach(() => {
1313
process.env.TEST_ENV = 'true';
14+
process.env.DOCKERHUB_TOKEN = 'dummy';
1415
});
1516

1617
afterEach(() => {
@@ -240,7 +241,7 @@ describe('getDockerCommand', () => {
240241
'push',
241242
'master',
242243
'',
243-
['--load', `-t ${REPO}:master-dev `],
244+
['--push', `-t ${REPO}:master-dev `],
244245
],
245246
[
246247
'dev',

0 commit comments

Comments
 (0)