Skip to content

Commit 07cfe81

Browse files
authored
Merge pull request #201 from cyberark/automated-release-process
ONYX-14702: Update to use automated release process
2 parents 98e9766 + f4ce2ca commit 07cfe81

5 files changed

Lines changed: 56 additions & 19 deletions

File tree

CHANGELOG.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,17 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
55
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
66

7-
## [Unreleased]
7+
## Unreleased
8+
### Changed
9+
- Nothing should go in this section, please add to the latest unreleased version
10+
(and update the corresponding date), or add a new version.
11+
12+
## [5.3.7] - 2021-12-28
813

914
### Changed
1015
- Change addressable gem dependency.
1116
[cyberark/conjur-api-ruby#199](https://github.com/cyberark/conjur-api-ruby/pull/199)
17+
- Update to use automated release process
1218

1319
## [5.3.6] - 2021-12-09
1420

@@ -357,6 +363,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
357363
## [2.0.0] - 2013-13-12
358364

359365
[Unreleased]: https://github.com/cyberark/conjur-api-ruby/compare/v5.3.6...HEAD
366+
[5.3.7]: https://github.com/cyberark/conjur-api-ruby/compare/v5.3.6...v5.3.7
360367
[5.3.6]: https://github.com/cyberark/conjur-api-ruby/compare/v5.3.5...v5.3.6
361368
[5.3.5]: https://github.com/cyberark/conjur-api-ruby/compare/v5.3.4...v5.3.5
362369
[5.3.4]: https://github.com/cyberark/conjur-api-ruby/compare/v5.3.3...v5.3.4

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ RUN apt-get update && apt-get install -y vim curl
55

66
WORKDIR /src/conjur-api
77

8-
COPY Gemfile conjur-api.gemspec ./
8+
COPY Gemfile conjur-api.gemspec VERSION ./
99
COPY lib/conjur-api/version.rb ./lib/conjur-api/
1010

1111
RUN bundle

Jenkinsfile

Lines changed: 45 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
#!/usr/bin/env groovy
22

3+
// Automated release, promotion and dependencies
4+
properties([
5+
release.addParams()
6+
])
7+
8+
if (params.MODE == "PROMOTE") {
9+
release.promote(params.VERSION_TO_PROMOTE) { sourceVersion, targetVersion, assetDirectory ->
10+
sh './publish.sh'
11+
}
12+
return
13+
}
14+
315
pipeline {
416
agent { label 'executor-v2' }
517

@@ -12,9 +24,29 @@ pipeline {
1224
cron(getDailyCronString())
1325
}
1426

27+
environment {
28+
MODE = release.canonicalizeMode()
29+
}
30+
1531
stages {
16-
stage('Validate Changelog') {
17-
steps { sh './bin/parse-changelog.sh' }
32+
stage ("Skip build if triggering job didn't create a release") {
33+
when {
34+
expression {
35+
MODE == "SKIP"
36+
}
37+
}
38+
steps {
39+
script {
40+
currentBuild.result = 'ABORTED'
41+
error("Aborting build because this build was triggered from upstream, but no release was built")
42+
}
43+
}
44+
}
45+
stage('Validate Changelog and set version') {
46+
steps {
47+
sh './bin/parse-changelog.sh'
48+
updateVersion("CHANGELOG.md", "${BUILD_NUMBER}")
49+
}
1850
}
1951

2052
stage('Prepare CC Report Dir'){
@@ -107,23 +139,21 @@ pipeline {
107139
}
108140
}
109141

110-
// Only publish to RubyGems if the tag begins with 'v' ex) v5.3.2
111-
stage('Publish to RubyGems?') {
112-
agent { label 'executor-v2' }
142+
stage('Release') {
143+
when {
144+
expression {
145+
MODE == "RELEASE"
146+
}
147+
}
113148

114-
when { tag "v*" }
115149
steps {
116-
// Clean up first
117-
sh 'docker run -i --rm -v $PWD:/src -w /src alpine/git clean -fxd'
118-
119-
sh './publish.sh'
120-
121-
// Clean up again...
122-
sh 'docker run -i --rm -v $PWD:/src -w /src alpine/git clean -fxd'
123-
deleteDir()
150+
release {
151+
// Clean up all but the calculated VERSION
152+
sh 'docker run -i --rm -v $PWD:/src -w /src alpine/git clean -fxd -e VERSION'
153+
sh './publish.sh'
154+
}
124155
}
125156
}
126-
127157
}
128158

129159
post {

conjur-api.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Gem::Specification.new do |gem|
99
gem.homepage = "https://github.com/cyberark/conjur-api-ruby/"
1010
gem.license = "Apache-2.0"
1111

12-
gem.files = `git ls-files`.split($\) + Dir['build_number']
12+
gem.files = `git ls-files`.split($\).append("VERSION") + Dir['build_number']
1313
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
1414
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
1515
gem.name = "conjur-api"

lib/conjur-api/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@
1919

2020
module Conjur
2121
class API
22-
VERSION = "5.3.6"
22+
VERSION = File.read(File.expand_path('../../VERSION', __dir__))
2323
end
2424
end

0 commit comments

Comments
 (0)