Skip to content

Commit 2c8f69b

Browse files
committed
use GUID for image name
1 parent 3bcd5ba commit 2c8f69b

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

.github/workflows/main.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on: [push, pull_request, release]
44

55
jobs:
66
find-tests:
7-
name: Find tests 🔍
7+
name: Find Tests 🔍
88
runs-on: ubuntu-latest
99
outputs:
1010
tests: ${{ steps.tests.outputs.tests }}
@@ -62,6 +62,7 @@ jobs:
6262
- find-tests
6363
- build
6464
strategy:
65+
fail-fast: false
6566
matrix:
6667
os:
6768
- ubuntu-latest

tests/lib/lib_linux.ps1

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
function WSL-Install() {
2+
$id = [guid]::NewGuid().ToString()
3+
24
# Build docker image from the provided tarball
35
$tmpdir = $(mktemp -d)
46
Copy-Item $PSScriptRoot/Dockerfile $tmpdir
57
Copy-Item nixos-wsl-installer.tar.gz $tmpdir
6-
docker build -t local:nixos-wsl $tmpdir | Write-Host
8+
docker build -t nixos-wsl:$id $tmpdir | Write-Host
79
Remove-Item $tmpdir -Recurse -Force
810

911
# Spawn a new docker container
10-
$id = docker run -di --privileged --init local:nixos-wsl /bin/sh
12+
docker run -di --privileged --init --name $id nixos-wsl:$id /bin/sh | Out-Null
1113
if ($LASTEXITCODE -ne 0) {
12-
throw "Failed to launch docker container"
14+
throw "Failed to launch container"
1315
}
1416

1517
return $id
@@ -19,9 +21,22 @@ function WSL-Launch([string]$id, [string]$command) {
1921
docker exec -t $id /nix/nixos-wsl/entrypoint -c "$command"
2022
}
2123

24+
# TODO: WSL-CopyFile
25+
26+
function WSL-Shutdown([string]$id) {
27+
docker stop $id
28+
if ($LASTEXITCODE -ne 0) {
29+
throw "Failed to stop container"
30+
}
31+
}
32+
2233
function WSL-Uninstall([string]$id) {
2334
docker rm -f $id
2435
if ($LASTEXITCODE -ne 0) {
25-
throw "Failed to remove docker container"
36+
throw "Failed to remove container"
37+
}
38+
docker rmi nixos-wsl:$id
39+
if ($LASTEXITCODE -ne 0) {
40+
throw "Failed to remove image"
2641
}
2742
}

0 commit comments

Comments
 (0)