forked from helm/helm-www
-
Notifications
You must be signed in to change notification settings - Fork 0
/
brigade.js
66 lines (59 loc) · 2.19 KB
/
brigade.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
const { events, Job, Group } = require("brigadier");
const timeout = 600000 * 20;
events.on("push", generateSite)
events.on("exec", generateSite)
function generateSite (e, p) {
const docsOut = "/mnt/brigade/share/docs.helm.sh"
const helmOut = "/mnt/brigade/share/helm.sh"
const bucket = "https://helmshprod.blob.core.windows.net"
// This job renders docs.helm.sh
const buildDocs = new Job("docs-helm-sh", "node:10");
buildDocs.timeout = timeout
buildDocs.storage.enabled = true
buildDocs.env = {
HUGO_VERSION: "0.36"
}
buildDocs.tasks = [
"apt-get update -y && apt-get install -yq ruby ruby-dev",
"gem install sass",
"curl -L https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_${HUGO_VERSION}_Linux-64bit.tar.gz | tar -xz -C /usr/local/bin hugo",
"cd /src/docs.helm.sh",
"yarn install",
"$(yarn bin)/gulp clonedocs",
"$(yarn bin)/gulp build",
`mkdir -p ${docsOut}`,
`hugo -d ${docsOut}`,
];
// This job renders helm.sh
const buildHelmSh = new Job("helm-sh", "ruby:2.3.7");
buildHelmSh.timeout = timeout
buildHelmSh.storage.enabled = true
buildHelmSh.tasks = [
"curl -sL https://deb.nodesource.com/setup_9.x | bash -",
"apt-get install -y nodejs",
"npm install -g gulp",
"gem install bundler",
"gem install nokogiri -v '1.8.1'", // This is a temporary fix for an install problem
"cd /src/helm.sh/",
"bundle install",
"npm install",
"gulp",
`mkdir -p ${helmOut}`,
`bundle exec jekyll build -d ${helmOut}`
];
// This job uploads all of the rendered resources into Azure Blob Storage
const az = new Job("az", "azuresdk/azure-cli-python:latest")
az.storage.enabled = true
az.env = {
AZURE_STORAGE_CONNECTION_STRING: p.secrets.bucketConnectionString
}
az.tasks = [
`cd ${helmOut}`,
`az storage blob upload-batch --destination helm-sh --source ${helmOut}`,
`cd ${docsOut}`,
`az storage blob upload-batch --destination docs-helm-sh --source ${docsOut}`
];
// Run buildDocs and buildHelmSh in parallel because they can safely share the
// same storage space, then run az once and upload all the things.
Group.runAll([buildDocs, buildHelmSh]).then(() => az.run());
};