docker(install): allow passing colima start args
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
@@ -29,7 +29,8 @@ describe('install', () => {
|
|||||||
jest.resetModules();
|
jest.resetModules();
|
||||||
process.env = {
|
process.env = {
|
||||||
...originalEnv,
|
...originalEnv,
|
||||||
SIGN_QEMU_BINARY: '1'
|
SIGN_QEMU_BINARY: '1',
|
||||||
|
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'
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
|
|||||||
@@ -272,7 +272,7 @@ provision:
|
|||||||
script: |
|
script: |
|
||||||
mkdir -p /tmp/docker-bins
|
mkdir -p /tmp/docker-bins
|
||||||
cd /tmp/docker-bins
|
cd /tmp/docker-bins
|
||||||
wget -qO- "https://download.docker.com/linux/static/{{dockerChannel}}/{{hostArch}}/docker-{{dockerVersion}}.tgz" | tar xvz --strip 1
|
wget -qO- "https://download.docker.com/linux/static/{{dockerBinChannel}}/{{dockerBinArch}}/docker-{{dockerBinVersion}}.tgz" | tar xvz --strip 1
|
||||||
mv -f /tmp/docker-bins/* /usr/bin/
|
mv -f /tmp/docker-bins/* /usr/bin/
|
||||||
|
|
||||||
# Modify ~/.ssh/config automatically to include a SSH config for the virtual machine.
|
# Modify ~/.ssh/config automatically to include a SSH config for the virtual machine.
|
||||||
|
|||||||
@@ -141,15 +141,15 @@ export class Install {
|
|||||||
}
|
}
|
||||||
|
|
||||||
await core.group('Creating colima config', async () => {
|
await core.group('Creating colima config', async () => {
|
||||||
let daemonConfig = yaml.dump({docker: {}});
|
let colimaDaemonConfig = {};
|
||||||
if (this.daemonConfig) {
|
if (this.daemonConfig) {
|
||||||
daemonConfig = yaml.dump(yaml.load(JSON.stringify({docker: JSON.parse(this.daemonConfig)})));
|
colimaDaemonConfig = JSON.parse(this.daemonConfig);
|
||||||
}
|
}
|
||||||
const colimaCfg = handlebars.compile(colimaYamlData)({
|
const colimaCfg = handlebars.compile(colimaYamlData)({
|
||||||
hostArch: Install.platformArch(),
|
daemonConfig: yaml.dump(yaml.load(JSON.stringify({docker: colimaDaemonConfig}))),
|
||||||
dockerVersion: this._version,
|
dockerBinVersion: this._version,
|
||||||
dockerChannel: this.channel,
|
dockerBinChannel: this.channel,
|
||||||
daemonConfig: daemonConfig
|
dockerBinArch: Install.platformArch()
|
||||||
});
|
});
|
||||||
core.info(`Writing colima config to ${path.join(colimaDir, 'colima.yaml')}`);
|
core.info(`Writing colima config to ${path.join(colimaDir, 'colima.yaml')}`);
|
||||||
fs.writeFileSync(path.join(colimaDir, 'colima.yaml'), colimaCfg);
|
fs.writeFileSync(path.join(colimaDir, 'colima.yaml'), colimaCfg);
|
||||||
@@ -180,8 +180,12 @@ export class Install {
|
|||||||
};
|
};
|
||||||
|
|
||||||
await core.group('Starting colima', async () => {
|
await core.group('Starting colima', async () => {
|
||||||
|
const colimaStartArgs = ['start', '--very-verbose'];
|
||||||
|
if (process.env.COLIMA_START_ARGS) {
|
||||||
|
colimaStartArgs.push(process.env.COLIMA_START_ARGS);
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
await Exec.exec('colima', ['start', '--very-verbose'], {env: envs});
|
await Exec.exec(`colima ${colimaStartArgs.join(' ')}`, [], {env: envs});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
const haStderrLog = path.join(os.homedir(), '.lima', 'colima', 'ha.stderr.log');
|
const haStderrLog = path.join(os.homedir(), '.lima', 'colima', 'ha.stderr.log');
|
||||||
if (fs.existsSync(haStderrLog)) {
|
if (fs.existsSync(haStderrLog)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user