Skip to content

Commit

Permalink
Merge pull request #201 from crazy-max/colima-update
Browse files Browse the repository at this point in the history
docker(install): fallback to journalctl to print docker daemon logs
  • Loading branch information
crazy-max authored Nov 16, 2023
2 parents 624fee6 + cef4c16 commit 97573bf
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 21 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,12 @@ jobs:
test: ${{ fromJson(needs.prepare-itg.outputs.matrix) }}
os:
- ubuntu-latest
- macos-13
- macos-latest
- windows-latest
exclude:
- os: macos-13
test: buildx/bake.test.itg.ts
- os: macos-latest
test: buildx/bake.test.itg.ts
- os: windows-latest
Expand Down
4 changes: 2 additions & 2 deletions __tests__/docker/install.test.itg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe('install', () => {
process.env = {
...originalEnv,
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'
COLIMA_START_ARGS: '--cpu 4 --memory 8 --disk 32'
};
});
afterEach(() => {
Expand All @@ -52,5 +52,5 @@ describe('install', () => {
await Docker.printInfo();
await install.tearDown();
})()).resolves.not.toThrow();
}, 600000);
}, 1200000);
});
19 changes: 1 addition & 18 deletions src/docker/assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,12 +187,6 @@ network:
dnsHosts:
host.docker.internal: host.lima.internal
# Network driver to use (slirp, gvproxy), (requires vmType \`qemu\`)
# - slirp is the default user mode networking provided by Qemu
# - gvproxy is an alternative to VPNKit based on gVisor https://github.com/containers/gvisor-tap-vsock
# Default: gvproxy
driver: gvproxy
# Forward the host's SSH agent to the virtual machine.
# Default: false
forwardAgent: false
Expand Down Expand Up @@ -242,14 +236,6 @@ mountType: 9p
# Default: host
cpuType: host
# For a more general purpose virtual machine, Ubuntu container is optionally provided
# as a layer on the virtual machine.
# The underlying virtual machine is still accessible via \`colima ssh --layer=false\` or running \`colima\` in
# the Ubuntu session.
#
# Default: false
layer: false
# Custom provision scripts for the virtual machine.
# Provisioning scripts are executed on startup and therefore needs to be idempotent.
#
Expand All @@ -270,10 +256,7 @@ layer: false
provision:
- mode: system
script: |
mkdir -p /tmp/docker-bins
cd /tmp/docker-bins
wget -qO- "https://download.docker.com/linux/static/{{dockerBinChannel}}/{{dockerBinArch}}/docker-{{dockerBinVersion}}.tgz" | tar xvz --strip 1
mv -f /tmp/docker-bins/* /usr/bin/
wget -qO- "https://download.docker.com/linux/static/{{dockerBinChannel}}/{{dockerBinArch}}/docker-{{dockerBinVersion}}.tgz" | tar xvz --strip 1 -C /usr/bin/
# Modify ~/.ssh/config automatically to include a SSH config for the virtual machine.
# SSH config will still be generated in ~/.colima/ssh_config regardless.
Expand Down
6 changes: 5 additions & 1 deletion src/docker/install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,11 @@ EOF`,

private async tearDownDarwin(): Promise<void> {
await core.group('Docker daemon logs', async () => {
await Exec.exec('colima', ['exec', '--', 'cat', '/var/log/docker.log']);
await Exec.exec('colima', ['exec', '--', 'cat', '/var/log/docker.log']).catch(async () => {
await Exec.exec('colima', ['exec', '--', 'sudo', 'journalctl', '-u', 'docker.service', '-l', '--no-pager']).catch(() => {
core.warning(`Failed to get Docker daemon logs`);
});
});
});
await core.group('Stopping colima', async () => {
await Exec.exec('colima', ['stop', '--very-verbose']);
Expand Down

0 comments on commit 97573bf

Please sign in to comment.