UNPKG

3.7 kBMarkdownView Raw
1<p align="center">
2 <img src="https://images.atomist.com/sdm/SDM-Logo-Dark.png">
3</p>
4
5# @atomist/sdm-pack-s3
6
7[![atomist sdm goals](https://badge.atomist.com/T29E48P34/atomist/sdm-pack-s3/728dec9b-f3d3-4363-a09c-a0a017f2074c)](https://app.atomist.com/workspace/T29E48P34)
8[![npm version](https://img.shields.io/npm/v/@atomist/sdm-pack-s3.svg)](https://www.npmjs.com/package/@atomist/sdm-pack-s3)
9
10An extension pack for an [Atomist][atomist]
11software delivery machine (SDM). See the
12[Atomist documentation][atomist-doc] for more information on the
13concept of a software delivery machine and how to create and develop
14an SDM.
15
16Send your project's build output to S3 using the `publishToS3` goal.
17
18[atomist-doc]: https://docs.atomist.com/ (Atomist Documentation)
19
20## Using
21
22In your software delivery machine project:
23
24`npm install @atomist/sdm-pack-s3`
25
26then in your `machine.ts`:
27
28```typescript
29import { publishToS3Goal } from "@atomist/sdm-pack-s3";
30
31 const publish = publishToS3Goal({
32 bucketName: "your-bucket-name",
33 region: "us-west-2", // use your region
34 filesToPublish: ["site/**/*.html", "more/files/to/publish"],
35 pathTranslation: (filepath, inv) => filepath, // rearrange files if necessary
36 pathToIndex: "site/index.html", // index file in your project
37 });
38```
39
40If you need a build to happen before the publish, call `withProjectListener()` on that goal
41and pass a [GoalProjectListenerRegistration](https://docs.atomist.com/developer/goals-more/#prepare-the-checked-out-code).
42
43Add this publish goal to one of your goal sets.
44
45```typescript
46 const publishGoals = goals("publish static site to S3")
47 .plan(publish);
48
49 sdm.withPushRules(
50 whenPushSatisfies(requestsUploadToS3).setGoals(publishGoals),
51 );
52```
53
54## Using S3 Goal Caching Support
55
56This pack contains a goal cache implementation that uses S3. This is useful to allow your goal caching solution to
57scale as you scale SDM instances.
58
59To enable use a configuration preProcessor:
60```typescript
61preProcessors: [
62 async cfg => {
63 return _.merge(cfg, {
64 sdm: {
65 cache: {
66 enabled: true,
67 bucket: "mytest-bucket",
68 store: new CompressingGoalCache(new S3GoalCacheArchiveStore()),
69 },
70 },
71 });
72 },
73 ],
74```
75
76Required configuration for `S3GoalCacheArchiveStore`:
77
78* Bucket: (shown above) Used to set the S3 bucket to upload data to
79* AWS Credentials. These should be available either in the environment or through the metadata service (in the case of
80using IAM roles).
81
82## Getting started
83
84See the [Developer Quick Start][atomist-quick] to jump straight to
85creating an SDM.
86
87[atomist-quick]: https://docs.atomist.com/quick-start/ (Atomist - Developer Quick Start)
88
89## Support
90
91General support questions should be discussed in the `#support`
92channel in the [Atomist community Slack workspace][slack].
93
94If you find a problem, please create an [issue][].
95
96[issue]: https://github.com/atomist/sdm-pack-s3/issues
97
98## Development
99
100See the [Atomist developer documentation][atomist-dev] for information
101on how to write your own SDM features and automations.
102
103[atomist-dev]: https://docs.atomist.com/developer/ (Atomist Developer Documentation)
104
105### Release
106
107Releases are handled via the [Atomist SDM][atomist-sdm]. Just press
108the 'Approve' button in the Atomist dashboard or Slack.
109
110[atomist-sdm]: https://github.com/atomist/atomist-sdm (Atomist Software Delivery Machine)
111
112---
113
114Created by [Atomist][atomist].
115Need Help? [Join our Slack workspace][slack].
116
117[atomist]: https://atomist.com/ (Atomist - How Teams Deliver Software)
118[slack]: https://join.atomist.com/ (Atomist Community Slack)