@docker/github-builder-runtime 0.90.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (211) hide show
  1. package/LICENSE +191 -0
  2. package/README.md +5 -0
  3. package/lib/buildkit/buildkit.d.ts +29 -0
  4. package/lib/buildkit/buildkit.js +95 -0
  5. package/lib/buildkit/buildkit.js.map +1 -0
  6. package/lib/buildkit/config.d.ts +20 -0
  7. package/lib/buildkit/config.js +37 -0
  8. package/lib/buildkit/config.js.map +1 -0
  9. package/lib/buildkit/git.d.ts +24 -0
  10. package/lib/buildkit/git.js +103 -0
  11. package/lib/buildkit/git.js.map +1 -0
  12. package/lib/buildx/bake.d.ts +64 -0
  13. package/lib/buildx/bake.js +387 -0
  14. package/lib/buildx/bake.js.map +1 -0
  15. package/lib/buildx/build.d.ts +63 -0
  16. package/lib/buildx/build.js +356 -0
  17. package/lib/buildx/build.js.map +1 -0
  18. package/lib/buildx/builder.d.ts +27 -0
  19. package/lib/buildx/builder.js +290 -0
  20. package/lib/buildx/builder.js.map +1 -0
  21. package/lib/buildx/buildx.d.ts +47 -0
  22. package/lib/buildx/buildx.js +374 -0
  23. package/lib/buildx/buildx.js.map +1 -0
  24. package/lib/buildx/history.d.ts +39 -0
  25. package/lib/buildx/history.js +144 -0
  26. package/lib/buildx/history.js.map +1 -0
  27. package/lib/buildx/imagetools.d.ts +47 -0
  28. package/lib/buildx/imagetools.js +205 -0
  29. package/lib/buildx/imagetools.js.map +1 -0
  30. package/lib/buildx/install.d.ts +47 -0
  31. package/lib/buildx/install.js +314 -0
  32. package/lib/buildx/install.js.map +1 -0
  33. package/lib/cache.d.ts +40 -0
  34. package/lib/cache.js +129 -0
  35. package/lib/cache.js.map +1 -0
  36. package/lib/compose/compose.d.ts +33 -0
  37. package/lib/compose/compose.js +91 -0
  38. package/lib/compose/compose.js.map +1 -0
  39. package/lib/compose/install.d.ts +34 -0
  40. package/lib/compose/install.js +190 -0
  41. package/lib/compose/install.js.map +1 -0
  42. package/lib/context.d.ts +22 -0
  43. package/lib/context.js +33 -0
  44. package/lib/context.js.map +1 -0
  45. package/lib/cosign/cosign.d.ts +40 -0
  46. package/lib/cosign/cosign.js +127 -0
  47. package/lib/cosign/cosign.js.map +1 -0
  48. package/lib/cosign/dockerfile.d.ts +16 -0
  49. package/lib/cosign/dockerfile.js +61 -0
  50. package/lib/cosign/dockerfile.js.map +1 -0
  51. package/lib/cosign/install.d.ts +45 -0
  52. package/lib/cosign/install.js +229 -0
  53. package/lib/cosign/install.js.map +1 -0
  54. package/lib/docker/assets.d.ts +21 -0
  55. package/lib/docker/assets.js +346 -0
  56. package/lib/docker/assets.js.map +1 -0
  57. package/lib/docker/docker.d.ts +35 -0
  58. package/lib/docker/docker.js +199 -0
  59. package/lib/docker/docker.js.map +1 -0
  60. package/lib/docker/install.d.ts +85 -0
  61. package/lib/docker/install.js +726 -0
  62. package/lib/docker/install.js.map +1 -0
  63. package/lib/dockerhub.d.ts +33 -0
  64. package/lib/dockerhub.js +111 -0
  65. package/lib/dockerhub.js.map +1 -0
  66. package/lib/exec.d.ts +20 -0
  67. package/lib/exec.js +28 -0
  68. package/lib/exec.js.map +1 -0
  69. package/lib/git.d.ts +33 -0
  70. package/lib/git.js +185 -0
  71. package/lib/git.js.map +1 -0
  72. package/lib/github/artifact.d.ts +19 -0
  73. package/lib/github/artifact.js +49 -0
  74. package/lib/github/artifact.js.map +1 -0
  75. package/lib/github/github.d.ts +39 -0
  76. package/lib/github/github.js +135 -0
  77. package/lib/github/github.js.map +1 -0
  78. package/lib/github/summary.d.ts +20 -0
  79. package/lib/github/summary.js +166 -0
  80. package/lib/github/summary.js.map +1 -0
  81. package/lib/index.d.ts +24 -0
  82. package/lib/index.js +48 -0
  83. package/lib/index.js.map +1 -0
  84. package/lib/oci/oci.d.ts +11 -0
  85. package/lib/oci/oci.js +199 -0
  86. package/lib/oci/oci.js.map +1 -0
  87. package/lib/regclient/install.d.ts +30 -0
  88. package/lib/regclient/install.js +136 -0
  89. package/lib/regclient/install.js.map +1 -0
  90. package/lib/regclient/regctl.d.ts +39 -0
  91. package/lib/regclient/regctl.js +102 -0
  92. package/lib/regclient/regctl.js.map +1 -0
  93. package/lib/sigstore/sigstore.d.ts +41 -0
  94. package/lib/sigstore/sigstore.js +461 -0
  95. package/lib/sigstore/sigstore.js.map +1 -0
  96. package/lib/toolkit.d.ts +57 -0
  97. package/lib/toolkit.js +68 -0
  98. package/lib/toolkit.js.map +1 -0
  99. package/lib/types/buildkit/buildkit.d.ts +16 -0
  100. package/lib/types/buildkit/buildkit.js +18 -0
  101. package/lib/types/buildkit/buildkit.js.map +1 -0
  102. package/lib/types/buildkit/client.d.ts +61 -0
  103. package/lib/types/buildkit/client.js +17 -0
  104. package/lib/types/buildkit/client.js.map +1 -0
  105. package/lib/types/buildkit/control.d.ts +88 -0
  106. package/lib/types/buildkit/control.js +17 -0
  107. package/lib/types/buildkit/control.js.map +1 -0
  108. package/lib/types/buildkit/git.d.ts +40 -0
  109. package/lib/types/buildkit/git.js +17 -0
  110. package/lib/types/buildkit/git.js.map +1 -0
  111. package/lib/types/buildkit/ops.d.ts +60 -0
  112. package/lib/types/buildkit/ops.js +17 -0
  113. package/lib/types/buildkit/ops.js.map +1 -0
  114. package/lib/types/buildkit/rpc.d.ts +24 -0
  115. package/lib/types/buildkit/rpc.js +17 -0
  116. package/lib/types/buildkit/rpc.js.map +1 -0
  117. package/lib/types/buildx/bake.d.ts +70 -0
  118. package/lib/types/buildx/bake.js +17 -0
  119. package/lib/types/buildx/bake.js.map +1 -0
  120. package/lib/types/buildx/build.d.ts +19 -0
  121. package/lib/types/buildx/build.js +17 -0
  122. package/lib/types/buildx/build.js.map +1 -0
  123. package/lib/types/buildx/builder.d.ts +52 -0
  124. package/lib/types/buildx/builder.js +17 -0
  125. package/lib/types/buildx/builder.js.map +1 -0
  126. package/lib/types/buildx/buildx.d.ts +42 -0
  127. package/lib/types/buildx/buildx.js +17 -0
  128. package/lib/types/buildx/buildx.js.map +1 -0
  129. package/lib/types/buildx/history.d.ts +111 -0
  130. package/lib/types/buildx/history.js +17 -0
  131. package/lib/types/buildx/history.js.map +1 -0
  132. package/lib/types/buildx/imagetools.d.ts +52 -0
  133. package/lib/types/buildx/imagetools.js +17 -0
  134. package/lib/types/buildx/imagetools.js.map +1 -0
  135. package/lib/types/compose/compose.d.ts +22 -0
  136. package/lib/types/compose/compose.js +17 -0
  137. package/lib/types/compose/compose.js.map +1 -0
  138. package/lib/types/cosign/cosign.d.ts +21 -0
  139. package/lib/types/cosign/cosign.js +17 -0
  140. package/lib/types/cosign/cosign.js.map +1 -0
  141. package/lib/types/docker/docker.d.ts +82 -0
  142. package/lib/types/docker/docker.js +17 -0
  143. package/lib/types/docker/docker.js.map +1 -0
  144. package/lib/types/docker/mediatype.d.ts +18 -0
  145. package/lib/types/docker/mediatype.js +19 -0
  146. package/lib/types/docker/mediatype.js.map +1 -0
  147. package/lib/types/dockerhub.d.ts +104 -0
  148. package/lib/types/dockerhub.js +17 -0
  149. package/lib/types/dockerhub.js.map +1 -0
  150. package/lib/types/github/artifact.d.ts +26 -0
  151. package/lib/types/github/artifact.js +17 -0
  152. package/lib/types/github/artifact.js.map +1 -0
  153. package/lib/types/github/github.d.ts +43 -0
  154. package/lib/types/github/github.js +17 -0
  155. package/lib/types/github/github.js.map +1 -0
  156. package/lib/types/github/summary.d.ts +29 -0
  157. package/lib/types/github/summary.js +17 -0
  158. package/lib/types/github/summary.js.map +1 -0
  159. package/lib/types/intoto/intoto.d.ts +21 -0
  160. package/lib/types/intoto/intoto.js +19 -0
  161. package/lib/types/intoto/intoto.js.map +1 -0
  162. package/lib/types/intoto/slsa_provenance/v0.2/provenance.d.ts +55 -0
  163. package/lib/types/intoto/slsa_provenance/v0.2/provenance.js +18 -0
  164. package/lib/types/intoto/slsa_provenance/v0.2/provenance.js.map +1 -0
  165. package/lib/types/oci/config.d.ts +47 -0
  166. package/lib/types/oci/config.js +17 -0
  167. package/lib/types/oci/config.js.map +1 -0
  168. package/lib/types/oci/descriptor.d.ts +34 -0
  169. package/lib/types/oci/descriptor.js +23 -0
  170. package/lib/types/oci/descriptor.js.map +1 -0
  171. package/lib/types/oci/digest.d.ts +16 -0
  172. package/lib/types/oci/digest.js +17 -0
  173. package/lib/types/oci/digest.js.map +1 -0
  174. package/lib/types/oci/index.d.ts +24 -0
  175. package/lib/types/oci/index.js +17 -0
  176. package/lib/types/oci/index.js.map +1 -0
  177. package/lib/types/oci/layout.d.ts +22 -0
  178. package/lib/types/oci/layout.js +20 -0
  179. package/lib/types/oci/layout.js.map +1 -0
  180. package/lib/types/oci/manifest.d.ts +25 -0
  181. package/lib/types/oci/manifest.js +17 -0
  182. package/lib/types/oci/manifest.js.map +1 -0
  183. package/lib/types/oci/mediatype.d.ts +21 -0
  184. package/lib/types/oci/mediatype.js +22 -0
  185. package/lib/types/oci/mediatype.js.map +1 -0
  186. package/lib/types/oci/oci.d.ts +32 -0
  187. package/lib/types/oci/oci.js +17 -0
  188. package/lib/types/oci/oci.js.map +1 -0
  189. package/lib/types/oci/versioned.d.ts +18 -0
  190. package/lib/types/oci/versioned.js +17 -0
  191. package/lib/types/oci/versioned.js.map +1 -0
  192. package/lib/types/regclient/regclient.d.ts +21 -0
  193. package/lib/types/regclient/regclient.js +17 -0
  194. package/lib/types/regclient/regclient.js.map +1 -0
  195. package/lib/types/sigstore/sigstore.d.ts +80 -0
  196. package/lib/types/sigstore/sigstore.js +20 -0
  197. package/lib/types/sigstore/sigstore.js.map +1 -0
  198. package/lib/types/undock/undock.d.ts +21 -0
  199. package/lib/types/undock/undock.js +17 -0
  200. package/lib/types/undock/undock.js.map +1 -0
  201. package/lib/undock/install.d.ts +30 -0
  202. package/lib/undock/install.js +146 -0
  203. package/lib/undock/install.js.map +1 -0
  204. package/lib/undock/undock.d.ts +42 -0
  205. package/lib/undock/undock.js +121 -0
  206. package/lib/undock/undock.js.map +1 -0
  207. package/lib/util.d.ts +49 -0
  208. package/lib/util.js +218 -0
  209. package/lib/util.js.map +1 -0
  210. package/npm-shrinkwrap.json +2858 -0
  211. package/package.json +57 -0
