@toa.io/operations 1.0.0-alpha.18 → 1.0.0-alpha.19
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/package.json +6 -6
- package/src/deployment/registry.js +7 -13
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@toa.io/operations",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.19",
|
|
4
4
|
"description": "Toa Deployment",
|
|
5
5
|
"homepage": "https://toa.io",
|
|
6
6
|
"author": {
|
|
@@ -27,12 +27,12 @@
|
|
|
27
27
|
"test": "echo \"Error: run tests from root\" && exit 1"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@toa.io/filesystem": "1.0.0-alpha.
|
|
31
|
-
"@toa.io/generic": "1.0.0-alpha.
|
|
32
|
-
"@toa.io/norm": "1.0.0-alpha.
|
|
33
|
-
"@toa.io/yaml": "1.0.0-alpha.
|
|
30
|
+
"@toa.io/filesystem": "1.0.0-alpha.19",
|
|
31
|
+
"@toa.io/generic": "1.0.0-alpha.19",
|
|
32
|
+
"@toa.io/norm": "1.0.0-alpha.19",
|
|
33
|
+
"@toa.io/yaml": "1.0.0-alpha.19",
|
|
34
34
|
"execa": "5.1.1",
|
|
35
35
|
"fs-extra": "11.1.1"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "03c7af7e331dd5774ee53c0e9530535357bac8d2"
|
|
38
38
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
3
|
const workspace = require('./workspace')
|
|
4
|
+
const { newid } = require('@toa.io/generic')
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* @implements {toa.deployment.Registry}
|
|
@@ -87,11 +88,11 @@ class Registry {
|
|
|
87
88
|
|
|
88
89
|
if (multiarch) {
|
|
89
90
|
const platform = this.#registry.platforms.join(',')
|
|
91
|
+
const builder = await this.#createBuilder()
|
|
90
92
|
|
|
91
93
|
args.push('--platform', platform)
|
|
92
|
-
args.push('--builder',
|
|
94
|
+
args.push('--builder', builder)
|
|
93
95
|
|
|
94
|
-
await this.#ensureBuilder()
|
|
95
96
|
} else {
|
|
96
97
|
args.push('--builder', 'default')
|
|
97
98
|
}
|
|
@@ -105,20 +106,13 @@ class Registry {
|
|
|
105
106
|
await this.#build(image, true)
|
|
106
107
|
}
|
|
107
108
|
|
|
108
|
-
async #ensureBuilder () {
|
|
109
|
-
const ls = 'buildx ls'.split(' ')
|
|
110
|
-
const output = await this.#process.execute('docker', ls, { silently: true })
|
|
111
|
-
const exists = output.split('\n').findIndex((line) => line.startsWith('toa '))
|
|
112
|
-
|
|
113
|
-
if (exists === -1) await this.#createBuilder()
|
|
114
|
-
}
|
|
115
|
-
|
|
116
109
|
async #createBuilder () {
|
|
117
|
-
const
|
|
118
|
-
const
|
|
110
|
+
const name = `toa-${newid()}`
|
|
111
|
+
const create = `buildx create --name ${name} --bootstrap --use`.split(' ')
|
|
119
112
|
|
|
120
113
|
await this.#process.execute('docker', create)
|
|
121
|
-
|
|
114
|
+
|
|
115
|
+
return name
|
|
122
116
|
}
|
|
123
117
|
}
|
|
124
118
|
|