Skip to content

Commit 44ca54c

Browse files
authored
Merge pull request #182 from OpenVoxProject/version_actions
Add FIPS release job and update project version machinery
2 parents ee2f2fb + b1e6c4a commit 44ca54c

File tree

3 files changed

+79
-7
lines changed

3 files changed

+79
-7
lines changed

.github/workflows/build_fips.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
name: Build openvoxdb - FIPS platforms
3+
4+
on:
5+
workflow_dispatch:
6+
inputs:
7+
ref:
8+
description: 'Tag to build'
9+
required: true
10+
rpm_platform_list:
11+
description: 'A comma-separated list of rpm-based platforms to build for, excluding the architecture (e.g. redhatfips-8,redhatfips-9). Do not include spaces. If not provided, will use the default list of FIPS platforms supported by OpenVox Server and DB.'
12+
required: false
13+
type: string
14+
ezbake-ref:
15+
description: 'Branch/tag from ezbake that will be used for openvoxdb/server builds.'
16+
type: string
17+
default: 'main'
18+
ezbake-ver:
19+
description: 'The version specified in project.clj in the given ezbake-ref. Will default to the version found in project.clj in this repo if not specified.'
20+
type: string
21+
required: false
22+
23+
permissions:
24+
contents: read
25+
26+
jobs:
27+
build:
28+
uses: 'openvoxproject/shared-actions/.github/workflows/build_ezbake_fips.yml@main'
29+
with:
30+
ref: ${{ inputs.ref }}
31+
rpm_platform_list: ${{ inputs.rpm_platform_list }}
32+
ezbake-ref: ${{ inputs.ezbake-ref }}
33+
ezbake-ver: ${{ inputs.ezbake-ver }}
34+
secrets: inherit

project.clj

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
(def pdb-version "8.12.0-SNAPSHOT")
2-
31
(defn true-in-env? [x]
42
(#{"true" "yes" "1"} (System/getenv x)))
53

@@ -101,7 +99,10 @@
10199
(def i18n-version "1.0.3")
102100
(def jackson-version "2.21.0")
103101
(def slf4j-version "2.0.17")
104-
(defproject org.openvoxproject/puppetdb pdb-version
102+
103+
;; If you modify the version manually, run release_scripts/sync_ezbake_dep.rb to keep
104+
;; the ezbake dependency in sync.
105+
(defproject org.openvoxproject/puppetdb "8.12.0-SNAPSHOT"
105106
:description "OpenVox-integrated catalog and fact storage"
106107

107108
:license {:name "Apache License, Version 2.0"
@@ -261,8 +262,8 @@
261262
:password :env/CLOJARS_PASSWORD
262263
:sign-releases false}]]
263264

264-
:plugins [[lein-release "1.1.3" :exclusions [org.clojure/clojure]]
265-
[lein-cloverage "1.2.4"]
265+
:plugins [[lein-cloverage "1.2.4"]
266+
[lein-shell "0.5.0"]
266267
[org.openvoxproject/i18n ~i18n-version]]
267268

268269
:lein-release {:scm :git
@@ -366,14 +367,19 @@
366367
;; This circular dependency is required because of a bug in
367368
;; ezbake (EZ-35); without it, bootstrap.cfg will not be included
368369
;; in the final package.
369-
[org.openvoxproject/puppetdb ~pdb-version]]
370+
;;
371+
;; Do not modify this line. It is managed by the release process
372+
;; via the release_scripts/sync_ezbake_dep.rb script.
373+
[org.openvoxproject/puppetdb "8.12.0-SNAPSHOT"]]
370374
:name "puppetdb"
371375
:plugins [[org.openvoxproject/lein-ezbake ~(or (System/getenv "EZBAKE_VERSION") "2.7.3")]]}
372376
:ezbake-fips {:dependencies ^:replace [[org.bouncycastle/bcpkix-fips]
373377
[org.bouncycastle/bc-fips]
374378
[org.bouncycastle/bctls-fips]
375379
[org.clojure/clojure]
376-
[org.openvoxproject/puppetdb ~pdb-version]]
380+
;; Do not modify this line. It is managed by the release process
381+
;; via the release_scripts/sync_ezbake_dep.rb script.
382+
[org.openvoxproject/puppetdb "8.12.0-SNAPSHOT"]]
377383
:name "puppetdb"
378384
:uberjar-exclusions [#"^org/bouncycastle/.*"]
379385
:plugins [[org.openvoxproject/lein-ezbake ~(or (System/getenv "EZBAKE_VERSION") "2.7.3")]]}
@@ -410,6 +416,22 @@
410416
(if (map? prev) [new prev] (conj prev new)))
411417
#(spit %1 (pr-str %2))]}
412418

419+
;; We define our own release tasks here, rather than the default that 'lein release' does,
420+
;; so that we can keep the necessary org.openvoxproject/puppetdb ezbake dependency in sync.
421+
;; This also makes it always bump the minor version rather than patch, since we rarely end up
422+
;; releasing patch versions.
423+
:release-tasks [["vcs" "assert-committed"]
424+
["change" "version" "leiningen.release/bump-version" "release"]
425+
["shell" "ruby" "release_scripts/sync_ezbake_dep.rb"]
426+
["vcs" "commit"]
427+
["vcs" "tag"]
428+
["deploy"]
429+
["change" "version" "leiningen.release/bump-version" ":minor"]
430+
["shell" "ruby" "release_scripts/sync_ezbake_dep.rb"]
431+
["vcs" "commit"]
432+
["vcs" "push"]]
433+
434+
413435

414436
:eastwood {:config-files ["eastwood.clj"]
415437
;; local-shadows-var is too distruptive, particularly

release_scripts/sync_ezbake_dep.rb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env ruby
2+
# frozen_string_literal: true
3+
4+
file = ARGV[0] || "project.clj"
5+
text = File.read(file)
6+
7+
v = text[/^\(defproject\s+\S+\s+"([^"]+)"/m, 1]
8+
abort("Couldn't find defproject version string in #{file}") unless v
9+
10+
re = /\[org\.openvoxproject\/puppetdb\s+"[^"]+"\]/
11+
abort("Couldn't find literal [org.openvoxproject/puppetdb \"...\"] in #{file}") unless text.match?(re)
12+
13+
text.gsub!(re, %[[org.openvoxproject/puppetdb "#{v}"]])
14+
File.write(file, text)
15+
16+
puts "Synced ezbake dep to #{v}"

0 commit comments

Comments
 (0)