Skip to content

Commit 5c50d19

Browse files
committed
VERSION
1 parent 24f68ef commit 5c50d19

File tree

2 files changed

+10
-53
lines changed

2 files changed

+10
-53
lines changed

lib/dotetch/index.ts

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,8 @@ import { ExtendedManifests, Image } from './interface-manifest';
44
import { computeDockerLayers, streamDockerLayers, Layer } from './layers';
55
import { AxiosBasicCredentials } from "axios";
66

7-
interface ManifestV1 {
8-
version: "1.0",
9-
baseImage?: {
10-
type: "stream";
11-
location: string;
12-
},
13-
inject?: [{
14-
type: "stream";
15-
location: string;
16-
targetPartition: number;
17-
}]
18-
}
7+
/** dotEtch version, will be sent as the first file on stream */
8+
const VERSION = '1.0'
199

2010
/**
2111
* Main Processing function
@@ -56,20 +46,19 @@ const promisePacker =
5646
* Prepare Etch Stream
5747
* Create the stream to be use by all other function
5848
* @param outputStream Writable output stream (can be a file or http response or ...)
59-
* @param manifest A dotEtch manifest
6049
* @returns tar-stream pack writable stream
6150
*/
62-
const prepareEtchStream = async (manifest: ManifestV1): Promise<Pack> => {
51+
const prepareEtchStream = async (): Promise<Pack> => {
6352
const packStream = pack();
6453

6554
// stream manifest
6655
const packer = promisePacker(packStream);
6756
await packer(
6857
{
69-
name: `/manifest.json`,
58+
name: `/VERSION`,
7059
mode: 777,
7160
},
72-
JSON.stringify(manifest)
61+
VERSION
7362
);
7463

7564
console.log("==> dotEtch Stream Ready @prepareEtchStream");

lib/dotetch/readme.md

Lines changed: 5 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Entry is `index.ts`
66

77
You're responsible for managing the lifecycle :
88

9-
1. call `prepareEtchStream` with a manifest, it will return a "PackStream" [which is a `pack` from tar-stream](https://github.com/mafintosh/tar-stream).
9+
1. call `prepareEtchStream`, it will return a "PackStream" [which is a `pack` from tar-stream](https://github.com/mafintosh/tar-stream).
1010
2. pipe the stream from 1. to an output `packStream.pipe(outputStream)` (output stream can be a file, a http response, ...)
1111
3. call `startEtchStream` with those mandatory parameters :
1212
- `packStream` (from previous step)
@@ -33,40 +33,8 @@ Therefore we have built an on-stream docker pull replacement which can be called
3333
You first need to get the manifests for all images using `getManifestsForImages`.
3434
If your images are not public, you'll need to provide authentication, either a bearer token or a `{username: string, password: string}` basic auth object to retrieve your manifests and images.
3535

36-
## Manifest
37-
The dotEtch manifest which describe the stream content.
38-
39-
So far we only have one version which is a json and looks like this:
40-
```json
41-
{
42-
"version": "1.0",
43-
"baseImage": {
44-
"type": "stream",
45-
"location": _string_
46-
},
47-
"inject": [{
48-
"type": "stream",
49-
"location": _string_,
50-
"targetPartition": _number_,
51-
}]
52-
}
53-
```
54-
55-
Where :
56-
- `type` currently only support stream (which means the data will be part of the same dotetch stream); next version should support "url" to fetch remote data.
57-
- `location` is a string that indicate where (relative to the stream) the package is locate. I.E. :
58-
- `targetPartition` is the number of the partition the injectable files should go
59-
60-
```
61-
"version": "1.0",
62-
"baseImage": {
63-
"type": "stream",
64-
"location": "/balenaos.img"
65-
}
66-
"inject": [{
67-
"type": "stream",
68-
"location": "/inject/6",
69-
"targetPartition": 6
70-
}]
71-
```
36+
## VERSION
37+
First file pushed on the stream is `VERSION`. It contains a single string in the format `major:minor` (i.e. `1.0`).
38+
It indicate to consumer what feature will be supported.
7239

40+
Minors should be compatible and majors indicates breaking changes.

0 commit comments

Comments
 (0)