-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JSUI-3159 Run CI/CD on jenkins and deploy beta tags to npm #1665
Merged
Merged
Changes from 11 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
8d84663
add deployment pipeline files
samisayegh 96b424e
escape back-slash
samisayegh 7a2c5c9
install dependencies before building
samisayegh 9c37ffa
adjust read.version.sh call
samisayegh 14b6cc4
use GIT_TAG_NAME instead of TRAVIS_TAG
samisayegh 76bde79
configure chrome with no sandbox
samisayegh 3a83b40
specify coverage upload file with relative path
samisayegh 96fe53a
try processing coverage without pipe
samisayegh 8150bba
resolve coverage dir relative to current dir
samisayegh ed118be
specify coverage dir using variable
samisayegh d81bb01
add beta deployments to npm
samisayegh ad80a85
place deployment pipeline under #Deploy phase
samisayegh 9317355
downgrade to node 12
samisayegh 0053829
Support npm package promotion, and cdn upload (#1667)
samisayegh 354dab4
Merge branch 'master' into JSUI-3159
samisayegh eab30ad
comment doc publish
samisayegh b6f5d9b
comment doc publish
samisayegh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
{ | ||
"product": "coveo-search-ui", | ||
"team_name": "searchui", | ||
"general": { | ||
"aws_regions": { | ||
"sequential": [ | ||
"us-east-1" | ||
] | ||
}, | ||
"environments_order": { | ||
"sequential": [ | ||
"dev", | ||
"qa", | ||
"prd" | ||
] | ||
}, | ||
"team_jenkins": "searchuibuilds", | ||
"start_environment_automatically": false, | ||
"notifications": { | ||
"slack_channels": [ | ||
"#searchuibuilds" | ||
] | ||
} | ||
}, | ||
"phases": { | ||
"s3": { | ||
"bucket": "coveo-nprod-binaries", | ||
"directory": "proda/StaticCDN/searchui/v$[MAJOR_MINOR_VERSION]", | ||
"parameters": { | ||
"acl": "public-read" | ||
}, | ||
"dev": { | ||
"disabled": true | ||
}, | ||
"qa": { | ||
"disabled": true | ||
}, | ||
"source": "bin" | ||
} | ||
}, | ||
"certifiers": { | ||
"dev": [ | ||
{ | ||
"job_name": "search_ui/job/functional_tests", | ||
"tag_suffix": "passed_functional_tests", | ||
"extra_parameters": { | ||
"SEARCH_UI_VERSION": "$[HEROKU_VERSION]" | ||
} | ||
}, | ||
{ | ||
"system_certifier": "snyk" | ||
}, | ||
{ | ||
"system_certifier": "veracode" | ||
} | ||
], | ||
"prd": [ | ||
{ | ||
"job_name": "search_ui/job/update_npm_latest_tag", | ||
"tag_suffix": "npm_latest_tag_updated", | ||
"extra_parameters": { | ||
"LATEST_NPM_VERSION": "$[LATEST_NPM_VERSION]" | ||
} | ||
} | ||
] | ||
}, | ||
"snyk": { | ||
"org": "coveo-jsui", | ||
"no_container_images": true, | ||
"configurations": [ | ||
{ | ||
"directory": ".", | ||
"project_name": "search-ui" | ||
} | ||
] | ||
}, | ||
"veracode": { | ||
"sandbox_name": "JS UI", | ||
"scan_include_patterns": "*" | ||
}, | ||
"observatory": { | ||
"no_endpoint": true | ||
}, | ||
"package_rollout": { | ||
"only_consider_changesets_after": "16247824e24b" | ||
}, | ||
"deployment_config_version": 1 | ||
} |
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,76 @@ | ||
node('linux && docker') { | ||
checkout scm | ||
|
||
withEnv([ | ||
'npm_config_cache=npm-cache' | ||
]){ | ||
withDockerContainer(image: 'node:14', args: '-u=root') { | ||
stage('Install') { | ||
sh 'yarn install' | ||
} | ||
|
||
stage('Build') { | ||
sh '. ./read.version.sh' | ||
sh 'echo $PACKAGE_JSON_VERSION' | ||
sh 'yarn run injectTag' | ||
sh 'yarn run build' | ||
|
||
if (env.GIT_TAG_NAME) { | ||
sh 'yarn run minimize' | ||
} | ||
} | ||
|
||
stage('Install Chrome') { | ||
sh "wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -" | ||
sh "echo 'deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main' | tee /etc/apt/sources.list.d/google-chrome.list" | ||
sh "apt-get update" | ||
sh "apt-get install -y google-chrome-stable fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst fonts-freefont-ttf libxss1 libxtst6 --no-install-recommends" | ||
sh "google-chrome --version" | ||
} | ||
|
||
stage('Test') { | ||
sh 'yarn run unitTests' | ||
|
||
if (env.GIT_TAG_NAME) { | ||
sh 'yarn run accessibilityTests' | ||
} | ||
|
||
sh 'set +e' | ||
// sh 'yarn run uploadCoverage' | ||
sh 'set -e' | ||
sh 'yarn run validateTypeDefinitions' | ||
} | ||
|
||
stage('Docs') { | ||
sh 'if [[ "x$GIT_TAG_NAME" != "x" && $IS_PULL_REQUEST_PUSH_BUILD = false ]]; then bash ./deploy.doc.sh ; fi' | ||
sh 'yarn run docsitemap' | ||
sh 'yarn run zipForGitReleases' | ||
} | ||
} | ||
|
||
if (!env.GIT_TAG_NAME) { | ||
return | ||
} | ||
|
||
stage('Deploy') { | ||
withCredentials([ | ||
string(credentialsId: 'NPM_TOKEN', variable: 'NPM_TOKEN') | ||
]) { | ||
sh(script: 'node ./build/npm.deploy.js') | ||
} | ||
} | ||
|
||
withDockerContainer(image: '458176070654.dkr.ecr.us-east-1.amazonaws.com/jenkins/deployment_package:v7') { | ||
stage('Veracode package') { | ||
sh 'rm -rf veracode && mkdir veracode' | ||
|
||
sh 'mkdir veracode/search-ui' | ||
sh 'cp -R src package.json yarn.lock veracode/search-ui' | ||
} | ||
|
||
stage('Deployment pipeline upload') { | ||
sh 'deployment-package package create --with-deploy || true' | ||
} | ||
} | ||
} | ||
} |
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 @@ | ||
'use strict'; | ||
const { promisify } = require('util'); | ||
const exec = promisify(require('child_process').exec); | ||
const fs = require('fs'); | ||
const os = require('os'); | ||
|
||
const tag = process.env.GIT_TAG_NAME; | ||
|
||
function isTagged() { | ||
return tag && tag !== ''; | ||
} | ||
|
||
async function deployTaggedVersion() { | ||
const suffix = 'beta'; | ||
console.log(`Doing a NPM deployment of a ${suffix} version`); | ||
await publishToNpm(['--tag', suffix], `Deploy ${suffix} is done`); | ||
} | ||
|
||
async function publishToNpm(publishArgs = [], successMessage) { | ||
const args = ['publish', ...publishArgs].join(' '); | ||
await exec(`npm ${args}`); | ||
console.log(successMessage); | ||
} | ||
|
||
function setNpmrcFile() { | ||
const fileName = `${os.homedir()}/.npmrc`; | ||
const npmrcString = `//registry.npmjs.org/:_authToken=${process.env.NPM_TOKEN}`; | ||
|
||
console.log('setting npmrc file'); | ||
return new Promise((resolve, reject) => fs.writeFile(fileName, npmrcString, err => (err ? reject(err) : resolve()))); | ||
} | ||
|
||
async function main() { | ||
if (!isTagged()) { | ||
return console.log('Skipping NPM deployment because this is not a tagged commit'); | ||
} | ||
|
||
await setNpmrcFile(); | ||
await deployTaggedVersion(); | ||
} | ||
|
||
main(); |
This file was deleted.
Oops, something went wrong.
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
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 |
---|---|---|
|
@@ -4,7 +4,13 @@ process.env.CHROME_BIN = puppeteer.executablePath(); | |
|
||
const configuration = { | ||
singleRun: true, | ||
browsers: ['ChromeHeadless'], | ||
browsers: ['ChromeHeadlessNoSandbox'], | ||
customLaunchers: { | ||
ChromeHeadlessNoSandbox: { | ||
base: 'ChromeHeadless', | ||
flags: ['--no-sandbox'] | ||
} | ||
}, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I needed to use |
||
frameworks: ['jasmine'], | ||
browserDisconnectTimeout: 120000, | ||
browserNoActivityTimeout: 120000, | ||
|
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#!/usr/bin/env bash | ||
#!/bin/bash | ||
|
||
export PACKAGE_JSON_VERSION=`cat package.json | grep version | head -1 | awk -F: '{ print $2 }' | sed 's/[",]//g' | sed -E 's/\.[0-9]+$//g' | xargs` | ||
export PACKAGE_PATCH_VERSION=`cat package.json | grep version | head -1 | awk -F: '{ print $2 }' | sed 's/[",]//g' | sed -E 's/[0-9]+\.[0-9]+\.//g' | xargs` |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the issue is the same as the one here: https://stackoverflow.com/questions/41978173/grunt-karma-coverage-fails-on-jenkins-but-works-on-windows-unix
I did not see a way to configure the option in the solution. I will revisit this in the future,