pakstr 0.24.0 → 0.25.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
CHANGED
|
@@ -76,6 +76,21 @@ npm run build
|
|
|
76
76
|
npx pakstr run
|
|
77
77
|
```
|
|
78
78
|
|
|
79
|
+
**If your CI runs the job inside a sandbox with its own kernel** - a Kata microVM, or any
|
|
80
|
+
runner where the job container is given no host Docker socket - the job has to start its
|
|
81
|
+
own Docker daemon, and that daemon's default bridge cannot be brought up inside the
|
|
82
|
+
sandbox. Set `PAKSTR_DOCKER_NETWORK=host` so every container pakstr creates joins the
|
|
83
|
+
sandbox's own network namespace instead:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
PAKSTR_DOCKER_NETWORK=host npx pakstr run
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
It applies to the build container, the signing container and the short-lived copy
|
|
90
|
+
containers alike, because all of them are created the same way. Leave it unset on a
|
|
91
|
+
workstation, where Docker's default network is what you want - host networking is not
|
|
92
|
+
available on Docker Desktop for macOS.
|
|
93
|
+
|
|
79
94
|
---
|
|
80
95
|
|
|
81
96
|
## Documentation & License
|
|
@@ -8,6 +8,7 @@ const fs_1 = __importDefault(require("fs"));
|
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
const crypto_1 = require("crypto");
|
|
10
10
|
const process_1 = require("./process");
|
|
11
|
+
const dockerNetwork_1 = require("./dockerNetwork");
|
|
11
12
|
const CONTAINER_RELEASE_APK_SIGNED = "/workspace/app/build/outputs/apk/release/app-release.apk";
|
|
12
13
|
const CONTAINER_RELEASE_APK_UNSIGNED = "/workspace/app/build/outputs/apk/release/app-release-unsigned.apk";
|
|
13
14
|
const CONTAINER_DEBUG_APK = "/workspace/app/build/outputs/apk/debug/app-debug.apk";
|
|
@@ -57,6 +58,7 @@ class DockerGradleRunner {
|
|
|
57
58
|
this.execute("docker", [
|
|
58
59
|
"run",
|
|
59
60
|
"--rm",
|
|
61
|
+
...(0, dockerNetwork_1.dockerNetworkArgs)(),
|
|
60
62
|
"-v",
|
|
61
63
|
`${storage.workspaceVolume}:/workspace`,
|
|
62
64
|
this.image,
|
|
@@ -74,6 +76,7 @@ class DockerGradleRunner {
|
|
|
74
76
|
this.execute("docker", [
|
|
75
77
|
"run",
|
|
76
78
|
"--rm",
|
|
79
|
+
...(0, dockerNetwork_1.dockerNetworkArgs)(),
|
|
77
80
|
"-v",
|
|
78
81
|
`${storage.workspaceVolume}:/workspace`,
|
|
79
82
|
this.image,
|
|
@@ -112,6 +115,7 @@ class DockerGradleRunner {
|
|
|
112
115
|
try {
|
|
113
116
|
this.execute("docker", [
|
|
114
117
|
"create",
|
|
118
|
+
...(0, dockerNetwork_1.dockerNetworkArgs)(),
|
|
115
119
|
"--name",
|
|
116
120
|
container,
|
|
117
121
|
"-v",
|
|
@@ -132,6 +136,7 @@ class DockerGradleRunner {
|
|
|
132
136
|
try {
|
|
133
137
|
this.execute("docker", [
|
|
134
138
|
"create",
|
|
139
|
+
...(0, dockerNetwork_1.dockerNetworkArgs)(),
|
|
135
140
|
"--name",
|
|
136
141
|
container,
|
|
137
142
|
"-v",
|
|
@@ -10,6 +10,7 @@ const fs_1 = __importDefault(require("fs"));
|
|
|
10
10
|
const os_1 = __importDefault(require("os"));
|
|
11
11
|
const path_1 = __importDefault(require("path"));
|
|
12
12
|
const process_1 = require("./process");
|
|
13
|
+
const dockerNetwork_1 = require("./dockerNetwork");
|
|
13
14
|
class DockerSignRunner {
|
|
14
15
|
image;
|
|
15
16
|
execute;
|
|
@@ -53,6 +54,7 @@ class DockerSignRunner {
|
|
|
53
54
|
const stdout = this.execute("docker", [
|
|
54
55
|
"run",
|
|
55
56
|
"--rm",
|
|
57
|
+
...(0, dockerNetwork_1.dockerNetworkArgs)(),
|
|
56
58
|
"--tmpfs",
|
|
57
59
|
"/signing:mode=0700,uid=0",
|
|
58
60
|
"-v",
|
|
@@ -122,6 +124,7 @@ class DockerSignRunner {
|
|
|
122
124
|
try {
|
|
123
125
|
this.execute("docker", [
|
|
124
126
|
"create",
|
|
127
|
+
...(0, dockerNetwork_1.dockerNetworkArgs)(),
|
|
125
128
|
"--name",
|
|
126
129
|
container,
|
|
127
130
|
"-v",
|
|
@@ -145,6 +148,7 @@ class DockerSignRunner {
|
|
|
145
148
|
try {
|
|
146
149
|
this.execute("docker", [
|
|
147
150
|
"create",
|
|
151
|
+
...(0, dockerNetwork_1.dockerNetworkArgs)(),
|
|
148
152
|
"--name",
|
|
149
153
|
container,
|
|
150
154
|
"-v",
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.dockerNetworkArgs = dockerNetworkArgs;
|
|
4
|
+
/**
|
|
5
|
+
* The `--network` value passed to every container pakstr creates, read from
|
|
6
|
+
* PAKSTR_DOCKER_NETWORK.
|
|
7
|
+
*
|
|
8
|
+
* Unset means Docker's own default, which is what a workstation wants. A CI
|
|
9
|
+
* runner that sandboxes the job inside its own kernel needs the override: there
|
|
10
|
+
* the daemon's default bridge cannot be brought up - attaching a container to it
|
|
11
|
+
* writes to /proc/sys, which the sandbox exposes read-only - so `--network=host`
|
|
12
|
+
* puts the container in the sandbox's own network namespace instead, and the
|
|
13
|
+
* container inherits the resolvers the daemon itself uses.
|
|
14
|
+
*
|
|
15
|
+
* It is applied to `docker create` as well as `docker run`, because the workspace
|
|
16
|
+
* and artifact copy containers are created the same way and meet the same wall.
|
|
17
|
+
*/
|
|
18
|
+
function dockerNetworkArgs() {
|
|
19
|
+
const network = process.env.PAKSTR_DOCKER_NETWORK?.trim();
|
|
20
|
+
return network ? ["--network", network] : [];
|
|
21
|
+
}
|