@docker/actions-toolkit 0.1.0-beta.9 → 0.1.0-rc.1
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.
- package/README.md +3 -1
- package/lib/buildkit/buildkit.d.ts +4 -7
- package/lib/buildkit/buildkit.js +20 -38
- package/lib/buildkit/buildkit.js.map +1 -1
- package/lib/buildkit/config.d.ts +0 -3
- package/lib/buildkit/config.js +2 -4
- package/lib/buildkit/config.js.map +1 -1
- package/lib/buildx/bake.d.ts +29 -0
- package/lib/buildx/bake.js +74 -0
- package/lib/buildx/bake.js.map +1 -0
- package/lib/buildx/builder.d.ts +2 -4
- package/lib/buildx/builder.js +30 -14
- package/lib/buildx/builder.js.map +1 -1
- package/lib/buildx/buildx.d.ts +7 -10
- package/lib/buildx/buildx.js +47 -36
- package/lib/buildx/buildx.js.map +1 -1
- package/lib/buildx/inputs.d.ts +10 -13
- package/lib/buildx/inputs.js +24 -27
- package/lib/buildx/inputs.js.map +1 -1
- package/lib/buildx/install.d.ts +6 -8
- package/lib/buildx/install.js +61 -54
- package/lib/buildx/install.js.map +1 -1
- package/lib/context.d.ts +6 -7
- package/lib/context.js +18 -13
- package/lib/context.js.map +1 -1
- package/lib/docker/assets.d.ts +23 -0
- package/lib/docker/assets.js +339 -0
- package/lib/docker/assets.js.map +1 -0
- package/lib/{docker.d.ts → docker/docker.d.ts} +4 -3
- package/lib/{docker.js → docker/docker.js} +33 -39
- package/lib/docker/docker.js.map +1 -0
- package/lib/docker/install.d.ts +46 -0
- package/lib/docker/install.js +393 -0
- package/lib/docker/install.js.map +1 -0
- package/lib/exec.d.ts +20 -0
- package/lib/exec.js +68 -0
- package/lib/exec.js.map +1 -0
- package/lib/git.d.ts +10 -1
- package/lib/git.js +76 -34
- package/lib/git.js.map +1 -1
- package/lib/github.js +3 -5
- package/lib/github.js.map +1 -1
- package/lib/index.d.ts +24 -0
- package/lib/index.js +80 -0
- package/lib/index.js.map +1 -0
- package/lib/toolkit.d.ts +0 -2
- package/lib/toolkit.js +4 -6
- package/lib/toolkit.js.map +1 -1
- package/lib/types/bake.d.ts +42 -0
- package/lib/types/bake.js +18 -0
- package/lib/types/bake.js.map +1 -0
- package/lib/types/builder.d.ts +4 -9
- package/lib/types/git.d.ts +17 -0
- package/lib/types/git.js +18 -0
- package/lib/types/git.js.map +1 -0
- package/lib/util.d.ts +5 -0
- package/lib/util.js +30 -0
- package/lib/util.js.map +1 -1
- package/package.json +10 -5
- package/lib/docker.js.map +0 -1
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright 2023 actions-toolkit authors
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
18
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19
|
+
};
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.colimaYamlData = exports.dockerServiceLogsPs1Data = exports.setupDockerWinPs1Data = exports.setupDockerLinuxShData = exports.colimaYaml = exports.dockerServiceLogsPs1 = exports.setupDockerWinPs1 = exports.setupDockerLinuxSh = void 0;
|
|
22
|
+
const fs_1 = __importDefault(require("fs"));
|
|
23
|
+
const context_1 = require("../context");
|
|
24
|
+
const setupDockerLinuxSh = () => {
|
|
25
|
+
return get('docker-setup-linux.sh', exports.setupDockerLinuxShData, '0755');
|
|
26
|
+
};
|
|
27
|
+
exports.setupDockerLinuxSh = setupDockerLinuxSh;
|
|
28
|
+
const setupDockerWinPs1 = () => {
|
|
29
|
+
return get('docker-setup-win.ps1', exports.setupDockerWinPs1Data);
|
|
30
|
+
};
|
|
31
|
+
exports.setupDockerWinPs1 = setupDockerWinPs1;
|
|
32
|
+
const dockerServiceLogsPs1 = () => {
|
|
33
|
+
return get('docker-service-logs.ps1', exports.dockerServiceLogsPs1Data);
|
|
34
|
+
};
|
|
35
|
+
exports.dockerServiceLogsPs1 = dockerServiceLogsPs1;
|
|
36
|
+
const colimaYaml = () => {
|
|
37
|
+
return get('colima.yaml', exports.colimaYamlData);
|
|
38
|
+
};
|
|
39
|
+
exports.colimaYaml = colimaYaml;
|
|
40
|
+
const get = (filename, data, mode) => {
|
|
41
|
+
const assetPath = context_1.Context.tmpName({
|
|
42
|
+
template: `docker-asset-XXXXXX-${filename}`,
|
|
43
|
+
tmpdir: context_1.Context.tmpDir()
|
|
44
|
+
});
|
|
45
|
+
fs_1.default.writeFileSync(assetPath, data);
|
|
46
|
+
if (mode) {
|
|
47
|
+
fs_1.default.chmodSync(assetPath, mode);
|
|
48
|
+
}
|
|
49
|
+
return assetPath;
|
|
50
|
+
};
|
|
51
|
+
exports.setupDockerLinuxShData = `
|
|
52
|
+
#!/usr/bin/env bash
|
|
53
|
+
|
|
54
|
+
set -eu
|
|
55
|
+
|
|
56
|
+
: "\${TOOLDIR=}"
|
|
57
|
+
: "\${RUNDIR=}"
|
|
58
|
+
: "\${DOCKER_HOST=}"
|
|
59
|
+
|
|
60
|
+
export PATH="$TOOLDIR::$PATH"
|
|
61
|
+
|
|
62
|
+
if [ -z "$DOCKER_HOST" ]; then
|
|
63
|
+
echo >&2 'error: DOCKER_HOST required'
|
|
64
|
+
false
|
|
65
|
+
fi
|
|
66
|
+
|
|
67
|
+
if ! command -v dockerd &> /dev/null; then
|
|
68
|
+
echo >&2 'error: dockerd missing from PATH'
|
|
69
|
+
false
|
|
70
|
+
fi
|
|
71
|
+
|
|
72
|
+
mkdir -p "$RUNDIR"
|
|
73
|
+
|
|
74
|
+
(
|
|
75
|
+
echo "Starting dockerd"
|
|
76
|
+
set -x
|
|
77
|
+
exec dockerd \\
|
|
78
|
+
--host="$DOCKER_HOST" \\
|
|
79
|
+
--exec-root="$RUNDIR/execroot" \\
|
|
80
|
+
--data-root="$RUNDIR/data" \\
|
|
81
|
+
--pidfile="$RUNDIR/docker.pid" \\
|
|
82
|
+
--userland-proxy=false \\
|
|
83
|
+
2>&1 | tee "$RUNDIR/dockerd.log"
|
|
84
|
+
) &
|
|
85
|
+
`;
|
|
86
|
+
exports.setupDockerWinPs1Data = `
|
|
87
|
+
[CmdletBinding()]
|
|
88
|
+
param(
|
|
89
|
+
[Parameter(Mandatory = $true)]
|
|
90
|
+
[string]$ToolDir,
|
|
91
|
+
|
|
92
|
+
[Parameter(Mandatory = $true)]
|
|
93
|
+
[string]$RunDir,
|
|
94
|
+
|
|
95
|
+
[Parameter(Mandatory = $true)]
|
|
96
|
+
[string]$DockerHost)
|
|
97
|
+
|
|
98
|
+
$pwver = (Get-ItemProperty -Path HKLM:\\SOFTWARE\\Microsoft\\PowerShell\\3\\PowerShellEngine -Name 'PowerShellVersion').PowerShellVersion
|
|
99
|
+
Write-Host "PowerShell version: $pwver"
|
|
100
|
+
|
|
101
|
+
# Create run directory
|
|
102
|
+
New-Item -ItemType Directory "$RunDir" -ErrorAction SilentlyContinue | Out-Null
|
|
103
|
+
|
|
104
|
+
# Remove existing service
|
|
105
|
+
if (Get-Service docker -ErrorAction SilentlyContinue) {
|
|
106
|
+
$dockerVersion = (docker version -f "{{.Server.Version}}")
|
|
107
|
+
Write-Host "Current installed Docker version: $dockerVersion"
|
|
108
|
+
# stop service
|
|
109
|
+
Stop-Service -Force -Name docker
|
|
110
|
+
Write-Host "Service stopped"
|
|
111
|
+
# remove service
|
|
112
|
+
sc.exe delete "docker"
|
|
113
|
+
# removes event log entry. we could use "Remove-EventLog -LogName -Source docker"
|
|
114
|
+
# but this cmd is not available atm
|
|
115
|
+
$ErrorActionPreference = "SilentlyContinue"
|
|
116
|
+
& reg delete "HKLM\\SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\docker" /f 2>&1 | Out-Null
|
|
117
|
+
$ErrorActionPreference = "Stop"
|
|
118
|
+
Write-Host "Service removed"
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
$env:DOCKER_HOST = $DockerHost
|
|
122
|
+
Write-Host "DOCKER_HOST: $env:DOCKER_HOST"
|
|
123
|
+
|
|
124
|
+
Write-Host "Creating service"
|
|
125
|
+
New-Item -ItemType Directory "$RunDir\\moby-root" -ErrorAction SilentlyContinue | Out-Null
|
|
126
|
+
New-Item -ItemType Directory "$RunDir\\moby-exec" -ErrorAction SilentlyContinue | Out-Null
|
|
127
|
+
Start-Process -Wait -NoNewWindow "$ToolDir\\dockerd" \`
|
|
128
|
+
-ArgumentList \`
|
|
129
|
+
"--host=$DockerHost", \`
|
|
130
|
+
"--data-root=$RunDir\\moby-root", \`
|
|
131
|
+
"--exec-root=$RunDir\\moby-exec", \`
|
|
132
|
+
"--pidfile=$RunDir\\docker.pid", \`
|
|
133
|
+
"--register-service"
|
|
134
|
+
Write-Host "Starting service"
|
|
135
|
+
Start-Service -Name docker
|
|
136
|
+
Write-Host "Service started successfully!"
|
|
137
|
+
|
|
138
|
+
$tries=20
|
|
139
|
+
Write-Host "Waiting for Docker daemon to start..."
|
|
140
|
+
While ($true) {
|
|
141
|
+
$ErrorActionPreference = "SilentlyContinue"
|
|
142
|
+
& "$ToolDir\\docker" version | Out-Null
|
|
143
|
+
$ErrorActionPreference = "Stop"
|
|
144
|
+
If ($LastExitCode -eq 0) {
|
|
145
|
+
break
|
|
146
|
+
}
|
|
147
|
+
$tries--
|
|
148
|
+
If ($tries -le 0) {
|
|
149
|
+
Throw "Failed to get a response from Docker daemon"
|
|
150
|
+
}
|
|
151
|
+
Write-Host -NoNewline "."
|
|
152
|
+
Start-Sleep -Seconds 1
|
|
153
|
+
}
|
|
154
|
+
Write-Host "Docker daemon started successfully!"
|
|
155
|
+
`;
|
|
156
|
+
exports.dockerServiceLogsPs1Data = `
|
|
157
|
+
Get-WinEvent -ea SilentlyContinue \`
|
|
158
|
+
-FilterHashtable @{ProviderName= "docker"; LogName = "application"} |
|
|
159
|
+
Sort-Object @{Expression="TimeCreated";Descending=$false} |
|
|
160
|
+
ForEach-Object {"$($_.TimeCreated.ToUniversalTime().ToString("o")) [$($_.LevelDisplayName)] $($_.Message)"}
|
|
161
|
+
`;
|
|
162
|
+
exports.colimaYamlData = `
|
|
163
|
+
# Number of CPUs to be allocated to the virtual machine.
|
|
164
|
+
# Default: 2
|
|
165
|
+
cpu: 2
|
|
166
|
+
|
|
167
|
+
# Size of the disk in GiB to be allocated to the virtual machine.
|
|
168
|
+
# NOTE: changing this has no effect after the virtual machine has been created.
|
|
169
|
+
# Default: 60
|
|
170
|
+
disk: 60
|
|
171
|
+
|
|
172
|
+
# Size of the memory in GiB to be allocated to the virtual machine.
|
|
173
|
+
# Default: 2
|
|
174
|
+
memory: 2
|
|
175
|
+
|
|
176
|
+
# Architecture of the virtual machine (x86_64, aarch64, host).
|
|
177
|
+
# Default: host
|
|
178
|
+
arch: host
|
|
179
|
+
|
|
180
|
+
# Container runtime to be used (docker, containerd).
|
|
181
|
+
# Default: docker
|
|
182
|
+
runtime: docker
|
|
183
|
+
|
|
184
|
+
# Kubernetes configuration for the virtual machine.
|
|
185
|
+
kubernetes:
|
|
186
|
+
enabled: false
|
|
187
|
+
|
|
188
|
+
# Auto-activate on the Host for client access.
|
|
189
|
+
# Setting to true does the following on startup
|
|
190
|
+
# - sets as active Docker context (for Docker runtime).
|
|
191
|
+
# - sets as active Kubernetes context (if Kubernetes is enabled).
|
|
192
|
+
# Default: true
|
|
193
|
+
autoActivate: false
|
|
194
|
+
|
|
195
|
+
# Network configurations for the virtual machine.
|
|
196
|
+
network:
|
|
197
|
+
# Assign reachable IP address to the virtual machine.
|
|
198
|
+
# NOTE: this is currently macOS only and ignored on Linux.
|
|
199
|
+
# Default: false
|
|
200
|
+
address: false
|
|
201
|
+
|
|
202
|
+
# Custom DNS resolvers for the virtual machine.
|
|
203
|
+
#
|
|
204
|
+
# EXAMPLE
|
|
205
|
+
# dns: [8.8.8.8, 1.1.1.1]
|
|
206
|
+
#
|
|
207
|
+
# Default: []
|
|
208
|
+
dns: []
|
|
209
|
+
|
|
210
|
+
# DNS hostnames to resolve to custom targets using the internal resolver.
|
|
211
|
+
# This setting has no effect if a custom DNS resolver list is supplied above.
|
|
212
|
+
# It does not configure the /etc/hosts files of any machine or container.
|
|
213
|
+
# The value can be an IP address or another host.
|
|
214
|
+
#
|
|
215
|
+
# EXAMPLE
|
|
216
|
+
# dnsHosts:
|
|
217
|
+
# example.com: 1.2.3.4
|
|
218
|
+
dnsHosts:
|
|
219
|
+
host.docker.internal: host.lima.internal
|
|
220
|
+
|
|
221
|
+
# Network driver to use (slirp, gvproxy), (requires vmType \`qemu\`)
|
|
222
|
+
# - slirp is the default user mode networking provided by Qemu
|
|
223
|
+
# - gvproxy is an alternative to VPNKit based on gVisor https://github.com/containers/gvisor-tap-vsock
|
|
224
|
+
# Default: gvproxy
|
|
225
|
+
driver: gvproxy
|
|
226
|
+
|
|
227
|
+
# Forward the host's SSH agent to the virtual machine.
|
|
228
|
+
# Default: false
|
|
229
|
+
forwardAgent: false
|
|
230
|
+
|
|
231
|
+
# Docker daemon configuration that maps directly to daemon.json.
|
|
232
|
+
# https://docs.docker.com/engine/reference/commandline/dockerd/#daemon-configuration-file.
|
|
233
|
+
# NOTE: some settings may affect Colima's ability to start docker. e.g. \`hosts\`.
|
|
234
|
+
#
|
|
235
|
+
# EXAMPLE - disable buildkit
|
|
236
|
+
# docker:
|
|
237
|
+
# features:
|
|
238
|
+
# buildkit: false
|
|
239
|
+
#
|
|
240
|
+
# EXAMPLE - add insecure registries
|
|
241
|
+
# docker:
|
|
242
|
+
# insecure-registries:
|
|
243
|
+
# - myregistry.com:5000
|
|
244
|
+
# - host.docker.internal:5000
|
|
245
|
+
#
|
|
246
|
+
# Colima default behaviour: buildkit enabled
|
|
247
|
+
# Default: {}
|
|
248
|
+
docker: {}
|
|
249
|
+
|
|
250
|
+
# Virtual Machine type (qemu, vz)
|
|
251
|
+
# NOTE: this is macOS 13 only. For Linux and macOS <13.0, qemu is always used.
|
|
252
|
+
#
|
|
253
|
+
# vz is macOS virtualization framework and requires macOS 13
|
|
254
|
+
#
|
|
255
|
+
# Default: qemu
|
|
256
|
+
vmType: qemu
|
|
257
|
+
|
|
258
|
+
# Volume mount driver for the virtual machine (virtiofs, 9p, sshfs).
|
|
259
|
+
#
|
|
260
|
+
# virtiofs is limited to macOS and vmType \`vz\`. It is the fastest of the options.
|
|
261
|
+
#
|
|
262
|
+
# 9p is the recommended and the most stable option for vmType \`qemu\`.
|
|
263
|
+
#
|
|
264
|
+
# sshfs is faster than 9p but the least reliable of the options (when there are lots
|
|
265
|
+
# of concurrent reads or writes).
|
|
266
|
+
#
|
|
267
|
+
# Default: virtiofs (for vz), sshfs (for qemu)
|
|
268
|
+
mountType: 9p
|
|
269
|
+
|
|
270
|
+
# The CPU type for the virtual machine (requires vmType \`qemu\`).
|
|
271
|
+
# Options available for host emulation can be checked with: \`qemu-system-$(arch) -cpu help\`.
|
|
272
|
+
# Instructions are also supported by appending to the cpu type e.g. "qemu64,+ssse3".
|
|
273
|
+
# Default: host
|
|
274
|
+
cpuType: host
|
|
275
|
+
|
|
276
|
+
# For a more general purpose virtual machine, Ubuntu container is optionally provided
|
|
277
|
+
# as a layer on the virtual machine.
|
|
278
|
+
# The underlying virtual machine is still accessible via \`colima ssh --layer=false\` or running \`colima\` in
|
|
279
|
+
# the Ubuntu session.
|
|
280
|
+
#
|
|
281
|
+
# Default: false
|
|
282
|
+
layer: false
|
|
283
|
+
|
|
284
|
+
# Custom provision scripts for the virtual machine.
|
|
285
|
+
# Provisioning scripts are executed on startup and therefore needs to be idempotent.
|
|
286
|
+
#
|
|
287
|
+
# EXAMPLE - script exected as root
|
|
288
|
+
# provision:
|
|
289
|
+
# - mode: system
|
|
290
|
+
# script: apk add htop vim
|
|
291
|
+
#
|
|
292
|
+
# EXAMPLE - script exected as user
|
|
293
|
+
# provision:
|
|
294
|
+
# - mode: user
|
|
295
|
+
# script: |
|
|
296
|
+
# [ -f ~/.provision ] && exit 0;
|
|
297
|
+
# echo provisioning as $USER...
|
|
298
|
+
# touch ~/.provision
|
|
299
|
+
#
|
|
300
|
+
# Default: []
|
|
301
|
+
provision:
|
|
302
|
+
- mode: system
|
|
303
|
+
script: |
|
|
304
|
+
mkdir -p /tmp/docker-bins
|
|
305
|
+
cd /tmp/docker-bins
|
|
306
|
+
wget -qO- "https://download.docker.com/linux/static/{{dockerChannel}}/{{hostArch}}/docker-{{dockerVersion}}.tgz" | tar xvz --strip 1
|
|
307
|
+
mv -f /tmp/docker-bins/* /usr/bin/
|
|
308
|
+
|
|
309
|
+
# Modify ~/.ssh/config automatically to include a SSH config for the virtual machine.
|
|
310
|
+
# SSH config will still be generated in ~/.colima/ssh_config regardless.
|
|
311
|
+
# Default: true
|
|
312
|
+
sshConfig: false
|
|
313
|
+
|
|
314
|
+
# Configure volume mounts for the virtual machine.
|
|
315
|
+
# Colima mounts user's home directory by default to provide a familiar
|
|
316
|
+
# user experience.
|
|
317
|
+
#
|
|
318
|
+
# EXAMPLE
|
|
319
|
+
# mounts:
|
|
320
|
+
# - location: ~/secrets
|
|
321
|
+
# writable: false
|
|
322
|
+
# - location: ~/projects
|
|
323
|
+
# writable: true
|
|
324
|
+
#
|
|
325
|
+
# Colima default behaviour: $HOME and /tmp/colima are mounted as writable.
|
|
326
|
+
# Default: []
|
|
327
|
+
mounts: []
|
|
328
|
+
|
|
329
|
+
# Environment variables for the virtual machine.
|
|
330
|
+
#
|
|
331
|
+
# EXAMPLE
|
|
332
|
+
# env:
|
|
333
|
+
# KEY: value
|
|
334
|
+
# ANOTHER_KEY: another value
|
|
335
|
+
#
|
|
336
|
+
# Default: {}
|
|
337
|
+
env: {}
|
|
338
|
+
`;
|
|
339
|
+
//# sourceMappingURL=assets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assets.js","sourceRoot":"","sources":["../../src/docker/assets.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;;;AAEH,4CAAoB;AACpB,wCAAmC;AAE5B,MAAM,kBAAkB,GAAG,GAAW,EAAE;IAC7C,OAAO,GAAG,CAAC,uBAAuB,EAAE,8BAAsB,EAAE,MAAM,CAAC,CAAC;AACtE,CAAC,CAAC;AAFW,QAAA,kBAAkB,sBAE7B;AAEK,MAAM,iBAAiB,GAAG,GAAW,EAAE;IAC5C,OAAO,GAAG,CAAC,sBAAsB,EAAE,6BAAqB,CAAC,CAAC;AAC5D,CAAC,CAAC;AAFW,QAAA,iBAAiB,qBAE5B;AAEK,MAAM,oBAAoB,GAAG,GAAW,EAAE;IAC/C,OAAO,GAAG,CAAC,yBAAyB,EAAE,gCAAwB,CAAC,CAAC;AAClE,CAAC,CAAC;AAFW,QAAA,oBAAoB,wBAE/B;AAEK,MAAM,UAAU,GAAG,GAAW,EAAE;IACrC,OAAO,GAAG,CAAC,aAAa,EAAE,sBAAc,CAAC,CAAC;AAC5C,CAAC,CAAC;AAFW,QAAA,UAAU,cAErB;AAEF,MAAM,GAAG,GAAG,CAAC,QAAgB,EAAE,IAAY,EAAE,IAAa,EAAU,EAAE;IACpE,MAAM,SAAS,GAAG,iBAAO,CAAC,OAAO,CAAC;QAChC,QAAQ,EAAE,uBAAuB,QAAQ,EAAE;QAC3C,MAAM,EAAE,iBAAO,CAAC,MAAM,EAAE;KACzB,CAAC,CAAC;IACH,YAAE,CAAC,aAAa,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;IAClC,IAAI,IAAI,EAAE;QACR,YAAE,CAAC,SAAS,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;KAC/B;IACD,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AAEW,QAAA,sBAAsB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkCrC,CAAC;AAEW,QAAA,qBAAqB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqEpC,CAAC;AAEW,QAAA,wBAAwB,GAAG;;;;;CAKvC,CAAC;AAEW,QAAA,cAAc,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgL7B,CAAC"}
|
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
*/
|
|
16
16
|
export declare class Docker {
|
|
17
17
|
static get configDir(): string;
|
|
18
|
-
static
|
|
19
|
-
static
|
|
20
|
-
static
|
|
18
|
+
static isAvailable(): Promise<boolean>;
|
|
19
|
+
static context(name?: string): Promise<string>;
|
|
20
|
+
static printVersion(): Promise<void>;
|
|
21
|
+
static printInfo(): Promise<void>;
|
|
21
22
|
}
|
|
@@ -54,57 +54,51 @@ exports.Docker = void 0;
|
|
|
54
54
|
const os_1 = __importDefault(require("os"));
|
|
55
55
|
const path_1 = __importDefault(require("path"));
|
|
56
56
|
const core = __importStar(require("@actions/core"));
|
|
57
|
-
const
|
|
57
|
+
const io = __importStar(require("@actions/io"));
|
|
58
|
+
const exec_1 = require("../exec");
|
|
58
59
|
class Docker {
|
|
59
60
|
static get configDir() {
|
|
60
61
|
return process.env.DOCKER_CONFIG || path_1.default.join(os_1.default.homedir(), '.docker');
|
|
61
62
|
}
|
|
62
|
-
static
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
core.debug(`Docker.isAvailable error: ${
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
core.debug(`Docker.isAvailable ok`);
|
|
76
|
-
dockerAvailable = res.exitCode == 0;
|
|
77
|
-
}
|
|
78
|
-
})
|
|
79
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
80
|
-
.catch(error => {
|
|
81
|
-
core.debug(`Docker.isAvailable failed: ${error}`);
|
|
82
|
-
dockerAvailable = false;
|
|
63
|
+
static isAvailable() {
|
|
64
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
65
|
+
return yield io
|
|
66
|
+
.which('docker', true)
|
|
67
|
+
.then(res => {
|
|
68
|
+
core.debug(`Docker.isAvailable ok: ${res}`);
|
|
69
|
+
return true;
|
|
70
|
+
})
|
|
71
|
+
.catch(error => {
|
|
72
|
+
core.debug(`Docker.isAvailable error: ${error}`);
|
|
73
|
+
return false;
|
|
74
|
+
});
|
|
83
75
|
});
|
|
84
|
-
return dockerAvailable;
|
|
85
76
|
}
|
|
86
|
-
static
|
|
77
|
+
static context(name) {
|
|
87
78
|
return __awaiter(this, void 0, void 0, function* () {
|
|
88
|
-
const
|
|
89
|
-
if (
|
|
90
|
-
|
|
91
|
-
return;
|
|
79
|
+
const args = ['context', 'inspect', '--format', '{{.Name}}'];
|
|
80
|
+
if (name) {
|
|
81
|
+
args.push(name);
|
|
92
82
|
}
|
|
93
|
-
yield
|
|
94
|
-
|
|
83
|
+
return yield exec_1.Exec.getExecOutput(`docker`, args, {
|
|
84
|
+
ignoreReturnCode: true,
|
|
85
|
+
silent: true
|
|
86
|
+
}).then(res => {
|
|
87
|
+
if (res.stderr.length > 0 && res.exitCode != 0) {
|
|
88
|
+
throw new Error(res.stderr);
|
|
89
|
+
}
|
|
90
|
+
return res.stdout.trim();
|
|
95
91
|
});
|
|
96
92
|
});
|
|
97
93
|
}
|
|
98
|
-
static
|
|
94
|
+
static printVersion() {
|
|
99
95
|
return __awaiter(this, void 0, void 0, function* () {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
yield
|
|
106
|
-
failOnStdErr: false
|
|
107
|
-
});
|
|
96
|
+
yield exec_1.Exec.exec('docker', ['version']);
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
static printInfo() {
|
|
100
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
101
|
+
yield exec_1.Exec.exec('docker', ['info']);
|
|
108
102
|
});
|
|
109
103
|
}
|
|
110
104
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docker.js","sourceRoot":"","sources":["../../src/docker/docker.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,4CAAoB;AACpB,gDAAwB;AACxB,oDAAsC;AACtC,gDAAkC;AAClC,kCAA6B;AAE7B,MAAa,MAAM;IACjB,MAAM,KAAK,SAAS;QAClB,OAAO,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,cAAI,CAAC,IAAI,CAAC,YAAE,CAAC,OAAO,EAAE,EAAE,SAAS,CAAC,CAAC;IACzE,CAAC;IAEM,MAAM,CAAO,WAAW;;YAC7B,OAAO,MAAM,EAAE;iBACZ,KAAK,CAAC,QAAQ,EAAE,IAAI,CAAC;iBACrB,IAAI,CAAC,GAAG,CAAC,EAAE;gBACV,IAAI,CAAC,KAAK,CAAC,0BAA0B,GAAG,EAAE,CAAC,CAAC;gBAC5C,OAAO,IAAI,CAAC;YACd,CAAC,CAAC;iBACD,KAAK,CAAC,KAAK,CAAC,EAAE;gBACb,IAAI,CAAC,KAAK,CAAC,6BAA6B,KAAK,EAAE,CAAC,CAAC;gBACjD,OAAO,KAAK,CAAC;YACf,CAAC,CAAC,CAAC;QACP,CAAC;KAAA;IAEM,MAAM,CAAO,OAAO,CAAC,IAAa;;YACvC,MAAM,IAAI,GAAG,CAAC,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,CAAC,CAAC;YAC7D,IAAI,IAAI,EAAE;gBACR,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;aACjB;YACD,OAAO,MAAM,WAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,IAAI,EAAE;gBAC9C,gBAAgB,EAAE,IAAI;gBACtB,MAAM,EAAE,IAAI;aACb,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;gBACZ,IAAI,GAAG,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,IAAI,GAAG,CAAC,QAAQ,IAAI,CAAC,EAAE;oBAC9C,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;iBAC7B;gBACD,OAAO,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;YAC3B,CAAC,CAAC,CAAC;QACL,CAAC;KAAA;IAEM,MAAM,CAAO,YAAY;;YAC9B,MAAM,WAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;QACzC,CAAC;KAAA;IAEM,MAAM,CAAO,SAAS;;YAC3B,MAAM,WAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;QACtC,CAAC;KAAA;CACF;AAzCD,wBAyCC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
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 { GitHubRelease } from '../types/github';
|
|
17
|
+
export interface InstallOpts {
|
|
18
|
+
version?: string;
|
|
19
|
+
channel?: string;
|
|
20
|
+
runDir: string;
|
|
21
|
+
contextName?: string;
|
|
22
|
+
}
|
|
23
|
+
export declare class Install {
|
|
24
|
+
private readonly runDir;
|
|
25
|
+
private readonly version;
|
|
26
|
+
private readonly channel;
|
|
27
|
+
private readonly contextName;
|
|
28
|
+
private _version;
|
|
29
|
+
private _toolDir;
|
|
30
|
+
constructor(opts: InstallOpts);
|
|
31
|
+
get toolDir(): string;
|
|
32
|
+
download(): Promise<string>;
|
|
33
|
+
install(): Promise<void>;
|
|
34
|
+
private installDarwin;
|
|
35
|
+
private installLinux;
|
|
36
|
+
private installWindows;
|
|
37
|
+
tearDown(): Promise<void>;
|
|
38
|
+
private tearDownDarwin;
|
|
39
|
+
private tearDownLinux;
|
|
40
|
+
private tearDownWindows;
|
|
41
|
+
private downloadURL;
|
|
42
|
+
private static platformOS;
|
|
43
|
+
private static platformArch;
|
|
44
|
+
private static colimaInstalled;
|
|
45
|
+
static getRelease(version: string): Promise<GitHubRelease>;
|
|
46
|
+
}
|