1.5.2 • Published 2 years ago

@balena/transformer-runtime v1.5.2

Weekly downloads
-
License
UNLICENSED
Repository
github
Last release
2 years ago

ProductOS Transformer Runtime Package

This package encodes the basic rules for running transformers. This package allows you to obtain the minimal functionality to run a transformer by providing input, artifact, and output targets.

Example Usage

Run a transformer of image example-image:latest which has been pulled before:

import TransformerRuntime from '../src';
import * as yaml from 'js-yaml';
import * as fs from 'fs';
import * as path from 'path';
import { Contract } from '@balena/jellyfish-types/build/core';
import testTransformer from './test-transformer';

const runtime = new TransformerRuntime();

const img = 'example-image';
const version = 'latest';

const artifactDir = path.join(__dirname, 'artifactDir');
const workingDir = path.join(__dirname, 'in');
const transformerImage = `${img}:${version}`;
const outputDir = path.join(__dirname, 'out');
const runPrivileged = true;
const content = fs
	.readFileSync(path.join(artifactDir, '/balena.yml'))
	.toString();
const contract = yaml.load(content) as Contract;

async function main() {
	const result = await runtime.runTransformer(
		artifactDir,
		contract,
		testTransformer,
		transformerImage,
		workingDir,
		outputDir,
		runPrivileged
	);
}

main().catch(err => {
	console.log("error executing your transformer:", err);
	process.exit(1);
});

Create your own transformer

You can follow the tutorial here to create your own transformer

1.5.2

2 years ago

1.5.1

2 years ago

1.4.5

2 years ago

1.4.4

2 years ago

1.4.3

2 years ago

1.4.2

2 years ago

1.4.1

2 years ago

1.4.0

2 years ago

1.5.0

2 years ago

1.0.0

2 years ago

0.2.0

2 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago