Skip to content

Commit 23ad77f

Browse files
author
Eric Griswold
committed
(refactor) Switch to 'fpm' method for creating puppetlabs-release
Create a cheaper, faster way to make puppetlabs-release debs and rpms without the vanagon overhead.
1 parent 7618c75 commit 23ad77f

File tree

106 files changed

+926
-76
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+926
-76
lines changed

Gemfile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ def location_for(place)
1010
end
1111
end
1212

13-
gem 'json'
14-
gem 'packaging', *location_for(ENV['PACKAGING_LOCATION'] || '~> 0.99')
1513
gem 'rake'
16-
gem 'vanagon', *location_for(ENV['VANAGON_LOCATION'] || '~> 0.21')
14+
gem 'fpm'
15+
gem 'packaging', *location_for(ENV['PACKAGING_LOCATION'] || '~> 0.99')

Jenkinsfile.build

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
pipeline {
2+
agent {
3+
label 'k8s-worker'
4+
}
5+
6+
options {
7+
timestamps()
8+
ansiColor('xterm')
9+
preserveStashes(buildCount: 15)
10+
}
11+
12+
environment {
13+
ABS_TOKEN = credentials('always-be-scheduling-k8s')
14+
ARTIFACTORY_API_KEY = credentials('api_token_for_jenkins_to_artifactory')
15+
}
16+
17+
stages {
18+
stage('Install Dependencies') {
19+
steps {
20+
sh 'sudo apt install --quiet --assume-yes rpm'
21+
}
22+
}
23+
stage('Build') {
24+
steps {
25+
sh './ci/ci-build'
26+
}
27+
}
28+
}
29+
}
File renamed without changes.

README.md

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,24 @@
1-
puppetlabs-release
2-
==================
1+
# puppetlabs-release
2+
3+
Uses fpm to build puppetlabs-release packages for all the platforms that we support.
4+
5+
See the [doc](./doc) directory for external documentation.
6+
7+
## Continuous Integration
38

49
Repo for yum and apt release packages with Puppet's signing key.
510

6-
See "Build and Ship a Release Package" in Confluence
7-
(https://confluence.puppetlabs.com/pages/viewpage.action?pageId=159652513)
8-
for details.
11+
Merging to the main branch runs the Jenkins job:
12+
13+
https://jenkins-sre.delivery.puppetlabs.net/job/pipeline_puppetlabs-release_vanagon-build
14+
15+
## Local builds
16+
17+
- bundle install
18+
- bundle exec rake build
19+
20+
`*.template` files for yum `.repo` and apt `.list` are merged with JSON configuration files from the `source` directory.
921

10-
NOTE: We must now set the project using the `PROJECT_OVERRIDE` environment
11-
variable when performing tasks with the packaging repo.
22+
This results in an intermediate `build` directory of small trees for fpm to create appropriate `.rpm` and `.deb` files from.
1223

13-
Pushes to this repository kickoff the https://jenkins-sre.delivery.puppetlabs.net/view/release-engineering/job/pipeline_puppetlabs-release_vanagon-build/ job that uses vanagon to build all of the projects.
24+
The fpm output files are left in the `output` directory per conventions set by the `packaging` gem.

Rakefile

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,34 @@
1+
# The 'packaging' gem requires these for configuration information.
2+
# See: https://github.com/puppetlabs/build-data
3+
ENV['TEAM'] = 'release'
4+
ENV['PROJECT_ROOT'] = Dir.pwd
5+
16
require 'packaging'
27

38
Pkg::Util::RakeUtils.load_packaging_tasks
9+
10+
desc 'Create packages from release-file definitions'
11+
task :build do
12+
projects = Dir.glob('source/projects/*.json').map do |json_file_name|
13+
File.basename(json_file_name, '.json')
14+
end.join(' ')
15+
16+
sh "./ci/create-packages #{projects}"
17+
end
18+
19+
desc 'Sign packages'
20+
task :sign do
21+
Pkg::Util::RakeUtils.invoke_task('pl:jenkins:sign_all', 'output')
22+
end
23+
24+
desc 'Upload packages to builds and Artifactory'
25+
task :ship do
26+
Pkg::Util::RakeUtils.invoke_task('pl:jenkins:ship', 'artifacts', 'output')
27+
Pkg::Util::RakeUtils.invoke_task('pl:jenkins:ship_to_artifactory', 'output')
28+
end
29+
30+
desc 'Clean up build and output directories'
31+
task :clean do
32+
rm_rf 'build'
33+
rm_rf 'output'
34+
end

ci/ci-build

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
3+
source /usr/local/rvm/scripts/rvm
4+
rvm use 2.7.5
5+
6+
set -ex
7+
8+
bundle config set --local path .
9+
bundle install
10+
bundle exec rake clean build sign ship --trace

0 commit comments

Comments
 (0)