mirror of
https://github.com/docker/actions-toolkit.git
synced 2024-11-27 06:46:07 +08:00
Merge pull request #159 from crazy-max/docker-install-colima-args
docker(install): allow passing colima start args
This commit is contained in:
commit
31d5e42cc0
@ -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