mirror of
https://github.com/docker/actions-toolkit.git
synced 2024-11-26 22:26:08 +08:00
docker(install): allow passing colima start args
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
parent
c8d666e020
commit
32e2a6bf6f
@ -29,7 +29,8 @@ describe('install', () => {
|
||||
jest.resetModules();
|
||||
process.env = {
|
||||
...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(() => {
|
||||
|
@ -272,7 +272,7 @@ provision:
|
||||
script: |
|
||||
mkdir -p /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/
|
||||
|
||||
# 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 () => {
|
||||
let daemonConfig = yaml.dump({docker: {}});
|
||||
let colimaDaemonConfig = {};
|
||||
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)({
|
||||
hostArch: Install.platformArch(),
|
||||
dockerVersion: this._version,
|
||||
dockerChannel: this.channel,
|
||||
daemonConfig: daemonConfig
|
||||
daemonConfig: yaml.dump(yaml.load(JSON.stringify({docker: colimaDaemonConfig}))),
|
||||
dockerBinVersion: this._version,
|
||||
dockerBinChannel: this.channel,
|
||||
dockerBinArch: Install.platformArch()
|
||||
});
|
||||
core.info(`Writing colima config to ${path.join(colimaDir, 'colima.yaml')}`);
|
||||
fs.writeFileSync(path.join(colimaDir, 'colima.yaml'), colimaCfg);
|
||||
@ -180,8 +180,12 @@ export class Install {
|
||||
};
|
||||
|
||||
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 {
|
||||
await Exec.exec('colima', ['start', '--very-verbose'], {env: envs});
|
||||
await Exec.exec(`colima ${colimaStartArgs.join(' ')}`, [], {env: envs});
|
||||
} catch (e) {
|
||||
const haStderrLog = path.join(os.homedir(), '.lima', 'colima', 'ha.stderr.log');
|
||||
if (fs.existsSync(haStderrLog)) {
|
||||
|
Loading…
Reference in New Issue
Block a user