-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci(openshift): Move back to using S3 as deployment target for the doc…
…s site. Integrate the S3 deploy with OpenShift and Jenkins. Add the s3-website npm package for simpler uploading to the bucket.
- Loading branch information
1 parent
90fbb41
commit cd18dd3
Showing
6 changed files
with
243 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/bin/sh | ||
|
||
## Runs `yarn deploy:docs` against a container on OpenShift. Used by the Deploy stage of the Jenkinsfile. | ||
## Usage: ./run-deploy-docs.sh tds latest staging | ||
|
||
NAME=${1} | ||
VERSION=${2:-latest} | ||
ENV=${3:-staging} | ||
IMAGESTREAM=`oc get imagestream ${NAME} -o='jsonpath={.status.dockerImageRepository}'` | ||
|
||
oc run ${NAME}-${VERSION} \ | ||
--image=${IMAGESTREAM}:${VERSION} \ | ||
--rm=true \ | ||
--attach=true \ | ||
--restart=Never \ | ||
--overrides='{ | ||
"apiVersion":"v1", | ||
"spec":{ | ||
"containers":[{ | ||
"name": "'${NAME}'-'${VERSION}'", | ||
"image": "'${IMAGESTREAM}':'${VERSION}'", | ||
"env":[{ | ||
"name":"AWS_ACCESS_KEY_ID", | ||
"valueFrom":{ | ||
"secretKeyRef":{ | ||
"key": "aws.accesskey", | ||
"name":"aws-access-key-secret" | ||
} | ||
} | ||
},{ | ||
"name":"AWS_SECRET_ACCESS_KEY", | ||
"valueFrom":{ | ||
"secretKeyRef":{ | ||
"key": "aws.secretkey", | ||
"name":"aws-secret-key-secret" | ||
} | ||
} | ||
}] | ||
"command":["yarn", "deploy:docs", "--", "'${ENV}'"] | ||
}] | ||
} | ||
}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/usr/bin/env node | ||
|
||
// Arguments | ||
// 1 = The environment to deploy. Determines which S3 bucket to use. | ||
|
||
const resolvePath = require('path').resolve; | ||
const execSync = require('child_process').execSync; | ||
|
||
const s3Website = resolvePath('node_modules/.bin/s3-website'); | ||
const uploadDir = resolvePath('styleguide/'); | ||
|
||
const version = require(resolvePath('package.json')).version; | ||
const env = process.argv[2] || 'staging'; | ||
|
||
const deployToS3 = (prefix) => { | ||
execSync( | ||
`${s3Website} deploy ${uploadDir} --prefix ${prefix} --domain cdn.telus-digital.tds-docs`, | ||
{ stdio: 'inherit' } | ||
); | ||
}; | ||
|
||
|
||
if (env === 'production') { | ||
deployToS3(`prod/v${version}`); | ||
deployToS3("prod/latest"); | ||
} | ||
else { | ||
deployToS3('staging'); | ||
} |
Oops, something went wrong.