SDM extension pack for publishing artifacts to AWS S3


Keywords
atomist, automation, aws, pack, s3, sdm, node
License
Apache-2.0
Install
npm install @atomist/sdm-pack-s3@0.5.1-ipcrm-add-registrations.20190916040118

Documentation

@atomist/sdm-pack-s3

atomist sdm goals npm version

An extension pack for an Atomist software delivery machine (SDM). See the Atomist documentation for more information on the concept of a software delivery machine and how to create and develop an SDM.

Send your project's build output to S3 using the publishToS3 goal.

Using

In your software delivery machine project:

npm install @atomist/sdm-pack-s3

then in your machine.ts:

import { publishToS3Goal } from "@atomist/sdm-pack-s3";

    const publish = publishToS3Goal({
        bucketName: "your-bucket-name",
        region: "us-west-2", // use your region
        filesToPublish: ["site/**/*.html", "more/files/to/publish"],
        pathTranslation: (filepath, inv) => filepath, // rearrange files if necessary
        pathToIndex: "site/index.html", // index file in your project
    });

If you need a build to happen before the publish, call withProjectListener() on that goal and pass a GoalProjectListenerRegistration.

Add this publish goal to one of your goal sets.

    const publishGoals = goals("publish static site to S3")
        .plan(publish);

    sdm.withPushRules(
        whenPushSatisfies(requestsUploadToS3).setGoals(publishGoals),
    );

Using S3 Goal Caching Support

This pack contains a goal cache implementation that uses S3. This is useful to allow your goal caching solution to scale as you scale SDM instances.

To enable use a configuration preProcessor:

preProcessors: [
    async cfg => {
      return _.merge(cfg, {
        sdm: {
          cache: {
            enabled: true,
            bucket: "mytest-bucket",
            store:  new CompressingGoalCache(new S3GoalCacheArchiveStore()),
          },
        },
      });
    },
  ],

Required configuration for S3GoalCacheArchiveStore:

  • Bucket: (shown above) Used to set the S3 bucket to upload data to
  • AWS Credentials. These should be available either in the environment or through the metadata service (in the case of using IAM roles).

Getting started

See the Developer Quick Start to jump straight to creating an 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

See the Atomist developer documentation for information on how to write your own SDM features and automations.

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.