JSPM

  • Created
  • Published
  • Downloads 3
  • Score
    100M100P100Q138982F
  • License Apache-2.0

Atomist SDM Pack Event Relay

Package Exports

  • @atomist/sdm-pack-event-relay

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@atomist/sdm-pack-event-relay) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@atomist/sdm-pack-event-relay

This extension pack allows an SDM to function as an event relay between event sources and Cortex. Reasons for doing this include air-gapped services and needing to "scrub" data from outbound payloads.

An example configuration for a relay configuration:

 const bitbucketRelay: EventRelayer<BitbucketTestData> = {
     name: "bitbucketRelay",
     test: payload => !!payload.body.actor && !!payload.body.date && !!payload.body.eventKey,
     processor: async payload => {
         (payload.body as any)["x-bitbucket-type"] = payload.headers["x-event-key"];
         return {body: payload.body, headers: payload.headers};
     },
     targetEvent: {
         eventType: "public",
         eventTarget: sdm.configuration.sdm.git.webhookdest,
         headers: (ctx, payload) => {
             payload.headers = addAtomistSignatureHeader(
                 sdm.configuration.sdm.git.key,
                 payload.body,
                 payload.headers as HttpClientOptions["headers"],
             );
             return payload.headers as HttpClientOptions["headers"];
         },
     },
 };

sdm.addExtensionPacks(
    eventRelaySupport({
        eventRelayers: [
            bitbucketRelay,
        ],
    }),
);

See the EventRelayer interface for details on creating EventRelayer(s). For details on the extension pack configuration, see the eventRelaySupport type documentation.

Disabling Authentication Requirement

By default the event relay pack uses the Atomist API key configured to authorize incoming relay requests. This key must be supplied in an authorization header (as a bearer token). However, this is not appropriate for all use cases. To disable the authentication requirement set authRequired to false in the eventRelaySupport options.

Getting started

See the Developer Quick Start to jump straight to creating an SDM.

Contributing

Contributions to this project from community members are encouraged and appreciated. Please review the Contributing Guidelines for more information. Also see the Development section in this document.

Code of conduct

This project is governed by the Code of Conduct. You are expected to act in accordance with this code by participating. Please report any unacceptable behavior to code-of-conduct@atomist.com.

Documentation

Please see docs.atomist.com for developer documentation.

Connect

Follow @atomist and The Composition blog related to SDM.

Support

General support questions should be discussed in the #support channel in the Atomist community Slack workspace.

If you find a problem, please create an issue.

Development

You will need to install Node.js to build and test this project.

Build and test

Install dependencies.

$ npm install

Use the build package script to compile, test, lint, and build the documentation.

$ npm run build

Release

Releases are handled via the Atomist SDM. Just press the 'Approve' button in the Atomist dashboard or Slack.


Created by Atomist. Need Help? Join our Slack workspace.