Skip to content

Commit 92b9dc5

Browse files
authored
Merge pull request #13 from Datatamer/jenkins_pr_discovery
CLOUD-8255: Add in semantic release
2 parents 6ea48be + 86e644c commit 92b9dc5

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed

commitlint.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = { extends: ["@commitlint/config-conventional"] }

jenkins/build/Jenkinsfile

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ podTemplate(
4343
resourceRequestMemory: "1Gi"
4444
),
4545
],
46-
serviceAccount: "jenkins-emaas",
46+
serviceAccount: "jenkins-tamr",
4747
annotations: [
48-
podAnnotation(key: "iam.gke.io/gcp-service-account", value: "jenkins-emaas@tamr-internal-ci.iam.gserviceaccount.com")
48+
podAnnotation(key: "iam.gke.io/gcp-service-account", value: "jenkins-tamr@tamr-internal-ci.iam.gserviceaccount.com")
4949
]
5050
) {
5151
node(POD_LABEL) {
@@ -73,7 +73,7 @@ podTemplate(
7373

7474
stage('Build tamr_sdk') {
7575
timeout(time: 10, unit: 'MINUTES') {
76-
{
76+
if (helper.isPRBuild()) {
7777
sh """
7878
poetry build
7979
"""
@@ -83,30 +83,37 @@ podTemplate(
8383
}
8484

8585
container("semantic-release-poetry") {
86+
sh(returnStdout: true, script: 'git config --global --add safe.directory `pwd`')
87+
8688
stage('Lint Commits') {
8789
if (helper.isPRBuild()) {
88-
sh "./cicd/scripts/lint-commits.sh"
90+
sh "bash jenkins/build/scripts/lint-commits.sh"
8991
}
9092
}
91-
}
9293

93-
stage('Release') {
94+
stage('Release') {
9495
if (currentBuild.result == null || currentBuild.result == 'SUCCESS') {
9596
container("semantic-release-poetry") {
9697
withCredentials([string(credentialsId: 'github-oauth', variable: 'GH_TOKEN')]) {
9798
withEnv(["GH_TOKEN=${GH_TOKEN}"]) {
9899
sh "semantic-release --dry-run"
99-
}
100-
if (helper.getBranchName() == 'main' && !helper.isPRBuild()) {
101-
withEnv(["GH_TOKEN=${GH_TOKEN}"]) {
100+
}
101+
if (helper.getBranchName() == 'main' && !helper.isPRBuild()) {
102+
withEnv(["GH_TOKEN=${GH_TOKEN}"]) {
102103
sh "poetry config repositories.artifact-registry"
103104
sh "semantic-release"
104105
}
105106
}
106107
}
107108
}
108109
}
110+
}
109111
}
112+
} catch (err) {
113+
currentBuild.result = 'FAILURE'
114+
println 'Pipeline failed!'
115+
println err
116+
err.printStackTrace()
110117
}
111118
}
112-
}
119+
}

0 commit comments

Comments
 (0)