🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

cloudbuild-task-contracts

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cloudbuild-task-contracts

Abstractions that most/all cloud build services can fulfill in order to allow the development of tasks for submission to the various cloud build marketplaces while maintaining primarily just one codebase.

0.1.122-beta
Source
npm
Version published
Weekly downloads
3
200%
Maintainers
1
Weekly downloads
 
Created
Source

cloudbuild-task-contracts

These NPM packages are typed with TypeScript MIT license Required Node

This package defines a common abstraction around potentially any cloud build (PR/CI build system) that defines special 'tasks' that may take inputs and perform built-in operations.

This abstraction allows a task to be written just once against the abstraction and then built for many CI systems.

Example adapter packages include support for:

  • GitHub Actions
  • Azure Pipelines
  • Local runner which lets you run/test your task locally (with no CI system at all).

Example usage

Write your task's function without a dependency on GitHub Actions, Azure Pipelines, or any other CI specific NPM package, leveraging this abstraction package:

import { CloudTask } from 'cloudbuild-task-contracts';

export function run(cloudTask: CloudTask) {
  const name = cloudTask.inputs.getInput('name');
  cloudTask.log.error(`That is not an acceptable name: ${name}.`);
  cloudTask.result.setFailed('Invalid input parameter.');
}

The above is just a small sampling of the APIs available through this abstraction.

When it's time to run this task within a particular CI system, it's trivially easy. For example, running the above task as a GitHub Action is as simple as this:

import { factory } from 'cloudbuild-task-github-actions';
import { run } from './MyPortableTask';

run(factory);

FAQs

Package last updated on 13 Jan 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts