@toptal/davinci-ci 3.0.1-alpha-chore-improve-packages-building-14e3a950.51 → 3.0.2-alpha-chore-improve-packages-building-4fb91e1f.10
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/package.json +6 -5
- package/src/commands/danger.js +67 -0
- package/src/configs/danger/conventional-commits/dangerfile.js +17 -0
- package/src/configs/danger/conventional-commits/plugins/conventional-commits/index.js +52 -0
- package/src/configs/danger/conventional-commits/plugins/conventional-pr-title/index.js +53 -0
- package/src/configs/danger/conventional-commits/plugins/index.js +7 -0
- package/src/configs/danger/plugins/empty-assignee.js +24 -0
- package/src/configs/danger/toptal/config.js +30 -0
- package/src/configs/danger/toptal/dangerfile.js +17 -0
- package/src/configs/danger/toptal/plugins/index.js +7 -0
- package/src/configs/danger/toptal/plugins/toptal-commits/index.js +73 -0
- package/src/configs/danger/toptal/plugins/toptal-commits/toptal-commits.test.js +128 -0
- package/src/configs/danger/toptal/plugins/toptal-pr-title/index.js +62 -0
- package/src/configs/danger/toptal/plugins/toptal-pr-title/toptal-pr-title.test.js +68 -0
- package/src/configs/docker/Dockerfile +30 -0
- package/src/configs/docker/Dockerfile.gha-deploy +33 -0
- package/src/configs/docker/Dockerfile.release +28 -0
- package/src/configs/docker/Dockerfile.storybook +20 -0
- package/src/configs/docker/env-runtime.entrypoint.sh +47 -0
- package/src/configs/docker/nginx-vhost-storybook.conf +20 -0
- package/src/configs/docker/nginx-vhost.conf +18 -0
- package/src/configs/jobs/build-image/Jenkinsfile +142 -0
- package/src/configs/jobs/build-image/config.xml +119 -0
- package/src/configs/jobs/build-release-image/Jenkinsfile +154 -0
- package/src/configs/jobs/build-release-image/config.xml +102 -0
- package/src/configs/jobs/consumer-contracts-verify/Jenkinsfile +117 -0
- package/src/configs/jobs/consumer-contracts-verify/config.xml +114 -0
- package/src/configs/jobs/deploy/config.xml +107 -0
- package/src/configs/jobs/deploy-helm-run/Jenkinsfile +159 -0
- package/src/configs/jobs/deploy-helm-run/config.xml +107 -0
- package/src/configs/jobs/deploy-helm-run-trigger/Jenkinsfile +200 -0
- package/src/configs/jobs/master-main/Jenkinsfile +460 -0
- package/src/configs/jobs/master-main/config.xml +119 -0
- package/src/configs/jobs/pr-tests/Jenkinsfile +407 -0
- package/src/configs/jobs/pr-tests/config.xml +134 -0
- package/src/configs/jobs/publish-alpha-package/Jenkinsfile +189 -0
- package/src/configs/jobs/publish-alpha-package/config.xml +136 -0
- package/src/configs/jobs/temploy-helm-run/Jenkinsfile +141 -0
- package/src/configs/jobs/temploy-helm-run/config.xml +97 -0
- package/src/index.js +17 -0
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
<flow-definition plugin="workflow-job@2.35">
|
|
2
|
+
<actions>
|
|
3
|
+
<org.jenkinsci.plugins.pipeline.modeldefinition.actions.DeclarativeJobAction plugin="pipeline-model-definition@1.3.9"/>
|
|
4
|
+
<org.jenkinsci.plugins.pipeline.modeldefinition.actions.DeclarativeJobPropertyTrackerAction plugin="pipeline-model-definition@1.3.9">
|
|
5
|
+
<jobProperties/>
|
|
6
|
+
<triggers/>
|
|
7
|
+
<parameters>
|
|
8
|
+
<string>BRANCH</string>
|
|
9
|
+
<string>IMAGE_TAG</string>
|
|
10
|
+
<string>ALIAS_IMAGE_TAGS</string>
|
|
11
|
+
<string>REPOSITORY_NAME</string>
|
|
12
|
+
</parameters>
|
|
13
|
+
<options>
|
|
14
|
+
<string>skipDefaultCheckout</string>
|
|
15
|
+
</options>
|
|
16
|
+
</org.jenkinsci.plugins.pipeline.modeldefinition.actions.DeclarativeJobPropertyTrackerAction>
|
|
17
|
+
</actions>
|
|
18
|
+
<description></description>
|
|
19
|
+
<keepDependencies>false</keepDependencies>
|
|
20
|
+
<properties>
|
|
21
|
+
<hudson.model.ParametersDefinitionProperty>
|
|
22
|
+
<parameterDefinitions>
|
|
23
|
+
<hudson.model.StringParameterDefinition>
|
|
24
|
+
<name>BRANCH</name>
|
|
25
|
+
<description>Branch or tag to build</description>
|
|
26
|
+
<defaultValue>master</defaultValue>
|
|
27
|
+
<trim>false</trim>
|
|
28
|
+
</hudson.model.StringParameterDefinition>
|
|
29
|
+
<hudson.model.StringParameterDefinition>
|
|
30
|
+
<name>DAVINCI_BRANCH</name>
|
|
31
|
+
<description>Davinci branch</description>
|
|
32
|
+
<defaultValue>master</defaultValue>
|
|
33
|
+
<trim>false</trim>
|
|
34
|
+
</hudson.model.StringParameterDefinition>
|
|
35
|
+
<hudson.model.StringParameterDefinition>
|
|
36
|
+
<name>IMAGE_TAG</name>
|
|
37
|
+
<description>Docker tag of the image with dist folder which we are going to deploy</description>
|
|
38
|
+
<trim>false</trim>
|
|
39
|
+
</hudson.model.StringParameterDefinition>
|
|
40
|
+
<hudson.model.StringParameterDefinition>
|
|
41
|
+
<name>ALIAS_IMAGE_TAGS</name>
|
|
42
|
+
<description>Comma separated list of alias tags for the created docker image. Ex: "master,latest"</description>
|
|
43
|
+
<trim>false</trim>
|
|
44
|
+
</hudson.model.StringParameterDefinition>
|
|
45
|
+
<hudson.model.StringParameterDefinition>
|
|
46
|
+
<name>REPOSITORY_NAME</name>
|
|
47
|
+
<description>Repository name</description>
|
|
48
|
+
<trim>false</trim>
|
|
49
|
+
</hudson.model.StringParameterDefinition>
|
|
50
|
+
</parameterDefinitions>
|
|
51
|
+
</hudson.model.ParametersDefinitionProperty>
|
|
52
|
+
<hudson.plugins.jira.JiraProjectProperty plugin="jira@3.0.7"/>
|
|
53
|
+
<jenkins.model.BuildDiscarderProperty>
|
|
54
|
+
<strategy class="hudson.tasks.LogRotator">
|
|
55
|
+
<daysToKeep>-1</daysToKeep>
|
|
56
|
+
<numToKeep>20</numToKeep>
|
|
57
|
+
<artifactDaysToKeep>-1</artifactDaysToKeep>
|
|
58
|
+
<artifactNumToKeep>-1</artifactNumToKeep>
|
|
59
|
+
</strategy>
|
|
60
|
+
</jenkins.model.BuildDiscarderProperty>
|
|
61
|
+
<com.sonyericsson.jenkins.plugins.bfa.model.ScannerJobProperty plugin="build-failure-analyzer@1.20.0">
|
|
62
|
+
<doNotScan>false</doNotScan>
|
|
63
|
+
</com.sonyericsson.jenkins.plugins.bfa.model.ScannerJobProperty>
|
|
64
|
+
<com.coravy.hudson.plugins.github.GithubProjectProperty plugin="github@1.29.4">
|
|
65
|
+
<projectUrl>$PROJECT_URL</projectUrl>
|
|
66
|
+
<displayName></displayName>
|
|
67
|
+
</com.coravy.hudson.plugins.github.GithubProjectProperty>
|
|
68
|
+
<hudson.plugins.throttleconcurrents.ThrottleJobProperty plugin="throttle-concurrents@2.0.1">
|
|
69
|
+
<maxConcurrentPerNode>0</maxConcurrentPerNode>
|
|
70
|
+
<maxConcurrentTotal>0</maxConcurrentTotal>
|
|
71
|
+
<categories class="java.util.concurrent.CopyOnWriteArrayList"/>
|
|
72
|
+
<throttleEnabled>false</throttleEnabled>
|
|
73
|
+
<throttleOption>project</throttleOption>
|
|
74
|
+
<limitOneJobWithMatchingParams>false</limitOneJobWithMatchingParams>
|
|
75
|
+
<paramsToUseForLimit></paramsToUseForLimit>
|
|
76
|
+
<configVersion>1</configVersion>
|
|
77
|
+
</hudson.plugins.throttleconcurrents.ThrottleJobProperty>
|
|
78
|
+
</properties>
|
|
79
|
+
<definition class="org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition" plugin="workflow-cps@2.74">
|
|
80
|
+
<scm class="hudson.plugins.git.GitSCM" plugin="git@3.10.1">
|
|
81
|
+
<configVersion>2</configVersion>
|
|
82
|
+
<userRemoteConfigs>
|
|
83
|
+
<hudson.plugins.git.UserRemoteConfig>
|
|
84
|
+
<url>git@github.com:toptal/davinci.git</url>
|
|
85
|
+
<credentialsId>$CREDENTIALS_ID</credentialsId>
|
|
86
|
+
</hudson.plugins.git.UserRemoteConfig>
|
|
87
|
+
</userRemoteConfigs>
|
|
88
|
+
<branches>
|
|
89
|
+
<hudson.plugins.git.BranchSpec>
|
|
90
|
+
<name>master</name>
|
|
91
|
+
</hudson.plugins.git.BranchSpec>
|
|
92
|
+
</branches>
|
|
93
|
+
<doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
|
|
94
|
+
<submoduleCfg class="list"/>
|
|
95
|
+
<extensions/>
|
|
96
|
+
</scm>
|
|
97
|
+
<scriptPath>packages/ci/src/configs/jobs/build-release-image/Jenkinsfile</scriptPath>
|
|
98
|
+
<lightweight>false</lightweight>
|
|
99
|
+
</definition>
|
|
100
|
+
<triggers/>
|
|
101
|
+
<disabled>false</disabled>
|
|
102
|
+
</flow-definition>
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
@Library('globalLibrary@master') _
|
|
2
|
+
|
|
3
|
+
githubHelper = new helpers.GithubNotifyHelper()
|
|
4
|
+
jobHelper = new helpers.JobHelper()
|
|
5
|
+
Map configuration = [:]
|
|
6
|
+
|
|
7
|
+
notificationType = params.NOTIFICATION_TYPE
|
|
8
|
+
gitCommitId = params.GIT_COMMIT
|
|
9
|
+
consumer = params.CONSUMER
|
|
10
|
+
brokerURL = params.PACT_BROKER_URL
|
|
11
|
+
branchName = params.GITHUB_BRANCH_NAME
|
|
12
|
+
repositoryUrl = params.GITHUB_REPO_GIT_URL
|
|
13
|
+
|
|
14
|
+
repositoryName = repositoryUrl.tokenize('/').last().split("\\.")[0]
|
|
15
|
+
repositorySSHUrl = "git@github.com:toptal/${repositoryName}.git"
|
|
16
|
+
|
|
17
|
+
pipeline {
|
|
18
|
+
parameters {
|
|
19
|
+
string(name: 'NOTIFICATION_TYPE', description: 'Type of notification this job will send. Possible values: github, slack')
|
|
20
|
+
string(name: 'CONSUMER', description: "Name of the consumer, e.g. 'Staff Portal'")
|
|
21
|
+
string(name: 'PACT_BROKER_URL', defaultValue:'https://pact-broker.toptal.net', description: "Example 'https://pact-broker.toptal.net'")
|
|
22
|
+
string(name: 'GIT_COMMIT', description: 'Git commit which is used as a PACT contract version')
|
|
23
|
+
string(name: 'GITHUB_BRANCH_NAME', description: 'Branch to build')
|
|
24
|
+
string(name: 'GITHUB_REPO_GIT_URL', description: 'Repository URL')
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
agent {
|
|
28
|
+
docker {
|
|
29
|
+
image 'pactfoundation/pact-cli'
|
|
30
|
+
args """
|
|
31
|
+
--entrypoint "" --interactive \
|
|
32
|
+
--tty --user root
|
|
33
|
+
"""
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
options {
|
|
38
|
+
ansiColor('xterm')
|
|
39
|
+
skipDefaultCheckout()
|
|
40
|
+
timestamps()
|
|
41
|
+
timeout(time: 20, unit: 'MINUTES')
|
|
42
|
+
buildDiscarder(logRotator(daysToKeepStr: '3'))
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
environment {
|
|
46
|
+
PACT_BROKER = credentials('pact-broker')
|
|
47
|
+
SLACK_NOTIFICATION_CHANNEL = "${repositoryName}-bullhorn"
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
stages {
|
|
51
|
+
stage('Run can-i-deploy contracts verification') {
|
|
52
|
+
steps {
|
|
53
|
+
script {
|
|
54
|
+
info "Contract version is ${gitCommitId}"
|
|
55
|
+
|
|
56
|
+
if (notificationType == 'github') {
|
|
57
|
+
githubHelper.notifyPR(
|
|
58
|
+
'Consumer contracts: production', 'PENDING', 'Running contracts verification', gitCommitId, env.BUILD_URL, repositoryName
|
|
59
|
+
)
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
sh """
|
|
63
|
+
cd /pact;
|
|
64
|
+
bundle exec bin/pact broker can-i-deploy \
|
|
65
|
+
--broker-base-url ${brokerURL} \
|
|
66
|
+
--broker_username ${env.PACT_BROKER_USR} \
|
|
67
|
+
--broker_password ${env.PACT_BROKER_PSW} \
|
|
68
|
+
--pacticipant ${consumer} \
|
|
69
|
+
--version ${gitCommitId} \
|
|
70
|
+
--to production \
|
|
71
|
+
--retry-while-unknown 90
|
|
72
|
+
"""
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
post {
|
|
79
|
+
always{
|
|
80
|
+
sendBuildData(currentBuild)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
success {
|
|
84
|
+
script {
|
|
85
|
+
if (notificationType == 'github') {
|
|
86
|
+
githubHelper.notifyPR(
|
|
87
|
+
'Consumer contracts: production', 'SUCCESS', 'Contracts passed verification', gitCommitId, env.BUILD_URL, repositoryName
|
|
88
|
+
)
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
fixed {
|
|
94
|
+
script {
|
|
95
|
+
if (notificationType == 'slack') {
|
|
96
|
+
message = "${env.JOB_NAME} - #${currentBuild.number} back to normal <${env.BUILD_URL}|(Open)>"
|
|
97
|
+
slackSend color: 'good', channel: env.SLACK_NOTIFICATION_CHANNEL, message: message
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
failure {
|
|
103
|
+
script {
|
|
104
|
+
if (notificationType == 'slack') {
|
|
105
|
+
message = "${env.JOB_NAME} - #${currentBuild.number} failed <${env.BUILD_URL}|(Open)>"
|
|
106
|
+
slackSend color: 'danger', channel: env.SLACK_NOTIFICATION_CHANNEL, message: message
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (notificationType == 'github') {
|
|
110
|
+
githubHelper.notifyPR(
|
|
111
|
+
'Consumer contracts: production', 'FAILURE', 'Contracts failed or missing verification', gitCommitId, env.BUILD_URL, repositoryName
|
|
112
|
+
)
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
<flow-definition plugin="workflow-job@2.39">
|
|
2
|
+
<actions>
|
|
3
|
+
<org.jenkinsci.plugins.pipeline.modeldefinition.actions.DeclarativeJobAction plugin="pipeline-model-definition@1.6.0"/>
|
|
4
|
+
<org.jenkinsci.plugins.pipeline.modeldefinition.actions.DeclarativeJobPropertyTrackerAction plugin="pipeline-model-definition@1.6.0">
|
|
5
|
+
<jobProperties>
|
|
6
|
+
<string>jenkins.model.BuildDiscarderProperty</string>
|
|
7
|
+
</jobProperties>
|
|
8
|
+
<triggers/>
|
|
9
|
+
<parameters>
|
|
10
|
+
<string>GIT_COMMIT</string>
|
|
11
|
+
<string>CONSUMER</string>
|
|
12
|
+
<string>PACT_BROKER_URL</string>
|
|
13
|
+
<string>JOB_TYPE</string>
|
|
14
|
+
<string>GITHUB_BRANCH_NAME</string>
|
|
15
|
+
<string>GITHUB_REPO_GIT_URL</string>
|
|
16
|
+
</parameters>
|
|
17
|
+
<options>
|
|
18
|
+
<string>skipDefaultCheckout</string>
|
|
19
|
+
</options>
|
|
20
|
+
</org.jenkinsci.plugins.pipeline.modeldefinition.actions.DeclarativeJobPropertyTrackerAction>
|
|
21
|
+
</actions>
|
|
22
|
+
<description/>
|
|
23
|
+
<keepDependencies>false</keepDependencies>
|
|
24
|
+
<properties>
|
|
25
|
+
<hudson.plugins.jira.JiraProjectProperty plugin="jira@3.0.15"/>
|
|
26
|
+
<jenkins.model.BuildDiscarderProperty>
|
|
27
|
+
<strategy class="hudson.tasks.LogRotator">
|
|
28
|
+
<daysToKeep>3</daysToKeep>
|
|
29
|
+
<numToKeep>-1</numToKeep>
|
|
30
|
+
<artifactDaysToKeep>-1</artifactDaysToKeep>
|
|
31
|
+
<artifactNumToKeep>-1</artifactNumToKeep>
|
|
32
|
+
</strategy>
|
|
33
|
+
</jenkins.model.BuildDiscarderProperty>
|
|
34
|
+
<com.sonyericsson.jenkins.plugins.bfa.model.ScannerJobProperty plugin="build-failure-analyzer@1.20.0">
|
|
35
|
+
<doNotScan>false</doNotScan>
|
|
36
|
+
</com.sonyericsson.jenkins.plugins.bfa.model.ScannerJobProperty>
|
|
37
|
+
<com.coravy.hudson.plugins.github.GithubProjectProperty plugin="github@1.30.0">
|
|
38
|
+
<projectUrl>$PROJECT_URL</projectUrl>
|
|
39
|
+
<displayName/>
|
|
40
|
+
</com.coravy.hudson.plugins.github.GithubProjectProperty>
|
|
41
|
+
<com.sonyericsson.rebuild.RebuildSettings plugin="rebuild@1.31">
|
|
42
|
+
<autoRebuild>false</autoRebuild>
|
|
43
|
+
<rebuildDisabled>false</rebuildDisabled>
|
|
44
|
+
</com.sonyericsson.rebuild.RebuildSettings>
|
|
45
|
+
<hudson.plugins.throttleconcurrents.ThrottleJobProperty plugin="throttle-concurrents@2.0.1">
|
|
46
|
+
<maxConcurrentPerNode>0</maxConcurrentPerNode>
|
|
47
|
+
<maxConcurrentTotal>0</maxConcurrentTotal>
|
|
48
|
+
<categories class="java.util.concurrent.CopyOnWriteArrayList"/>
|
|
49
|
+
<throttleEnabled>false</throttleEnabled>
|
|
50
|
+
<throttleOption>project</throttleOption>
|
|
51
|
+
<limitOneJobWithMatchingParams>false</limitOneJobWithMatchingParams>
|
|
52
|
+
<paramsToUseForLimit/>
|
|
53
|
+
</hudson.plugins.throttleconcurrents.ThrottleJobProperty>
|
|
54
|
+
<hudson.model.ParametersDefinitionProperty>
|
|
55
|
+
<parameterDefinitions>
|
|
56
|
+
<hudson.model.StringParameterDefinition>
|
|
57
|
+
<name>JOB_TYPE</name>
|
|
58
|
+
<description>Type of parent job that initiate contracts verification. Possible values: pr, master</description>
|
|
59
|
+
<trim>false</trim>
|
|
60
|
+
</hudson.model.StringParameterDefinition>
|
|
61
|
+
<hudson.model.StringParameterDefinition>
|
|
62
|
+
<name>GIT_COMMIT</name>
|
|
63
|
+
<description>Git commit which is used as a pact contract version</description>
|
|
64
|
+
<trim>false</trim>
|
|
65
|
+
</hudson.model.StringParameterDefinition>
|
|
66
|
+
<hudson.model.StringParameterDefinition>
|
|
67
|
+
<name>CONSUMER</name>
|
|
68
|
+
<description>Name of the consumer, e.g. Staff Portal</description>
|
|
69
|
+
<trim>false</trim>
|
|
70
|
+
</hudson.model.StringParameterDefinition>
|
|
71
|
+
<hudson.model.StringParameterDefinition>
|
|
72
|
+
<name>PACT_BROKER_URL</name>
|
|
73
|
+
<description>Example https://pact-broker.toptal.net</description>
|
|
74
|
+
<trim>false</trim>
|
|
75
|
+
</hudson.model.StringParameterDefinition>
|
|
76
|
+
<hudson.model.StringParameterDefinition>
|
|
77
|
+
<name>GITHUB_BRANCH_NAME</name>
|
|
78
|
+
<description>Branch to build</description>
|
|
79
|
+
<defaultValue />
|
|
80
|
+
<trim>false</trim>
|
|
81
|
+
</hudson.model.StringParameterDefinition>
|
|
82
|
+
<hudson.model.StringParameterDefinition>
|
|
83
|
+
<name>GITHUB_REPO_GIT_URL</name>
|
|
84
|
+
<description>Repository URL</description>
|
|
85
|
+
<defaultValue />
|
|
86
|
+
<trim>false</trim>
|
|
87
|
+
</hudson.model.StringParameterDefinition>
|
|
88
|
+
</parameterDefinitions>
|
|
89
|
+
</hudson.model.ParametersDefinitionProperty>
|
|
90
|
+
</properties>
|
|
91
|
+
<definition class="org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition" plugin="workflow-cps@2.80">
|
|
92
|
+
<scm class="hudson.plugins.git.GitSCM" plugin="git@4.2.2">
|
|
93
|
+
<configVersion>2</configVersion>
|
|
94
|
+
<userRemoteConfigs>
|
|
95
|
+
<hudson.plugins.git.UserRemoteConfig>
|
|
96
|
+
<url>git@github.com:toptal/davinci.git</url>
|
|
97
|
+
<credentialsId>$CREDENTIALS_ID</credentialsId>
|
|
98
|
+
</hudson.plugins.git.UserRemoteConfig>
|
|
99
|
+
</userRemoteConfigs>
|
|
100
|
+
<branches>
|
|
101
|
+
<hudson.plugins.git.BranchSpec>
|
|
102
|
+
<name>master</name>
|
|
103
|
+
</hudson.plugins.git.BranchSpec>
|
|
104
|
+
</branches>
|
|
105
|
+
<doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
|
|
106
|
+
<submoduleCfg class="list"/>
|
|
107
|
+
<extensions/>
|
|
108
|
+
</scm>
|
|
109
|
+
<scriptPath>packages/ci/src/configs/jobs/consumer-contracts-verify/Jenkinsfile</scriptPath>
|
|
110
|
+
<lightweight>true</lightweight>
|
|
111
|
+
</definition>
|
|
112
|
+
<triggers/>
|
|
113
|
+
<disabled>false</disabled>
|
|
114
|
+
</flow-definition>
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
<flow-definition plugin="workflow-job@2.35">
|
|
2
|
+
<actions>
|
|
3
|
+
<org.jenkinsci.plugins.pipeline.modeldefinition.actions.DeclarativeJobAction plugin="pipeline-model-definition@1.3.9" />
|
|
4
|
+
<org.jenkinsci.plugins.pipeline.modeldefinition.actions.DeclarativeJobPropertyTrackerAction plugin="pipeline-model-definition@1.3.9">
|
|
5
|
+
<jobProperties>
|
|
6
|
+
<string>jenkins.model.BuildDiscarderProperty</string>
|
|
7
|
+
</jobProperties>
|
|
8
|
+
<triggers />
|
|
9
|
+
<parameters>
|
|
10
|
+
<string>HELM_BRANCH</string>
|
|
11
|
+
<string>REPOSITORY_NAME</string>
|
|
12
|
+
<string>TAG</string>
|
|
13
|
+
<string>RELEASE</string>
|
|
14
|
+
<string>ENV</string>
|
|
15
|
+
</parameters>
|
|
16
|
+
<options>
|
|
17
|
+
<string>skipDefaultCheckout</string>
|
|
18
|
+
</options>
|
|
19
|
+
</org.jenkinsci.plugins.pipeline.modeldefinition.actions.DeclarativeJobPropertyTrackerAction>
|
|
20
|
+
</actions>
|
|
21
|
+
<description />
|
|
22
|
+
<keepDependencies>false</keepDependencies>
|
|
23
|
+
<properties>
|
|
24
|
+
<hudson.model.ParametersDefinitionProperty>
|
|
25
|
+
<parameterDefinitions>
|
|
26
|
+
<hudson.model.StringParameterDefinition>
|
|
27
|
+
<name>HELM_BRANCH</name>
|
|
28
|
+
<description>Helm branch</description>
|
|
29
|
+
<defaultValue>master</defaultValue>
|
|
30
|
+
<trim>false</trim>
|
|
31
|
+
</hudson.model.StringParameterDefinition>
|
|
32
|
+
<hudson.model.StringParameterDefinition>
|
|
33
|
+
<name>REPOSITORY_NAME</name>
|
|
34
|
+
<description>Name of repository</description>
|
|
35
|
+
<defaultValue />
|
|
36
|
+
<trim>false</trim>
|
|
37
|
+
</hudson.model.StringParameterDefinition>
|
|
38
|
+
<hudson.model.StringParameterDefinition>
|
|
39
|
+
<name>TAG</name>
|
|
40
|
+
<description>Image tag to deploy</description>
|
|
41
|
+
<defaultValue />
|
|
42
|
+
<trim>false</trim>
|
|
43
|
+
</hudson.model.StringParameterDefinition>
|
|
44
|
+
<hudson.model.StringParameterDefinition>
|
|
45
|
+
<name>RELEASE</name>
|
|
46
|
+
<description>Release name</description>
|
|
47
|
+
<defaultValue />
|
|
48
|
+
<trim>false</trim>
|
|
49
|
+
</hudson.model.StringParameterDefinition>
|
|
50
|
+
<hudson.model.StringParameterDefinition>
|
|
51
|
+
<name>ENV</name>
|
|
52
|
+
<description>Environment values in format ENV.key1=value1,ENV.key2=value2</description>
|
|
53
|
+
<defaultValue>ENV=null</defaultValue>
|
|
54
|
+
<trim>false</trim>
|
|
55
|
+
</hudson.model.StringParameterDefinition>
|
|
56
|
+
</parameterDefinitions>
|
|
57
|
+
</hudson.model.ParametersDefinitionProperty>
|
|
58
|
+
<hudson.plugins.jira.JiraProjectProperty plugin="jira@3.0.7" />
|
|
59
|
+
<jenkins.model.BuildDiscarderProperty>
|
|
60
|
+
<strategy class="hudson.tasks.LogRotator">
|
|
61
|
+
<daysToKeep>-1</daysToKeep>
|
|
62
|
+
<numToKeep>20</numToKeep>
|
|
63
|
+
<artifactDaysToKeep>-1</artifactDaysToKeep>
|
|
64
|
+
<artifactNumToKeep>-1</artifactNumToKeep>
|
|
65
|
+
</strategy>
|
|
66
|
+
</jenkins.model.BuildDiscarderProperty>
|
|
67
|
+
<com.sonyericsson.jenkins.plugins.bfa.model.ScannerJobProperty plugin="build-failure-analyzer@1.20.0">
|
|
68
|
+
<doNotScan>false</doNotScan>
|
|
69
|
+
</com.sonyericsson.jenkins.plugins.bfa.model.ScannerJobProperty>
|
|
70
|
+
<com.coravy.hudson.plugins.github.GithubProjectProperty plugin="github@1.29.4">
|
|
71
|
+
<projectUrl>$PROJECT_URL</projectUrl>
|
|
72
|
+
<displayName />
|
|
73
|
+
</com.coravy.hudson.plugins.github.GithubProjectProperty>
|
|
74
|
+
<hudson.plugins.throttleconcurrents.ThrottleJobProperty plugin="throttle-concurrents@2.0.1">
|
|
75
|
+
<maxConcurrentPerNode>0</maxConcurrentPerNode>
|
|
76
|
+
<maxConcurrentTotal>0</maxConcurrentTotal>
|
|
77
|
+
<categories class="java.util.concurrent.CopyOnWriteArrayList" />
|
|
78
|
+
<throttleEnabled>false</throttleEnabled>
|
|
79
|
+
<throttleOption>project</throttleOption>
|
|
80
|
+
<limitOneJobWithMatchingParams>false</limitOneJobWithMatchingParams>
|
|
81
|
+
<paramsToUseForLimit />
|
|
82
|
+
</hudson.plugins.throttleconcurrents.ThrottleJobProperty>
|
|
83
|
+
</properties>
|
|
84
|
+
<definition class="org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition" plugin="workflow-cps@2.74">
|
|
85
|
+
<scm class="hudson.plugins.git.GitSCM" plugin="git@3.10.1">
|
|
86
|
+
<configVersion>2</configVersion>
|
|
87
|
+
<userRemoteConfigs>
|
|
88
|
+
<hudson.plugins.git.UserRemoteConfig>
|
|
89
|
+
<url>git@github.com:toptal/inf-helm.git</url>
|
|
90
|
+
<credentialsId>jenkins-inf-helm</credentialsId>
|
|
91
|
+
</hudson.plugins.git.UserRemoteConfig>
|
|
92
|
+
</userRemoteConfigs>
|
|
93
|
+
<branches>
|
|
94
|
+
<hudson.plugins.git.BranchSpec>
|
|
95
|
+
<name>master</name>
|
|
96
|
+
</hudson.plugins.git.BranchSpec>
|
|
97
|
+
</branches>
|
|
98
|
+
<doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
|
|
99
|
+
<submoduleCfg class="list" />
|
|
100
|
+
<extensions />
|
|
101
|
+
</scm>
|
|
102
|
+
<scriptPath>Jenkinsfile</scriptPath>
|
|
103
|
+
<lightweight>true</lightweight>
|
|
104
|
+
</definition>
|
|
105
|
+
<triggers />
|
|
106
|
+
<disabled>false</disabled>
|
|
107
|
+
</flow-definition>
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
@Library('globalLibrary@master') _
|
|
2
|
+
|
|
3
|
+
helmVersion = '3'
|
|
4
|
+
sentryOrg = 'toptal'
|
|
5
|
+
|
|
6
|
+
def hasCommandInDavinci(args) {
|
|
7
|
+
def command = args.command
|
|
8
|
+
def repoName = args.repoName
|
|
9
|
+
def tag = args.tag
|
|
10
|
+
|
|
11
|
+
def davinciHelpOutput = sh(
|
|
12
|
+
script: """
|
|
13
|
+
docker run \
|
|
14
|
+
--rm \
|
|
15
|
+
-u 469:469 \
|
|
16
|
+
us-central1-docker.pkg.dev/toptal-hub/containers/${repoName}:${tag} \
|
|
17
|
+
yarn davinci help
|
|
18
|
+
""",
|
|
19
|
+
returnStdout: true
|
|
20
|
+
).trim() as String
|
|
21
|
+
|
|
22
|
+
return davinciHelpOutput.contains(command)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
pipeline {
|
|
26
|
+
agent { label 'docker' }
|
|
27
|
+
|
|
28
|
+
options {
|
|
29
|
+
ansiColor('xterm')
|
|
30
|
+
timestamps()
|
|
31
|
+
timeout(time: 1, unit: 'HOURS')
|
|
32
|
+
buildDiscarder(logRotator(numToKeepStr: '20'))
|
|
33
|
+
skipDefaultCheckout()
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
parameters {
|
|
37
|
+
string(name: 'HELM_BRANCH', defaultValue: 'master', description: 'Helm branch')
|
|
38
|
+
string(name: 'REPOSITORY_NAME', defaultValue: '', description: 'Name of repository')
|
|
39
|
+
string(name: 'TAG', defaultValue: '', description: 'Image tag to deploy')
|
|
40
|
+
string(name: 'RELEASE', defaultValue: 'internal', description: 'Release name')
|
|
41
|
+
string(name: 'ENV', defaultValue: 'ENV=null', description: 'Environment values in format ENV.key1=value1,ENV.key2=value2')
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
environment {
|
|
45
|
+
SENTRY_AUTH_TOKEN = credentials('sentry_auth_token')
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
stages {
|
|
49
|
+
stage('Check params') {
|
|
50
|
+
steps {
|
|
51
|
+
script {
|
|
52
|
+
if (
|
|
53
|
+
(params.REPOSITORY_NAME == "") ||
|
|
54
|
+
(params.TAG == "") ||
|
|
55
|
+
(params.RELEASE == "")
|
|
56
|
+
) {
|
|
57
|
+
error("== REPOSITORY_NAME, TAG and RELEASE are mandatory parameters ==")
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
} //stage
|
|
62
|
+
|
|
63
|
+
stage('Deploy with Helm') {
|
|
64
|
+
agent { docker { image "gcr.io/toptal-hub/helm:${helmVersion}" } }
|
|
65
|
+
|
|
66
|
+
stages {
|
|
67
|
+
stage('Git checkout Helm') {
|
|
68
|
+
steps {
|
|
69
|
+
script {
|
|
70
|
+
info "== Checking out ${params.HELM_BRANCH} =="
|
|
71
|
+
|
|
72
|
+
gitCheckout(
|
|
73
|
+
branches: params.HELM_BRANCH,
|
|
74
|
+
credentials: [username: 'git', description: 'jenkins/inf-helm'],
|
|
75
|
+
url: 'git@github.com:toptal/inf-helm.git',
|
|
76
|
+
additionalBehaviours: [
|
|
77
|
+
cleanBeforeCheckout: true
|
|
78
|
+
]
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
success "== Checked out ${params.HELM_BRANCH} at ${gitCommit()}"
|
|
82
|
+
|
|
83
|
+
configuration = new helpers.JobHelper().readYaml('configuration.yml')
|
|
84
|
+
configurationName = "${params.REPOSITORY_NAME}-${params.RELEASE}-deployment"
|
|
85
|
+
data = configuration[configurationName]
|
|
86
|
+
release = data.release
|
|
87
|
+
chart = data.chart
|
|
88
|
+
project = data.project
|
|
89
|
+
cluster = data.cluster
|
|
90
|
+
zone = data.zone
|
|
91
|
+
// in case of an empty string value, fallback to helm_vars by not setting ENV at all
|
|
92
|
+
set_params_env = (params.ENV == '') ? "" : "--set ${params.ENV}"
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
} //stage
|
|
96
|
+
|
|
97
|
+
stage('Deploy helm chart') {
|
|
98
|
+
environment {
|
|
99
|
+
GOOGLE_APPLICATION_CREDENTIALS = credentials("jenkins-helm-deployments-${project}")
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
steps {
|
|
103
|
+
script {
|
|
104
|
+
chart = 'davinci-app'
|
|
105
|
+
sh """
|
|
106
|
+
gcloud auth activate-service-account --key-file $GOOGLE_APPLICATION_CREDENTIALS
|
|
107
|
+
gcloud config set project $project
|
|
108
|
+
gcloud container clusters get-credentials $cluster --zone $zone --project $project
|
|
109
|
+
HELM_OPTS='\
|
|
110
|
+
$set_params_env \
|
|
111
|
+
--set image.tag=${params.TAG} \
|
|
112
|
+
--set image.repository=us-central1-docker.pkg.dev/toptal-hub/containers/${params.REPOSITORY_NAME}-release' \
|
|
113
|
+
make $chart $release dep_build upgrade
|
|
114
|
+
"""
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
success "== Deployed tag ${params.TAG} =="
|
|
118
|
+
}
|
|
119
|
+
} //stage
|
|
120
|
+
} //stages
|
|
121
|
+
} //stage
|
|
122
|
+
|
|
123
|
+
stage('Upload source maps to Sentry') {
|
|
124
|
+
steps {
|
|
125
|
+
script {
|
|
126
|
+
def commandExists = hasCommandInDavinci(
|
|
127
|
+
command: 'sentry-upload-source-maps',
|
|
128
|
+
repoName: REPOSITORY_NAME,
|
|
129
|
+
tag: TAG
|
|
130
|
+
)
|
|
131
|
+
|
|
132
|
+
if (commandExists) {
|
|
133
|
+
sh """
|
|
134
|
+
docker run \
|
|
135
|
+
--rm \
|
|
136
|
+
-u 469:469 \
|
|
137
|
+
-e SENTRY_ORG=${sentryOrg} \
|
|
138
|
+
-e SENTRY_PROJECT=${REPOSITORY_NAME} \
|
|
139
|
+
-e SENTRY_AUTH_TOKEN=${SENTRY_AUTH_TOKEN} \
|
|
140
|
+
us-central1-docker.pkg.dev/toptal-hub/containers/${REPOSITORY_NAME}:${TAG} \
|
|
141
|
+
yarn davinci-engine sentry-upload-source-maps
|
|
142
|
+
"""
|
|
143
|
+
} else {
|
|
144
|
+
info "Your current davinci version is not supporting uploading source maps to Sentry. Please update davinci package version in your app."
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
} //steps
|
|
148
|
+
} //stage
|
|
149
|
+
} //stages
|
|
150
|
+
|
|
151
|
+
post {
|
|
152
|
+
always {
|
|
153
|
+
script {
|
|
154
|
+
sendBuildData(currentBuild)
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
// vim:ft=groovy
|