@toptal/davinci-ci 3.0.1-alpha-fix-davinci-metric-61af05c8.9 → 3.0.1-alpha-chore-improve-packages-building-23e03d25.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/danger.d.ts +11 -0
- package/dist/commands/danger.js +64 -0
- package/dist/configs/danger/conventional-commits/dangerfile.d.ts +1 -0
- package/dist/configs/danger/conventional-commits/dangerfile.js +12 -0
- package/dist/configs/danger/conventional-commits/plugins/conventional-commits/index.d.ts +1 -0
- package/dist/configs/danger/conventional-commits/plugins/conventional-commits/index.js +99 -0
- package/dist/configs/danger/conventional-commits/plugins/conventional-pr-title/index.d.ts +1 -0
- package/dist/configs/danger/conventional-commits/plugins/conventional-pr-title/index.js +94 -0
- package/dist/configs/danger/conventional-commits/plugins/index.d.ts +3 -0
- package/dist/configs/danger/conventional-commits/plugins/index.js +7 -0
- package/dist/configs/danger/plugins/empty-assignee.d.ts +1 -0
- package/dist/configs/danger/plugins/empty-assignee.js +18 -0
- package/dist/configs/danger/toptal/config.d.ts +7 -0
- package/dist/configs/danger/toptal/config.js +27 -0
- package/dist/configs/danger/toptal/dangerfile.d.ts +1 -0
- package/dist/configs/danger/toptal/dangerfile.js +12 -0
- package/dist/configs/danger/toptal/plugins/index.d.ts +3 -0
- package/dist/configs/danger/toptal/plugins/index.js +7 -0
- package/dist/configs/danger/toptal/plugins/toptal-commits/index.d.ts +1 -0
- package/dist/configs/danger/toptal/plugins/toptal-commits/index.js +51 -0
- package/dist/configs/danger/toptal/plugins/toptal-pr-title/index.d.ts +1 -0
- package/dist/configs/danger/toptal/plugins/toptal-pr-title/index.js +45 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.js +17 -0
- package/package.json +9 -6
- package/CHANGELOG.md +0 -978
- package/src/commands/danger.js +0 -67
- package/src/configs/danger/conventional-commits/dangerfile.js +0 -17
- package/src/configs/danger/conventional-commits/plugins/conventional-commits/index.js +0 -52
- package/src/configs/danger/conventional-commits/plugins/conventional-pr-title/index.js +0 -53
- package/src/configs/danger/conventional-commits/plugins/index.js +0 -7
- package/src/configs/danger/plugins/empty-assignee.js +0 -24
- package/src/configs/danger/toptal/config.js +0 -30
- package/src/configs/danger/toptal/dangerfile.js +0 -17
- package/src/configs/danger/toptal/plugins/index.js +0 -7
- package/src/configs/danger/toptal/plugins/toptal-commits/index.js +0 -73
- package/src/configs/danger/toptal/plugins/toptal-pr-title/index.js +0 -62
- package/src/configs/docker/Dockerfile +0 -30
- package/src/configs/docker/Dockerfile.gha-deploy +0 -33
- package/src/configs/docker/Dockerfile.release +0 -28
- package/src/configs/docker/Dockerfile.storybook +0 -20
- package/src/configs/docker/env-runtime.entrypoint.sh +0 -47
- package/src/configs/docker/nginx-vhost-storybook.conf +0 -20
- package/src/configs/docker/nginx-vhost.conf +0 -18
- package/src/configs/jobs/build-image/Jenkinsfile +0 -142
- package/src/configs/jobs/build-image/config.xml +0 -119
- package/src/configs/jobs/build-release-image/Jenkinsfile +0 -154
- package/src/configs/jobs/build-release-image/config.xml +0 -102
- package/src/configs/jobs/consumer-contracts-verify/Jenkinsfile +0 -117
- package/src/configs/jobs/consumer-contracts-verify/config.xml +0 -114
- package/src/configs/jobs/deploy/config.xml +0 -107
- package/src/configs/jobs/deploy-helm-run/Jenkinsfile +0 -159
- package/src/configs/jobs/deploy-helm-run/config.xml +0 -107
- package/src/configs/jobs/deploy-helm-run-trigger/Jenkinsfile +0 -200
- package/src/configs/jobs/master-main/Jenkinsfile +0 -460
- package/src/configs/jobs/master-main/config.xml +0 -119
- package/src/configs/jobs/pr-tests/Jenkinsfile +0 -407
- package/src/configs/jobs/pr-tests/config.xml +0 -134
- package/src/configs/jobs/publish-alpha-package/Jenkinsfile +0 -189
- package/src/configs/jobs/publish-alpha-package/config.xml +0 -136
- package/src/configs/jobs/temploy-helm-run/Jenkinsfile +0 -141
- package/src/configs/jobs/temploy-helm-run/config.xml +0 -97
- package/src/index.js +0 -17
package/src/commands/danger.js
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
const {
|
|
2
|
-
davinciProjectConfig,
|
|
3
|
-
runSync,
|
|
4
|
-
print,
|
|
5
|
-
convertToCLIParameters,
|
|
6
|
-
files,
|
|
7
|
-
} = require('@toptal/davinci-cli-shared')
|
|
8
|
-
|
|
9
|
-
const commandOptions = [
|
|
10
|
-
{
|
|
11
|
-
label: 'check only, without fixing the code',
|
|
12
|
-
name: '--check',
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
label: 'checks commit message quality locally',
|
|
16
|
-
name: '--local',
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
label: 'specify custom danger file',
|
|
20
|
-
name: '--dangerfile <dangerfile>',
|
|
21
|
-
},
|
|
22
|
-
]
|
|
23
|
-
|
|
24
|
-
const dangerCommand = ({ options }) => {
|
|
25
|
-
print.green('Running danger check...')
|
|
26
|
-
|
|
27
|
-
const { local, dangerfile, ...rest } = options
|
|
28
|
-
|
|
29
|
-
const conventionalCommitsDangerfilePath = files.getPackageFilePath(
|
|
30
|
-
'@toptal/davinci-ci',
|
|
31
|
-
'src/configs/danger/conventional-commits/dangerfile.js'
|
|
32
|
-
)
|
|
33
|
-
const toptalCommitsDangerfilePath = files.getPackageFilePath(
|
|
34
|
-
'@toptal/davinci-ci',
|
|
35
|
-
'src/configs/danger/toptal/dangerfile.js'
|
|
36
|
-
)
|
|
37
|
-
|
|
38
|
-
let dangerfilePath = dangerfile
|
|
39
|
-
|
|
40
|
-
if (!dangerfilePath) {
|
|
41
|
-
dangerfilePath = davinciProjectConfig.master.conventionalCommits
|
|
42
|
-
? conventionalCommitsDangerfilePath
|
|
43
|
-
: toptalCommitsDangerfilePath
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
runSync(
|
|
47
|
-
'yarn',
|
|
48
|
-
[
|
|
49
|
-
'danger',
|
|
50
|
-
local ? 'local' : 'ci',
|
|
51
|
-
local ? '--failOnErrors' : undefined,
|
|
52
|
-
'--dangerfile',
|
|
53
|
-
`${dangerfilePath}`,
|
|
54
|
-
...convertToCLIParameters(rest),
|
|
55
|
-
].filter(Boolean)
|
|
56
|
-
)
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
const dangerCommandCreator = {
|
|
60
|
-
action: dangerCommand,
|
|
61
|
-
allowUnknownOptions: true,
|
|
62
|
-
command: 'danger',
|
|
63
|
-
description: 'Run danger check',
|
|
64
|
-
options: commandOptions,
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
module.exports = dangerCommandCreator
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
const { schedule } = require('danger')
|
|
2
|
-
const { davinciProjectConfig } = require('@toptal/davinci-cli-shared')
|
|
3
|
-
|
|
4
|
-
const { conventionalCommits } = require('./plugins/conventional-commits')
|
|
5
|
-
const { conventionalPRTitle } = require('./plugins/conventional-pr-title')
|
|
6
|
-
const { checkAssigneeExist } = require('../plugins/empty-assignee')
|
|
7
|
-
|
|
8
|
-
schedule(conventionalCommits)
|
|
9
|
-
schedule(conventionalPRTitle)
|
|
10
|
-
|
|
11
|
-
const {
|
|
12
|
-
master: { requireAssignee },
|
|
13
|
-
} = davinciProjectConfig
|
|
14
|
-
|
|
15
|
-
if (requireAssignee) {
|
|
16
|
-
schedule(checkAssigneeExist)
|
|
17
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
/* globals danger, fail */
|
|
2
|
-
/* eslint-disable import/no-extraneous-dependencies */
|
|
3
|
-
const { default: load } = require('@commitlint/load')
|
|
4
|
-
const { default: lint } = require('@commitlint/lint')
|
|
5
|
-
/* eslint-enable */
|
|
6
|
-
const table = require('markdown-table')
|
|
7
|
-
|
|
8
|
-
const { WHITELISTED_USERS } = require('../../../toptal/config')
|
|
9
|
-
|
|
10
|
-
const conventionalCommits = async () => {
|
|
11
|
-
if (
|
|
12
|
-
danger.github &&
|
|
13
|
-
WHITELISTED_USERS.includes(danger.github.pr.user.login)
|
|
14
|
-
) {
|
|
15
|
-
return
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const { commits } = danger.git
|
|
19
|
-
const { rules, parserPreset } = await load({
|
|
20
|
-
extends: ['@commitlint/config-conventional'],
|
|
21
|
-
})
|
|
22
|
-
|
|
23
|
-
commits.forEach(async commit => {
|
|
24
|
-
const result = await lint(
|
|
25
|
-
commit.message,
|
|
26
|
-
rules,
|
|
27
|
-
parserPreset ? { parserOpts: parserPreset.parserOpts } : {}
|
|
28
|
-
)
|
|
29
|
-
|
|
30
|
-
if (!result.valid) {
|
|
31
|
-
if (result.errors.length > 0) {
|
|
32
|
-
let message = `The commit - ${commit.sha.trim()} doesn't conform the conventional commit guidelines. \n\n**Errors**:\n\n`
|
|
33
|
-
|
|
34
|
-
message += table([
|
|
35
|
-
['Message'],
|
|
36
|
-
...result.errors.map(error => [error.message]),
|
|
37
|
-
])
|
|
38
|
-
|
|
39
|
-
message +=
|
|
40
|
-
'\n\n💡 For a guidance on how to fix this problem please refer to [https://www.conventionalcommits.org](https://www.conventionalcommits.org)'
|
|
41
|
-
message +=
|
|
42
|
-
'\n\n💡 Or you can check our [documentation](https://github.com/toptal/picasso/blob/master/docs/contribution/github-workflow.md#general-commit-message-pattern)'
|
|
43
|
-
|
|
44
|
-
fail(message)
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
})
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
module.exports = {
|
|
51
|
-
conventionalCommits,
|
|
52
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
/// <reference types="danger" />
|
|
2
|
-
/* globals danger, fail */
|
|
3
|
-
/* eslint-disable import/no-extraneous-dependencies */
|
|
4
|
-
const { default: load } = require('@commitlint/load')
|
|
5
|
-
const { default: lint } = require('@commitlint/lint')
|
|
6
|
-
/* eslint-enable */
|
|
7
|
-
const table = require('markdown-table')
|
|
8
|
-
|
|
9
|
-
const { WHITELISTED_USERS } = require('../../../toptal/config')
|
|
10
|
-
|
|
11
|
-
const conventionalPRTitle = async () => {
|
|
12
|
-
if (!danger.github) {
|
|
13
|
-
return
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
if (WHITELISTED_USERS.includes(danger.github.pr.user.login)) {
|
|
17
|
-
return
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const { rules, parserPreset } = await load({
|
|
21
|
-
extends: ['@commitlint/config-conventional'],
|
|
22
|
-
})
|
|
23
|
-
const { title } = danger.github.pr
|
|
24
|
-
|
|
25
|
-
const result = await lint(
|
|
26
|
-
title,
|
|
27
|
-
rules,
|
|
28
|
-
parserPreset ? { parserOpts: parserPreset.parserOpts } : {}
|
|
29
|
-
)
|
|
30
|
-
|
|
31
|
-
if (!result.valid) {
|
|
32
|
-
if (result.errors.length > 0) {
|
|
33
|
-
let message =
|
|
34
|
-
"PR title doesn't conform the conventional commit guidelines. \n\n**Errors**:\n\n"
|
|
35
|
-
|
|
36
|
-
message += table([
|
|
37
|
-
['Message'],
|
|
38
|
-
...result.errors.map(error => [error.message]),
|
|
39
|
-
])
|
|
40
|
-
|
|
41
|
-
message +=
|
|
42
|
-
'\n\n💡 For a guidance on how to fix this problem please refer to [https://www.conventionalcommits.org](https://www.conventionalcommits.org)'
|
|
43
|
-
message +=
|
|
44
|
-
'\n\n💡 Or you can check our [documentation](https://github.com/toptal/picasso/blob/master/docs/contribution/github-workflow.md#general-commit-message-pattern)'
|
|
45
|
-
|
|
46
|
-
fail(message)
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
module.exports = {
|
|
52
|
-
conventionalPRTitle,
|
|
53
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/// <reference types="danger" />
|
|
2
|
-
/* globals danger, fail */
|
|
3
|
-
const { davinciProjectConfig } = require('@toptal/davinci-cli-shared')
|
|
4
|
-
|
|
5
|
-
const {
|
|
6
|
-
master: { requireAssigneeWhiteList = [] },
|
|
7
|
-
} = davinciProjectConfig
|
|
8
|
-
|
|
9
|
-
const WHITELISTED_USERS = requireAssigneeWhiteList
|
|
10
|
-
const checkAssigneeExist = () => {
|
|
11
|
-
const isLocalRun = !danger.github
|
|
12
|
-
|
|
13
|
-
if (isLocalRun || WHITELISTED_USERS.includes(danger.github.pr.user.login)) {
|
|
14
|
-
return
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
if (!danger.github.pr.assignee || danger.github.pr.assignees.length === 0) {
|
|
18
|
-
fail('Please assign someone to this PR before merging.')
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
module.exports = {
|
|
23
|
-
checkAssigneeExist,
|
|
24
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
const WHITELISTED_USERS = [
|
|
2
|
-
'dependabot-preview[bot]',
|
|
3
|
-
'dependabot[bot]',
|
|
4
|
-
'toptal-devbot',
|
|
5
|
-
]
|
|
6
|
-
const VALID_PR_CODE_REGEX = /\[[A-Z]{1,5}-.*]\s/
|
|
7
|
-
// Valid commit titles:
|
|
8
|
-
// "Regular commit message"
|
|
9
|
-
// "Commit with sentence. But does not end with a full-stop"
|
|
10
|
-
// "[FOO-1234] Commit with prefix"
|
|
11
|
-
// "[FOO] Prefix numbers can be omitted"
|
|
12
|
-
// "[FOO][BAR] Prefixes can couple"
|
|
13
|
-
const VALID_COMMIT_TITLE_REGEX = /^((\[[A-Z]+(-\d+)?])+ )?[A-Z]\w[^\n]*[^.]$/
|
|
14
|
-
const MAX_COMMIT_LINE_LENGTH = 79
|
|
15
|
-
const ENGINEERING_DOCS_LINK =
|
|
16
|
-
'https://toptal-core.atlassian.net/wiki/spaces/ENG/pages/210665897/Commit+Message+Quality'
|
|
17
|
-
|
|
18
|
-
const DEFAULT_PR_TITLE_ERROR_MESSAGE = `The pull request title doesn't conform to Toptal's engineering practices. For guidance on how to fix this problem please refer [here](${ENGINEERING_DOCS_LINK})`
|
|
19
|
-
const MISSING_TICKET_CODE_ERROR_MESSAGE =
|
|
20
|
-
"The pull request title is missing a Jira issue code. Correct format '[ASD-123] Add a cool feature'. If you're working without a Jira issue then add a 'no-jira' label to your pull request."
|
|
21
|
-
|
|
22
|
-
module.exports = {
|
|
23
|
-
DEFAULT_PR_TITLE_ERROR_MESSAGE,
|
|
24
|
-
ENGINEERING_DOCS_LINK,
|
|
25
|
-
MAX_COMMIT_LINE_LENGTH,
|
|
26
|
-
MISSING_TICKET_CODE_ERROR_MESSAGE,
|
|
27
|
-
VALID_COMMIT_TITLE_REGEX,
|
|
28
|
-
VALID_PR_CODE_REGEX,
|
|
29
|
-
WHITELISTED_USERS,
|
|
30
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
const { schedule } = require('danger')
|
|
2
|
-
const { davinciProjectConfig } = require('@toptal/davinci-cli-shared')
|
|
3
|
-
|
|
4
|
-
const { toptalCommits } = require('./plugins/toptal-commits')
|
|
5
|
-
const { toptalPRTitle } = require('./plugins/toptal-pr-title')
|
|
6
|
-
const { checkAssigneeExist } = require('../plugins/empty-assignee')
|
|
7
|
-
|
|
8
|
-
schedule(toptalCommits)
|
|
9
|
-
schedule(toptalPRTitle)
|
|
10
|
-
|
|
11
|
-
const {
|
|
12
|
-
master: { requireAssignee },
|
|
13
|
-
} = davinciProjectConfig
|
|
14
|
-
|
|
15
|
-
if (requireAssignee) {
|
|
16
|
-
schedule(checkAssigneeExist)
|
|
17
|
-
}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
/* globals danger, fail */
|
|
2
|
-
const {
|
|
3
|
-
MAX_COMMIT_LINE_LENGTH,
|
|
4
|
-
VALID_COMMIT_TITLE_REGEX,
|
|
5
|
-
WHITELISTED_USERS,
|
|
6
|
-
} = require('../../config')
|
|
7
|
-
|
|
8
|
-
const validateCommitMessage = message => {
|
|
9
|
-
const errors = []
|
|
10
|
-
const [title = '', body = ''] = message.split(/\n\n/)
|
|
11
|
-
const bodyLines = body.split(/\n/)
|
|
12
|
-
const isTitleFormatValid = VALID_COMMIT_TITLE_REGEX.test(title)
|
|
13
|
-
const isTitleLengthValid = title.length <= MAX_COMMIT_LINE_LENGTH
|
|
14
|
-
const isBodyLinesLengthValid = bodyLines.every(
|
|
15
|
-
line => line.length <= MAX_COMMIT_LINE_LENGTH
|
|
16
|
-
)
|
|
17
|
-
|
|
18
|
-
if (!isTitleFormatValid) {
|
|
19
|
-
errors.push(`- format of commit title is not correct ([read more](https://toptal-core.atlassian.net/wiki/spaces/ENG/pages/210665897/Commit+Message+Quality)):
|
|
20
|
-
- Title should start with capital letter
|
|
21
|
-
- Title should not end with a full-stop (i.e .)\n
|
|
22
|
-
Example of a valid commit title:
|
|
23
|
-
- Regular commit message
|
|
24
|
-
- [FOO-1234] Commit with prefix
|
|
25
|
-
- [FOO][BAR] Coupled prefixes`)
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
if (!isTitleLengthValid) {
|
|
29
|
-
errors.push(
|
|
30
|
-
`- title is too long (max ${MAX_COMMIT_LINE_LENGTH} characters)`
|
|
31
|
-
)
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
if (!isBodyLinesLengthValid) {
|
|
35
|
-
errors.push(
|
|
36
|
-
`- body lines must not exceed ${MAX_COMMIT_LINE_LENGTH} characters`
|
|
37
|
-
)
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return errors
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const toptalCommits = () => {
|
|
44
|
-
if (
|
|
45
|
-
danger.github &&
|
|
46
|
-
WHITELISTED_USERS.includes(danger.github.pr.user.login)
|
|
47
|
-
) {
|
|
48
|
-
return
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
const { commits } = danger.git
|
|
52
|
-
|
|
53
|
-
commits.forEach(commit => {
|
|
54
|
-
if (commit.author && WHITELISTED_USERS.includes(commit.author.name)) {
|
|
55
|
-
return
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
const validationErrors = validateCommitMessage(commit.message)
|
|
59
|
-
|
|
60
|
-
if (validationErrors.length) {
|
|
61
|
-
fail(
|
|
62
|
-
[
|
|
63
|
-
`Commit ${commit.sha.trim()} does not meet requirements of [Commit Message Quality](https://toptal-core.atlassian.net/wiki/spaces/ENG/pages/210665897/Commit+Message+Quality):`,
|
|
64
|
-
...validationErrors,
|
|
65
|
-
].join('\n')
|
|
66
|
-
)
|
|
67
|
-
}
|
|
68
|
-
})
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
module.exports = {
|
|
72
|
-
toptalCommits,
|
|
73
|
-
}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
/* globals danger, fail */
|
|
2
|
-
const {
|
|
3
|
-
VALID_COMMIT_TITLE_REGEX,
|
|
4
|
-
VALID_PR_CODE_REGEX,
|
|
5
|
-
WHITELISTED_USERS,
|
|
6
|
-
DEFAULT_PR_TITLE_ERROR_MESSAGE,
|
|
7
|
-
MISSING_TICKET_CODE_ERROR_MESSAGE,
|
|
8
|
-
} = require('../../config')
|
|
9
|
-
|
|
10
|
-
const getTicketCode = text => {
|
|
11
|
-
const ticketCode = text.match(VALID_PR_CODE_REGEX)
|
|
12
|
-
|
|
13
|
-
if (!ticketCode) {
|
|
14
|
-
return
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
return ticketCode[0]
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const showError = (error = DEFAULT_PR_TITLE_ERROR_MESSAGE) => {
|
|
21
|
-
fail(error)
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const toptalPRTitle = () => {
|
|
25
|
-
if (!danger.github) {
|
|
26
|
-
return
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
if (WHITELISTED_USERS.includes(danger.github.pr.user.login)) {
|
|
30
|
-
return
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const { title } = danger.github.pr
|
|
34
|
-
const labelNames = danger.github.issue.labels.map(({ name }) => name)
|
|
35
|
-
|
|
36
|
-
const ticketCode = getTicketCode(title)
|
|
37
|
-
|
|
38
|
-
if (!ticketCode && !labelNames.includes('no-jira')) {
|
|
39
|
-
showError(MISSING_TICKET_CODE_ERROR_MESSAGE)
|
|
40
|
-
|
|
41
|
-
return
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
const splitTitle = title.split(ticketCode)
|
|
45
|
-
|
|
46
|
-
if (!splitTitle.length) {
|
|
47
|
-
showError()
|
|
48
|
-
|
|
49
|
-
return
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
const titleText = splitTitle[splitTitle.length - 1]
|
|
53
|
-
const isTitleFormatValid = VALID_COMMIT_TITLE_REGEX.test(titleText)
|
|
54
|
-
|
|
55
|
-
if (!isTitleFormatValid) {
|
|
56
|
-
showError()
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
module.exports = {
|
|
61
|
-
toptalPRTitle,
|
|
62
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
FROM node:14
|
|
2
|
-
|
|
3
|
-
ARG NPM_TOKEN
|
|
4
|
-
ENV NPM_TOKEN ${NPM_TOKEN}
|
|
5
|
-
|
|
6
|
-
# Change default 'node' user id to match jenkins CI user id
|
|
7
|
-
# so when we will be running container from CI it would have
|
|
8
|
-
# all necessary rights for npm/yarn publish
|
|
9
|
-
RUN groupmod -g 469 node && usermod -u 469 -g 469 node
|
|
10
|
-
|
|
11
|
-
WORKDIR /app
|
|
12
|
-
RUN chown -R node /app
|
|
13
|
-
|
|
14
|
-
USER node
|
|
15
|
-
|
|
16
|
-
# Add github.com to known ssh hosts
|
|
17
|
-
RUN mkdir ~/.ssh
|
|
18
|
-
RUN ssh-keyscan github.com >> ~/.ssh/known_hosts
|
|
19
|
-
|
|
20
|
-
# Needs to be updated for publishing package to npm
|
|
21
|
-
RUN printf '//registry.npmjs.org/:_authToken=${NPM_TOKEN}\nalways-auth=true\n' > .npmrc
|
|
22
|
-
RUN yarn config set registry https://registry.npmjs.org
|
|
23
|
-
|
|
24
|
-
# Enables layer caching
|
|
25
|
-
COPY --chown=node:node package.json yarn.lock ./
|
|
26
|
-
RUN yarn install --frozen-lockfile --network-timeout 120000
|
|
27
|
-
|
|
28
|
-
COPY --chown=node:node . /app
|
|
29
|
-
|
|
30
|
-
RUN yarn build
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
# Create the image with Nginx environment.
|
|
2
|
-
FROM nginx:alpine
|
|
3
|
-
|
|
4
|
-
# Copy results from the dist folder to the image.
|
|
5
|
-
ARG DIST_FOLDER
|
|
6
|
-
RUN [ -z "$DIST_FOLDER" ] && echo "DIST_FOLDER is required" && exit 1 || true
|
|
7
|
-
COPY $DIST_FOLDER /usr/share/nginx/html
|
|
8
|
-
|
|
9
|
-
# Remove source maps from the production build
|
|
10
|
-
RUN find /usr/share/nginx/html -name "*.map" -type f -delete
|
|
11
|
-
|
|
12
|
-
# Copy the entrypoint.
|
|
13
|
-
ARG ENV_RUNTIME_ENTRYPOINT
|
|
14
|
-
RUN [ -z "$ENV_RUNTIME_ENTRYPOINT" ] && echo "ENV_RUNTIME_ENTRYPOINT is required" && exit 1 || true
|
|
15
|
-
COPY $ENV_RUNTIME_ENTRYPOINT /usr/local/bin/env-runtime.entrypoint.sh
|
|
16
|
-
RUN chmod +x /usr/local/bin/env-runtime.entrypoint.sh
|
|
17
|
-
|
|
18
|
-
# version is used in build process, so the value won't be available here otherwise
|
|
19
|
-
ARG VERSION
|
|
20
|
-
RUN [ -z "$VERSION" ] && echo "VERSION is required" && exit 1 || true
|
|
21
|
-
ENV DAVINCI_RELEASE_VERSION $VERSION
|
|
22
|
-
|
|
23
|
-
RUN echo $VERSION > /usr/share/nginx/html/REVISION.txt
|
|
24
|
-
|
|
25
|
-
# Copy configuration file for Nginx and replace the default one.
|
|
26
|
-
ARG NGINX_CONFIG
|
|
27
|
-
RUN [ -z "$NGINX_CONFIG" ] && echo "NGINX_CONFIG is required" && exit 1 || true
|
|
28
|
-
COPY $NGINX_CONFIG /etc/nginx/conf.d/default.conf
|
|
29
|
-
|
|
30
|
-
# Entry point to provide Run Time Environment Variables for the App.
|
|
31
|
-
ENTRYPOINT ["/usr/local/bin/env-runtime.entrypoint.sh"]
|
|
32
|
-
|
|
33
|
-
CMD ["nginx", "-g", "daemon off;"]
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
ARG VERSION
|
|
2
|
-
ARG REPO_NAME
|
|
3
|
-
|
|
4
|
-
FROM gcr.io/toptal-hub/${REPO_NAME}:${VERSION} as builder
|
|
5
|
-
|
|
6
|
-
FROM nginx:alpine
|
|
7
|
-
|
|
8
|
-
ARG ENV_RUNTIME_ENTRYPOINT
|
|
9
|
-
|
|
10
|
-
COPY --from=builder /app/dist /usr/share/nginx/html
|
|
11
|
-
COPY --from=builder /app/node_modules/@toptal/davinci-ci/src/configs/docker/nginx-vhost.conf /etc/nginx/conf.d/default.conf
|
|
12
|
-
|
|
13
|
-
# Remove source maps from the production build
|
|
14
|
-
RUN find /usr/share/nginx/html -name "*.map" -type f -delete
|
|
15
|
-
|
|
16
|
-
# Copy the entrypoint to prepare env variables
|
|
17
|
-
# example davinci/packages/ci/scr/configs/docker/env-runtime.entrypoint.sh
|
|
18
|
-
COPY ${ENV_RUNTIME_ENTRYPOINT} /usr/local/bin/env-runtime.entrypoint.sh
|
|
19
|
-
|
|
20
|
-
# version is used in build process, so the value won't be available here otherwise
|
|
21
|
-
ARG VERSION
|
|
22
|
-
ENV DAVINCI_RELEASE_VERSION $VERSION
|
|
23
|
-
|
|
24
|
-
RUN echo $VERSION > /usr/share/nginx/html/REVISION.txt
|
|
25
|
-
|
|
26
|
-
ENTRYPOINT ["/usr/local/bin/env-runtime.entrypoint.sh"]
|
|
27
|
-
|
|
28
|
-
CMD ["nginx", "-g", "daemon off;"]
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
# Create the image with Nginx environment.
|
|
2
|
-
FROM nginx:alpine
|
|
3
|
-
|
|
4
|
-
# Copy results from the dist folder to the image.
|
|
5
|
-
ARG DIST_FOLDER
|
|
6
|
-
RUN [ -z "$DIST_FOLDER" ] && echo "DIST_FOLDER is required" && exit 1 || true
|
|
7
|
-
COPY $DIST_FOLDER /usr/share/nginx/html/storybook
|
|
8
|
-
|
|
9
|
-
# version is used in build process, so the value won't be available here otherwise
|
|
10
|
-
ARG VERSION
|
|
11
|
-
RUN [ -z "$VERSION" ] && echo "VERSION is required" && exit 1 || true
|
|
12
|
-
|
|
13
|
-
RUN echo $VERSION > /usr/share/nginx/html/REVISION.txt
|
|
14
|
-
|
|
15
|
-
# Copy configuration file for Nginx and replace the default one.
|
|
16
|
-
ARG NGINX_CONFIG
|
|
17
|
-
RUN [ -z "$NGINX_CONFIG" ] && echo "NGINX_CONFIG is required" && exit 1 || true
|
|
18
|
-
COPY $NGINX_CONFIG /etc/nginx/conf.d/default.conf
|
|
19
|
-
|
|
20
|
-
CMD ["nginx", "-g", "daemon off;"]
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
#!/bin/sh -e
|
|
2
|
-
|
|
3
|
-
# This bash script takes required Environment Variables of current process
|
|
4
|
-
# and put them into `index.html` file which is an entry-point of the application.
|
|
5
|
-
# By this way we provide run time variables to a precompiled JS code.
|
|
6
|
-
|
|
7
|
-
# This is how a place which contains `run time` variables may look in `index.html`
|
|
8
|
-
#
|
|
9
|
-
# window.TP = {
|
|
10
|
-
# env: '%REACT_APP_ENV_NAME%',
|
|
11
|
-
# graphql_url: '%REACT_APP_GRAPHQL_URI%'
|
|
12
|
-
# }
|
|
13
|
-
|
|
14
|
-
# keep in sync with index.html
|
|
15
|
-
VARS_PREFIX="DAVINCI_"
|
|
16
|
-
INDEX_FILE="/usr/share/nginx/html/index.html"
|
|
17
|
-
|
|
18
|
-
VARS="$(env | grep $VARS_PREFIX | awk -F = '{print $1}')"
|
|
19
|
-
|
|
20
|
-
# trim whitespaces
|
|
21
|
-
REQUIRED_VARS="$(echo "$VARS" | xargs -n1 | sed 's/^//g')"
|
|
22
|
-
|
|
23
|
-
# trim whitespaces and prepend $ to every var above
|
|
24
|
-
ENVSUBST_KNOWN_VARS="$(echo "$VARS" | xargs -n1 | sed 's/^/\$/g')"
|
|
25
|
-
|
|
26
|
-
# replace all the placeholders %VARIABLE_NAME% with the actual value of the variable
|
|
27
|
-
for placeholder in $REQUIRED_VARS
|
|
28
|
-
do
|
|
29
|
-
value=`printenv "$placeholder"`
|
|
30
|
-
# any character after 's' in sed is used as a separator
|
|
31
|
-
# https://stackoverflow.com/a/16790877/1611414
|
|
32
|
-
sed -i "s|%${placeholder}%|$value|g" $INDEX_FILE
|
|
33
|
-
done
|
|
34
|
-
|
|
35
|
-
MISSING_VARS="$(cat $INDEX_FILE | grep "%$VARS_PREFIX.*%" | sed 's/.*%\(.*\)%.*/\1/g')"
|
|
36
|
-
|
|
37
|
-
if [ -n "$MISSING_VARS" ]; then
|
|
38
|
-
for placeholder in $MISSING_VARS
|
|
39
|
-
do
|
|
40
|
-
if ! printenv "$placeholder" > /dev/null; then
|
|
41
|
-
echo "Variable '$placeholder' is not set. Exiting..."
|
|
42
|
-
exit 1
|
|
43
|
-
fi
|
|
44
|
-
done
|
|
45
|
-
fi
|
|
46
|
-
|
|
47
|
-
exec "$@"
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
server {
|
|
2
|
-
listen 80;
|
|
3
|
-
server_name localhost;
|
|
4
|
-
root /usr/share/nginx/html/storybook;
|
|
5
|
-
|
|
6
|
-
location / {
|
|
7
|
-
try_files $uri $uri/ index.html;
|
|
8
|
-
index index.html;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
location ~ \.(js|png|svg|jpg|gif)$ {
|
|
12
|
-
try_files $uri $uri/ =404;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
# redirect server error pages to the static page /50x.html
|
|
16
|
-
error_page 500 502 503 504 /50x.html;
|
|
17
|
-
location = /50x.html {
|
|
18
|
-
root /usr/share/nginx/html;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
# When you are redirecting to any url, which is handled by react-router
|
|
2
|
-
# on nginx we need special configuration to handle those
|
|
3
|
-
# and don't just return 404
|
|
4
|
-
server {
|
|
5
|
-
listen 80;
|
|
6
|
-
server_name localhost;
|
|
7
|
-
|
|
8
|
-
index index.html;
|
|
9
|
-
root /usr/share/nginx/html;
|
|
10
|
-
|
|
11
|
-
location ~ \.(js|css)$ {
|
|
12
|
-
# allow returning 404s for assets
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
location / {
|
|
16
|
-
try_files $uri /index.html;
|
|
17
|
-
}
|
|
18
|
-
}
|