Skip to content

Commit 32e2a6b

Browse files
committed
docker(install): allow passing colima start args
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
1 parent c8d666e commit 32e2a6b

File tree

3 files changed

+14
-9
lines changed

3 files changed

+14
-9
lines changed

__tests__/docker/install.test.itg.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ describe('install', () => {
2929
jest.resetModules();
3030
process.env = {
3131
...originalEnv,
32-
SIGN_QEMU_BINARY: '1'
32+
SIGN_QEMU_BINARY: '1',
33+
COLIMA_START_ARGS: '--cpu 4 --memory 8 --disk 32 --dns 1.1.1.1 --dns 8.8.8.8 --dns-host example.com=1.2.3.4'
3334
};
3435
});
3536
afterEach(() => {

src/docker/assets.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ provision:
272272
script: |
273273
mkdir -p /tmp/docker-bins
274274
cd /tmp/docker-bins
275-
wget -qO- "https://download.docker.com/linux/static/{{dockerChannel}}/{{hostArch}}/docker-{{dockerVersion}}.tgz" | tar xvz --strip 1
275+
wget -qO- "https://download.docker.com/linux/static/{{dockerBinChannel}}/{{dockerBinArch}}/docker-{{dockerBinVersion}}.tgz" | tar xvz --strip 1
276276
mv -f /tmp/docker-bins/* /usr/bin/
277277
278278
# Modify ~/.ssh/config automatically to include a SSH config for the virtual machine.

src/docker/install.ts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -141,15 +141,15 @@ export class Install {
141141
}
142142

143143
await core.group('Creating colima config', async () => {
144-
let daemonConfig = yaml.dump({docker: {}});
144+
let colimaDaemonConfig = {};
145145
if (this.daemonConfig) {
146-
daemonConfig = yaml.dump(yaml.load(JSON.stringify({docker: JSON.parse(this.daemonConfig)})));
146+
colimaDaemonConfig = JSON.parse(this.daemonConfig);
147147
}
148148
const colimaCfg = handlebars.compile(colimaYamlData)({
149-
hostArch: Install.platformArch(),
150-
dockerVersion: this._version,
151-
dockerChannel: this.channel,
152-
daemonConfig: daemonConfig
149+
daemonConfig: yaml.dump(yaml.load(JSON.stringify({docker: colimaDaemonConfig}))),
150+
dockerBinVersion: this._version,
151+
dockerBinChannel: this.channel,
152+
dockerBinArch: Install.platformArch()
153153
});
154154
core.info(`Writing colima config to ${path.join(colimaDir, 'colima.yaml')}`);
155155
fs.writeFileSync(path.join(colimaDir, 'colima.yaml'), colimaCfg);
@@ -180,8 +180,12 @@ export class Install {
180180
};
181181

182182
await core.group('Starting colima', async () => {
183+
const colimaStartArgs = ['start', '--very-verbose'];
184+
if (process.env.COLIMA_START_ARGS) {
185+
colimaStartArgs.push(process.env.COLIMA_START_ARGS);
186+
}
183187
try {
184-
await Exec.exec('colima', ['start', '--very-verbose'], {env: envs});
188+
await Exec.exec(`colima ${colimaStartArgs.join(' ')}`, [], {env: envs});
185189
} catch (e) {
186190
const haStderrLog = path.join(os.homedir(), '.lima', 'colima', 'ha.stderr.log');
187191
if (fs.existsSync(haStderrLog)) {

0 commit comments

Comments
 (0)