@@ -0,0 +1,346 @@
1
+ /**
2
+ * Copyright 2023 actions-toolkit authors
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import fs from 'fs';
17
+ import { Context } from '../context.js';
18
+ export const setupDockerWinPs1 = () => {
19
+ return get('docker-setup-win.ps1', setupDockerWinPs1Data);
20
+ };
21
+ export const dockerServiceLogsPs1 = () => {
22
+ return get('docker-service-logs.ps1', dockerServiceLogsPs1Data);
23
+ };
24
+ export const limaYaml = () => {
25
+ return get('lima.yaml', limaYamlData);
26
+ };
27
+ const get = (filename, data, mode) => {
28
+ const assetPath = Context.tmpName({
29
+ template: `docker-asset-XXXXXX-${filename}`,
30
+ tmpdir: Context.tmpDir()
31
+ });
32
+ fs.writeFileSync(assetPath, data);
33
+ if (mode) {
34
+ fs.chmodSync(assetPath, mode);
35
+ }
36
+ return assetPath;
37
+ };
38
+ export const setupDockerWinPs1Data = `
39
+ [CmdletBinding()]
40
+ param(
41
+ [Parameter(Mandatory = $true)]
42
+ [string]$ToolDir,
43
+
44
+ [Parameter(Mandatory = $true)]
45
+ [string]$RunDir,
46
+
47
+ [Parameter(Mandatory = $true)]
48
+ [string]$DockerHostSocket,
49
+
50
+ [Parameter(Mandatory = $false)]
51
+ [string]$DockerHostTCP,
52
+
53
+ [Parameter(Mandatory = $false)]
54
+ [string]$DaemonConfig)
55
+
56
+ $pwver = (Get-ItemProperty -Path HKLM:\\SOFTWARE\\Microsoft\\PowerShell\\3\\PowerShellEngine -Name 'PowerShellVersion').PowerShellVersion
57
+ Write-Host "PowerShell version: $pwver"
58
+
59
+ # Create run directory
60
+ New-Item -ItemType Directory "$RunDir" -ErrorAction SilentlyContinue | Out-Null
61
+
62
+ # Remove existing service
63
+ if (Get-Service docker -ErrorAction SilentlyContinue) {
64
+ $dockerVersion = (docker version -f "{{.Server.Version}}")
65
+ Write-Host "Current installed Docker version: $dockerVersion"
66
+ # stop service
67
+ Stop-Service -Force -Name docker
68
+ Write-Host "Service stopped"
69
+ # remove service
70
+ sc.exe delete "docker"
71
+ # removes event log entry. we could use "Remove-EventLog -LogName -Source docker"
72
+ # but this cmd is not available atm
73
+ $ErrorActionPreference = "SilentlyContinue"
74
+ & reg delete "HKLM\\SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\docker" /f 2>&1 | Out-Null
75
+ $ErrorActionPreference = "Stop"
76
+ Write-Host "Service removed"
77
+ }
78
+
79
+ $env:Path = "$ToolDir;" + [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")
80
+ Write-Host "Path: $env:Path"
81
+
82
+ $env:DOCKER_HOST = $DockerHostSocket
83
+ Write-Host "DOCKER_HOST: $env:DOCKER_HOST"
84
+
85
+ if ($DaemonConfig) {
86
+ Write-Host "Writing Docker daemon config"
87
+ New-Item -ItemType Directory -Force -Path "$env:ProgramData\\Docker\\config"
88
+ $DaemonConfig | Out-File -FilePath "$env:ProgramData\\Docker\\config\\daemon.json"
89
+ }
90
+
91
+ $arguments = @(
92
+ "--host=$DockerHostSocket",
93
+ "--data-root=$RunDir\\\\moby-root",
94
+ "--exec-root=$RunDir\\\\moby-exec",
95
+ "--pidfile=$RunDir\\\\docker.pid",
96
+ "--register-service"
97
+ )
98
+ if ($DockerHostTCP) {
99
+ $arguments += "--host=$DockerHostTCP"
100
+ }
101
+
102
+ Write-Host "Creating service"
103
+ New-Item -ItemType Directory "$RunDir\\moby-root" -ErrorAction SilentlyContinue | Out-Null
104
+ New-Item -ItemType Directory "$RunDir\\moby-exec" -ErrorAction SilentlyContinue | Out-Null
105
+ Start-Process -Wait -NoNewWindow "$ToolDir\\dockerd" -ArgumentList $arguments
106
+ Write-Host "Starting service"
107
+ Start-Service -Name docker
108
+ Write-Host "Service started successfully!"
109
+
110
+ $tries=20
111
+ Write-Host "Waiting for Docker daemon to start..."
112
+ While ($true) {
113
+ $ErrorActionPreference = "SilentlyContinue"
114
+ & "$ToolDir\\docker" version | Out-Null
115
+ $ErrorActionPreference = "Stop"
116
+ If ($LastExitCode -eq 0) {
117
+ break
118
+ }
119
+ $tries--
120
+ If ($tries -le 0) {
121
+ Throw "Failed to get a response from Docker daemon"
122
+ }
123
+ Write-Host -NoNewline "."
124
+ Start-Sleep -Seconds 1
125
+ }
126
+ Write-Host "Docker daemon started successfully!"
127
+ `;
128
+ export const dockerServiceLogsPs1Data = `
129
+ Get-WinEvent -ea SilentlyContinue \`
130
+ -FilterHashtable @{ProviderName= "docker"; LogName = "application"} |
131
+ Sort-Object @{Expression="TimeCreated";Descending=$false} |
132
+ ForEach-Object {"$($_.TimeCreated.ToUniversalTime().ToString("o")) [$($_.LevelDisplayName)] $($_.Message)"}
133
+ `;
134
+ export const limaYamlData = `
135
+ # Source:
136
+ # - https://github.com/lima-vm/lima/blob/master/templates/docker-rootful.yaml
137
+ # - https://github.com/lima-vm/lima/blob/master/templates/_images/ubuntu-lts.yaml
138
+ # - https://github.com/lima-vm/lima/blob/master/templates/_images/ubuntu-24.04.yaml
139
+
140
+ # VM type: "qemu" or "vz" (on macOS 13 and later).
141
+ # The vmType can be specified only on creating the instance.
142
+ # The vmType of existing instances cannot be changed.
143
+ # Builtin default: "qemu"
144
+ vmType: qemu
145
+
146
+ # OS: "Linux".
147
+ # Builtin default: "Linux"
148
+ os: null
149
+
150
+ # Arch: "default", "x86_64", "aarch64".
151
+ # Builtin default: "default" (corresponds to the host architecture)
152
+ arch: null
153
+
154
+ images:
155
+ {{#each customImages}}
156
+ - location: "{{location}}"
157
+ arch: "{{arch}}"
158
+ digest: "{{digest}}"
159
+ {{/each}}
160
+ - location: "https://cloud-images.ubuntu.com/releases/noble/release-20260321/ubuntu-24.04-server-cloudimg-amd64.img"
161
+ arch: "x86_64"
162
+ digest: "sha256:5c3ddb00f60bc455dac0862fabe9d8bacec46c33ac1751143c5c3683404b110d"
163
+ kernel:
164
+ location: "https://cloud-images.ubuntu.com/releases/noble/release-20260321/unpacked/ubuntu-24.04-server-cloudimg-amd64-vmlinuz-generic"
165
+ digest: "sha256:5b2a4fe174dacb18281f8f7d72ae32ac4b92801f0b7b5cb43ea55dee29fb789d"
166
+ cmdline: "root=LABEL=cloudimg-rootfs ro console=tty1 console=ttyAMA0 no_timer_check"
167
+ initrd:
168
+ location: "https://cloud-images.ubuntu.com/releases/noble/release-20260321/unpacked/ubuntu-24.04-server-cloudimg-amd64-initrd-generic"
169
+ digest: "sha256:cd0b64a5498e583a820a5b842369df83d036b4200b33bc51cadc58176184aaca"
170
+ - location: "https://cloud-images.ubuntu.com/releases/noble/release-20260321/ubuntu-24.04-server-cloudimg-arm64.img"
171
+ arch: "aarch64"
172
+ digest: "sha256:1ea801e659d2f5035ac294e0faab0aac9b6ba66753df933ba5c7beab0c689bd0"
173
+ # Fallback to the latest release image.
174
+ # Hint: run \`limactl prune\` to invalidate the cache
175
+ - location: https://cloud-images.ubuntu.com/releases/noble/release/ubuntu-24.04-server-cloudimg-amd64.img
176
+ arch: "x86_64"
177
+ - location: https://cloud-images.ubuntu.com/releases/noble/release/ubuntu-24.04-server-cloudimg-arm64.img
178
+ arch: "aarch64"
179
+
180
+ # CPUs
181
+ # Builtin default: min(4, host CPU cores)
182
+ cpus: null
183
+
184
+ # Memory size
185
+ # Builtin default: min("4GiB", half of host memory)
186
+ memory: null
187
+
188
+ # Disk size
189
+ # Builtin default: "100GiB"
190
+ disk: 60GiB
191
+
192
+ # Expose host directories to the guest, the mount point might be accessible from all UIDs in the guest
193
+ # Builtin default: null (Mount nothing)
194
+ # This file: Mount the home as read-only, /tmp/lima as writable
195
+ mounts:
196
+ - location: "~"
197
+ - location: "/tmp/lima"
198
+ writable: true
199
+
200
+ # Mount type for above mounts, such as "reverse-sshfs" (from sshocker), "9p" (EXPERIMENTAL, from QEMU’s virtio-9p-pci, aka virtfs),
201
+ # or "virtiofs" (EXPERIMENTAL, needs \`vmType: vz\`)
202
+ # Builtin default: "reverse-sshfs" (for QEMU), "virtiofs" (for vz)
203
+ mountType: null
204
+
205
+ containerd:
206
+ system: false
207
+ user: false
208
+
209
+ provision:
210
+ - mode: system
211
+ # This script defines the host.docker.internal hostname when hostResolver is disabled.
212
+ # It is also needed for lima 0.8.2 and earlier, which does not support hostResolver.hosts.
213
+ # Names defined in /etc/hosts inside the VM are not resolved inside containers when
214
+ # using the hostResolver; use hostResolver.hosts instead (requires lima 0.8.3 or later).
215
+ script: |
216
+ #!/bin/sh
217
+ sed -i 's/host.lima.internal.*/host.lima.internal host.docker.internal/' /etc/hosts
218
+ - mode: system
219
+ script: |
220
+ #!/bin/sh
221
+ apt-get install -f -y iptables
222
+ - mode: system
223
+ script: |
224
+ #!/bin/bash
225
+ set -eux -o pipefail
226
+ archiveInstallLog=/var/log/docker-actions-toolkit-archive-install.log
227
+ command -v docker >/dev/null 2>&1 && exit 0
228
+ if [ ! -e /etc/systemd/system/docker.socket.d/override.conf ]; then
229
+ mkdir -p /etc/systemd/system/docker.socket.d
230
+ # Alternatively we could just add the user to the "docker" group, but that requires restarting the user session
231
+ cat <<-EOF >/etc/systemd/system/docker.socket.d/override.conf
232
+ [Socket]
233
+ SocketUser=\${LIMA_CIDATA_USER}
234
+ EOF
235
+ fi
236
+ if [ ! -e /etc/docker/daemon.json ]; then
237
+ mkdir -p /etc/docker
238
+ cat <<-EOF >/etc/docker/daemon.json
239
+ {{stringify daemonConfig}}
240
+ EOF
241
+ fi
242
+ export DEBIAN_FRONTEND=noninteractive
243
+ if [ "{{srcType}}" == "archive" ]; then
244
+ {
245
+ getDockerScript=$(mktemp)
246
+ curl --retry 3 --retry-all-errors --retry-delay 5 -fsSL -o "$getDockerScript" https://get.docker.com
247
+
248
+ attempt=1
249
+ max_attempts=3
250
+ until [ "$attempt" -gt "$max_attempts" ]; do
251
+ echo "Docker install attempt $attempt/$max_attempts"
252
+ if sh "$getDockerScript" --channel {{srcArchiveChannel}} --version {{srcArchiveVersion}}; then
253
+ break
254
+ fi
255
+ if [ "$attempt" -eq "$max_attempts" ]; then
256
+ echo >&2 "Docker install failed after $max_attempts attempts"
257
+ exit 1
258
+ fi
259
+ echo >&2 "Docker install attempt $attempt failed, retrying after $((attempt * 30))s"
260
+ rm -rf /var/lib/apt/lists/partial/* || true
261
+ apt-get clean || true
262
+ sleep $((attempt * 30))
263
+ attempt=$((attempt + 1))
264
+ done
265
+
266
+ sed -i 's|^ExecStart=.*|ExecStart=/usr/bin/dockerd -H fd://{{#if localTCPPort}} -H tcp://0.0.0.0:2375{{/if}} --containerd=/run/containerd/containerd.sock|' /usr/lib/systemd/system/docker.service
267
+ systemctl daemon-reload
268
+ systemctl restart docker
269
+ systemctl status docker.socket || true
270
+ systemctl status docker.service || true
271
+ } 2>&1 | tee "$archiveInstallLog"
272
+ elif [ "{{srcType}}" == "image" ]; then
273
+ arch=$(uname -m)
274
+ case $arch in
275
+ x86_64) arch=amd64;;
276
+ aarch64) arch=arm64;;
277
+ esac
278
+ url="https://github.com/crazy-max/undock/releases/download/v0.12.0/undock_0.12.0_linux_$arch.tar.gz"
279
+
280
+ wget "$url" -O /tmp/undock.tar.gz
281
+ tar -C /usr/local/bin -xvf /tmp/undock.tar.gz
282
+ undock --version
283
+
284
+ HOME=/tmp undock moby/moby-bin:{{srcImageTag}} /usr/local/bin
285
+
286
+ wget https://raw.githubusercontent.com/moby/moby/{{gitCommit}}/contrib/init/systemd/docker.service \
287
+ -O /etc/systemd/system/docker.service
288
+ wget https://raw.githubusercontent.com/moby/moby/{{gitCommit}}/contrib/init/systemd/docker.socket \
289
+ -O /etc/systemd/system/docker.socket
290
+
291
+ sed -i 's|^ExecStart=.*|ExecStart=/usr/local/bin/dockerd -H fd://{{#if localTCPPort}} -H tcp://0.0.0.0:2375{{/if}}|' /etc/systemd/system/docker.service
292
+ sed -i 's|containerd.service||' /etc/systemd/system/docker.service
293
+ if ! getent group docker; then
294
+ groupadd --system docker
295
+ fi
296
+ systemctl daemon-reload
297
+ fail=0
298
+ if ! systemctl enable --now docker; then
299
+ fail=1
300
+ fi
301
+ systemctl status docker.socket || true
302
+ systemctl status docker.service || true
303
+ exit $fail
304
+ fi
305
+
306
+ probes:
307
+ - script: |
308
+ #!/bin/bash
309
+ set -eux -o pipefail
310
+ # Don't check for docker CLI as it's not installed in the VM (only on the host)
311
+ if ! timeout 60s bash -c "until pgrep dockerd; do sleep 3; done"; then
312
+ echo >&2 "dockerd is not running"
313
+ exit 1
314
+ fi
315
+ hint: See "/var/log/cloud-init-output.log". in the guest
316
+
317
+ hostResolver:
318
+ # Don't use local system resolver
319
+ enabled: false
320
+ # hostResolver.hosts requires lima 0.8.3 or later. Names defined here will also
321
+ # resolve inside containers, and not just inside the VM itself.
322
+ hosts:
323
+ host.docker.internal: host.lima.internal
324
+
325
+ # Use custom DNS servers instead of the host's DNS settings
326
+ dns:
327
+ - 1.1.1.1
328
+ - 1.0.0.1
329
+
330
+ portForwards:
331
+ - guestSocket: "/var/run/docker.sock"
332
+ hostSocket: "{{dockerSock}}"
333
+ {{#if localTCPPort}}
334
+ - guestPort: 2375
335
+ hostPort: {{localTCPPort}}
336
+ {{/if}}
337
+
338
+ audio:
339
+ # EXPERIMENTAL
340
+ # QEMU audiodev, e.g., "none", "coreaudio", "pa", "alsa", "oss".
341
+ # VZ driver, use "vz" as device name
342
+ # Choosing "none" will mute the audio output, and not play any sound.
343
+ # Builtin default: ""
344
+ device: none
345
+ `;
346
+ //# sourceMappingURL=assets.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assets.js","sourceRo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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmN3B,CAAC"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Copyright 2023 actions-toolkit authors
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { ExecOptions, ExecOutput } from '@actions/exec';
17
+ import { ConfigFile, ContextInfo } from '../types/docker/docker.js';
18
+ export declare class Docker {
19
+ static get configDir(): string;
20
+ static configFile(): ConfigFile | undefined;
21
+ static isAvailable(): Promise<boolean>;
22
+ static isDaemonRunning(): Promise<boolean>;
23
+ static exec(args?: string[], options?: ExecOptions): Promise<number>;
24
+ static getExecOutput(args?: string[], options?: ExecOptions): Promise<ExecOutput>;
25
+ private static execOptions;
26
+ static context(name?: string): Promise<string>;
27
+ static contextInspect(name?: string): Promise<ContextInfo>;
28
+ static printVersion(): Promise<void>;
29
+ static printInfo(): Promise<void>;
30
+ static parseRepoTag(image: string): {
31
+ repository: string;
32
+ tag: string;
33
+ };
34
+ static pull(image: string, cache?: boolean): Promise<void>;
35
+ }
@@ -0,0 +1,199 @@
1
+ /**
2
+ * Copyright 2023 actions-toolkit authors
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import fs from 'fs';
17
+ import os from 'os';
18
+ import path from 'path';
19
+ import * as core from '@actions/core';
20
+ import * as io from '@actions/io';
21
+ import { Context } from '../context.js';
22
+ import { Cache } from '../cache.js';
23
+ import { Exec } from '../exec.js';
24
+ import { Util } from '../util.js';
25
+ export class Docker {
26
+ static get configDir() {
27
+ return process.env.DOCKER_CONFIG || path.join(os.homedir(), '.docker');
28
+ }
29
+ static configFile() {
30
+ const f = path.join(Docker.configDir, 'config.json');
31
+ if (!fs.existsSync(f)) {
32
+ return undefined;
33
+ }
34
+ return JSON.parse(fs.readFileSync(f, { encoding: 'utf-8' }));
35
+ }
36
+ static async isAvailable() {
37
+ return await io
38
+ .which('docker', true)
39
+ .then(res => {
40
+ core.debug(`Docker.isAvailable ok: ${res}`);
41
+ return true;
42
+ })
43
+ .catch(error => {
44
+ core.debug(`Docker.isAvailable error: ${error}`);
45
+ return false;
46
+ });
47
+ }
48
+ static async isDaemonRunning() {
49
+ try {
50
+ await Docker.getExecOutput([`version`], {
51
+ silent: true
52
+ });
53
+ return true;
54
+ }
55
+ catch {
56
+ return false;
57
+ }
58
+ }
59
+ static async exec(args, options) {
60
+ return Exec.exec('docker', args, Docker.execOptions(options));
61
+ }
62
+ static async getExecOutput(args, options) {
63
+ return Exec.getExecOutput('docker', args, Docker.execOptions(options));
64
+ }
65
+ static execOptions(options) {
66
+ if (!options) {
67
+ options = {};
68
+ }
69
+ if (!options.env) {
70
+ options.env = Object.assign({}, process.env, {
71
+ DOCKER_CONTENT_TRUST: 'false'
72
+ });
73
+ }
74
+ else {
75
+ options.env.DOCKER_CONTENT_TRUST = 'false';
76
+ }
77
+ return options;
78
+ }
79
+ static async context(name) {
80
+ const args = ['context', 'inspect', '--format', '{{.Name}}'];
81
+ if (name) {
82
+ args.push(name);
83
+ }
84
+ return await Docker.getExecOutput(args, {
85
+ ignoreReturnCode: true,
86
+ silent: true
87
+ }).then(res => {
88
+ if (res.stderr.length > 0 && res.exitCode != 0) {
89
+ throw new Error(res.stderr);
90
+ }
91
+ return res.stdout.trim();
92
+ });
93
+ }
94
+ static async contextInspect(name) {
95
+ const args = ['context', 'inspect', '--format=json'];
96
+ if (name) {
97
+ args.push(name);
98
+ }
99
+ return await Docker.getExecOutput(args, {
100
+ ignoreReturnCode: true,
101
+ silent: true
102
+ }).then(res => {
103
+ if (res.stderr.length > 0 && res.exitCode != 0) {
104
+ throw new Error(res.stderr.trim());
105
+ }
106
+ return JSON.parse(res.stdout.trim())[0];
107
+ });
108
+ }
109
+ static async printVersion() {
110
+ await Docker.exec(['version']);
111
+ }
112
+ static async printInfo() {
113
+ await Docker.exec(['info']);
114
+ }
115
+ static parseRepoTag(image) {
116
+ let sepPos;
117
+ const digestPos = image.indexOf('@');
118
+ const colonPos = image.lastIndexOf(':');
119
+ if (digestPos >= 0) {
120
+ // priority on digest
121
+ sepPos = digestPos;
122
+ }
123
+ else if (colonPos >= 0) {
124
+ sepPos = colonPos;
125
+ }
126
+ else {
127
+ return {
128
+ repository: image,
129
+ tag: 'latest'
130
+ };
131
+ }
132
+ const tag = image.slice(sepPos + 1);
133
+ if (tag.indexOf('/') === -1) {
134
+ return {
135
+ repository: image.slice(0, sepPos),
136
+ tag: tag
137
+ };
138
+ }
139
+ return {
140
+ repository: image,
141
+ tag: 'latest'
142
+ };
143
+ }
144
+ static async pull(image, cache) {
145
+ const parsedImage = Docker.parseRepoTag(image);
146
+ const repoSanitized = parsedImage.repository.replace(/[^a-zA-Z0-9.]+/g, '--');
147
+ const tagSanitized = parsedImage.tag.replace(/[^a-zA-Z0-9.]+/g, '--');
148
+ const imageCache = new Cache({
149
+ htcName: repoSanitized,
150
+ htcVersion: tagSanitized,
151
+ baseCacheDir: path.join(Docker.configDir, '.cache', 'images', repoSanitized),
152
+ cacheFile: 'image.tar'
153
+ });
154
+ let cacheFoundPath;
155
+ if (cache) {
156
+ cacheFoundPath = await imageCache.find();
157
+ if (cacheFoundPath) {
158
+ core.info(`Image found from cache in ${cacheFoundPath}`);
159
+ await Docker.getExecOutput(['load', '-i', cacheFoundPath], {
160
+ ignoreReturnCode: true
161
+ }).then(res => {
162
+ if (res.stderr.length > 0 && res.exitCode != 0) {
163
+ core.warning(`Failed to load image from cache: ${res.stderr.match(/(.*)\s*$/)?.[0]?.trim() ?? 'unknown error'}`);
164
+ }
165
+ });
166
+ }
167
+ }
168
+ let pulled = true;
169
+ await Docker.getExecOutput(['pull', image], {
170
+ ignoreReturnCode: true
171
+ }).then(res => {
172
+ if (res.stderr.length > 0 && res.exitCode != 0) {
173
+ pulled = false;
174
+ const err = res.stderr.match(/(.*)\s*$/)?.[0]?.trim() ?? 'unknown error';
175
+ if (cacheFoundPath) {
176
+ core.warning(`Failed to pull image, using one from cache: ${err}`);
177
+ }
178
+ else {
179
+ throw new Error(err);
180
+ }
181
+ }
182
+ });
183
+ if (cache && pulled) {
184
+ const imageTarPath = path.join(Context.tmpDir(), `${Util.hash(image)}.tar`);
185
+ await Docker.getExecOutput(['save', '-o', imageTarPath, image], {
186
+ ignoreReturnCode: true
187
+ }).then(async (res) => {
188
+ if (res.stderr.length > 0 && res.exitCode != 0) {
189
+ core.warning(`Failed to save image: ${res.stderr.match(/(.*)\s*$/)?.[0]?.trim() ?? 'unknown error'}`);
190
+ }
191
+ else {
192
+ const cachePath = await imageCache.save(imageTarPath);
193
+ core.info(`Image cached to ${cachePath}`);
194
+ }
195
+ });
196
+ }
197
+ }
198
+ }
199
+ //# sourceMappingURL=docker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"docker.js","sourceRoot":"","sources":["../../src/docker/docker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;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C,IAAI,CAAC,YAAY,CAAC,CAAC;oBACtD,IAAI,CAAC,IAAI,CAAC,mBAAmB,SAAS,EAAE,CAAC,CAAC;gBAC5C,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,85 @@
1
+ /**
2
+ * Copyright 2023 actions-toolkit authors
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { Regctl } from '../regclient/regctl.js';
17
+ import { Undock } from '../undock/undock.js';
18
+ import { GitHubRelease } from '../types/github/github.js';
19
+ export interface InstallSourceImage {
20
+ type: 'image';
21
+ tag: string;
22
+ }
23
+ export interface InstallSourceArchive {
24
+ type: 'archive';
25
+ version: string;
26
+ channel: string;
27
+ }
28
+ export type InstallSource = InstallSourceImage | InstallSourceArchive;
29
+ export interface InstallOpts {
30
+ source?: InstallSource;
31
+ runDir: string;
32
+ contextName?: string;
33
+ daemonConfig?: string;
34
+ rootless?: boolean;
35
+ localTCPPort?: number;
36
+ regctl?: Regctl;
37
+ undock?: Undock;
38
+ githubToken?: string;
39
+ }
40
+ interface LimaImage {
41
+ location: string;
42
+ arch: string;
43
+ digest?: string;
44
+ }
45
+ export declare class Install {
46
+ private readonly runDir;
47
+ private readonly source;
48
+ private readonly contextName;
49
+ private readonly daemonConfig?;
50
+ private readonly rootless;
51
+ private readonly localTCPPort?;
52
+ private readonly regctl;
53
+ private readonly undock;
54
+ private readonly githubToken?;
55
+ private _version;
56
+ private _toolDir;
57
+ private gitCommit;
58
+ private readonly limaInstanceName;
59
+ constructor(opts: InstallOpts);
60
+ get toolDir(): string;
61
+ download(): Promise<string>;
62
+ private downloadSourceImage;
63
+ private downloadSourceArchive;
64
+ install(): Promise<string>;
65
+ private installDarwin;
66
+ private installLinux;
67
+ private installWindows;
68
+ tearDown(): Promise<void>;
69
+ private tearDownDarwin;
70
+ private printDarwinDiagnostics;
71
+ private printDarwinGuestCommandOutput;
72
+ private tearDownLinux;
73
+ private tearDownWindows;
74
+ private downloadURL;
75
+ private static platformOS;
76
+ private static platformArch;
77
+ private static limaInstalled;
78
+ private static qemuBin;
79
+ private static qemuInstalled;
80
+ static getRelease(version: string, githubToken?: string): Promise<GitHubRelease>;
81
+ static limaCustomImages(): LimaImage[];
82
+ private imageConfig;
83
+ private brewInstall;
84
+ }
85
+ export {};