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 |
|
10 | An extension pack for an [Atomist][atomist]
|
11 | software delivery machine (SDM). See the
|
12 | [Atomist documentation][atomist-doc] for more information on the
|
13 | concept of a software delivery machine and how to create and develop
|
14 | an SDM.
|
15 |
|
16 | Send 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 |
|
22 | In your software delivery machine project:
|
23 |
|
24 | `npm install @atomist/sdm-pack-s3`
|
25 |
|
26 | then in your `machine.ts`:
|
27 |
|
28 | ```typescript
|
29 | import { 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 |
|
40 | If you need a build to happen before the publish, call `withProjectListener()` on that goal
|
41 | and pass a [GoalProjectListenerRegistration](https://docs.atomist.com/developer/goals-more/#prepare-the-checked-out-code).
|
42 |
|
43 | Add 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 |
|
56 | This pack contains a goal cache implementation that uses S3. This is useful to allow your goal caching solution to
|
57 | scale as you scale SDM instances.
|
58 |
|
59 | To enable use a configuration preProcessor:
|
60 | ```typescript
|
61 | preProcessors: [
|
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 |
|
76 | Required 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
|
80 | using IAM roles).
|
81 |
|
82 | ## Getting started
|
83 |
|
84 | See the [Developer Quick Start][atomist-quick] to jump straight to
|
85 | creating an SDM.
|
86 |
|
87 | [atomist-quick]: https://docs.atomist.com/quick-start/ (Atomist - Developer Quick Start)
|
88 |
|
89 | ## Support
|
90 |
|
91 | General support questions should be discussed in the `#support`
|
92 | channel in the [Atomist community Slack workspace][slack].
|
93 |
|
94 | If you find a problem, please create an [issue][].
|
95 |
|
96 | [issue]: https://github.com/atomist/sdm-pack-s3/issues
|
97 |
|
98 | ## Development
|
99 |
|
100 | See the [Atomist developer documentation][atomist-dev] for information
|
101 | on 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 |
|
107 | Releases are handled via the [Atomist SDM][atomist-sdm]. Just press
|
108 | the '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 |
|
114 | Created by [Atomist][atomist].
|
115 | Need 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)
|