From a200831ef956a02d8a94ef19b88d3fdfd2994017 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Tue, 12 Mar 2024 18:56:42 +0000 Subject: [PATCH 1/8] Set clj-parent=5.6.12 --- project.clj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project.clj b/project.clj index 4cd36bf5c2..f164a2e248 100644 --- a/project.clj +++ b/project.clj @@ -1,6 +1,6 @@ (def pdb-version "7.17.2-SNAPSHOT") -(def clj-parent-version "5.6.11") +(def clj-parent-version "5.6.12") (defn true-in-env? [x] (#{"true" "yes" "1"} (System/getenv x))) From 85129c703db813f379031321991856e472dab711 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Wed, 13 Mar 2024 19:23:05 +0000 Subject: [PATCH 2/8] Set clj-parent=5.6.13 --- project.clj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project.clj b/project.clj index f164a2e248..f646cf5b99 100644 --- a/project.clj +++ b/project.clj @@ -1,6 +1,6 @@ (def pdb-version "7.17.2-SNAPSHOT") -(def clj-parent-version "5.6.12") +(def clj-parent-version "5.6.13") (defn true-in-env? [x] (#{"true" "yes" "1"} (System/getenv x))) From b8467b215f5b4cad2b5773066f0bd271efc5e6ea Mon Sep 17 00:00:00 2001 From: donoghuc Date: Fri, 29 Mar 2024 13:32:04 -0700 Subject: [PATCH 3/8] (maint) Work around java install on older debian There seems to have been a regression whereby installing java as part of puppetserver deps fails due to a file not being found from ca-certificates-java similar to https://github.com/adoptium/installer/issues/105 . This commit explicitly installs ca-certificates-java before installing puppetserver to work around the issue. --- acceptance/helper.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/acceptance/helper.rb b/acceptance/helper.rb index 531ef851f4..ea1044431d 100644 --- a/acceptance/helper.rb +++ b/acceptance/helper.rb @@ -874,6 +874,8 @@ def install_puppet_from_package(puppet_collection = "puppet6") # Take new configuration file on debian to prevent tests from hanging # when this is used to upgrade puppet if get_os_family(database) == :debian + # Explicitly install ca-certificates-java before java to avoid error installing java on debian + database.install_package('ca-certificates-java') database.install_package('puppetserver', '-o Dpkg::Options::="--force-confnew"') else install_package(database, 'puppetserver') From e4490ec06e2f6833683dd66121371bd5b6e8ea81 Mon Sep 17 00:00:00 2001 From: Austin Blatt Date: Tue, 2 Apr 2024 09:34:33 -0700 Subject: [PATCH 4/8] Log obsolete cmd message with producer_timestamp cmdref only represents the stockpile metadata about a command. To keep the timestamps distinct, its :producer_timestamp field is actually named :producer-ts, so this was always nil. It is also optional, so we need to pull the producer_timestamp out of the command body where it is not optional. Except for the deactivate node command, so we also need to provide a fallback. --- src/puppetlabs/puppetdb/command.clj | 32 ++++++++++++++--------- test/puppetlabs/puppetdb/command_test.clj | 8 +++++- 2 files changed, 26 insertions(+), 14 deletions(-) diff --git a/src/puppetlabs/puppetdb/command.clj b/src/puppetlabs/puppetdb/command.clj index 15cbaa0a3a..9580370f1c 100644 --- a/src/puppetlabs/puppetdb/command.clj +++ b/src/puppetlabs/puppetdb/command.clj @@ -640,18 +640,19 @@ "Processes a command ref marked for deletion. This is similar to processing a non-delete cmdref except different metrics need to be updated to indicate the difference in command" - [cmd {:keys [command version certname id received producer_timestamp] :as cmdref} + [cmd {:keys [command version certname id received] :as cmdref} q response-chan stats _options-config maybe-send-cmd-event!] - (swap! stats update :executed-commands inc) - ((:callback cmd) {:command cmd :result nil}) - (async/>!! response-chan (make-cmd-processed-message cmd nil)) - (log-command-processed-messsage id received (now) (command-keys command) - certname producer_timestamp - {:status :obsolete}) - (queue/ack-command q {:entry (queue/cmdref->entry cmdref)}) - (maybe-send-cmd-event! cmdref ::processed) - (update-counter! :depth command version dec!) - (update-counter! :invalidated command version dec!)) + (let [producer_timestamp (get-in cmd [:payload :producer_timestamp])] + (swap! stats update :executed-commands inc) + ((:callback cmd) {:command cmd :result nil}) + (async/>!! response-chan (make-cmd-processed-message cmd nil)) + (log-command-processed-messsage id received (now) (command-keys command) + certname producer_timestamp + {:status :obsolete}) + (queue/ack-command q {:entry (queue/cmdref->entry cmdref)}) + (maybe-send-cmd-event! cmdref ::processed) + (update-counter! :depth command version dec!) + (update-counter! :invalidated command version dec!))) (defn broadcast-cmd [{:keys [certname command id callback] :as cmd} @@ -811,8 +812,13 @@ (mark! (global-metric :fatal)) (maybe-send-cmd-event! cmdref ::processed)) - delete? (process-delete-cmd cmd cmdref q response-chan stats - options-config maybe-send-cmd-event!) + delete? (-> cmd + ;; :producer_timestamp is optional in some commands. + ;; Normally handled by prep-command, but those operations + ;; can be expensive and aren't necessary to drop the cmd. + (update-in [:payload :producer_timestamp] #(or % (now))) + (process-delete-cmd cmdref q response-chan stats + options-config maybe-send-cmd-event!)) :else (-> cmd (prep-command options-config) diff --git a/test/puppetlabs/puppetdb/command_test.clj b/test/puppetlabs/puppetdb/command_test.clj index b85748a912..5b8717490d 100644 --- a/test/puppetlabs/puppetdb/command_test.clj +++ b/test/puppetlabs/puppetdb/command_test.clj @@ -78,6 +78,7 @@ [puppetlabs.trapperkeeper.services :refer [service-context]] [puppetlabs.puppetdb.client :as client] + [puppetlabs.stockpile.queue :as stock] [puppetlabs.puppetdb.threadpool :as pool]) (:import (clojure.lang ExceptionInfo) @@ -1627,6 +1628,8 @@ (svc-utils/with-puppetdb-instance (let [{pdb-host :host pdb-port :port :or {pdb-host "127.0.0.1" pdb-port 8080}} (:jetty (get-config)) + pdb (get-service svc-utils/*server* :PuppetDBServer) + q (:q (cli-svc/shared-globals pdb)) base-url (utils/pdb-cmd-base-url pdb-host pdb-port :v1) facts {:certname "foo.com" :environment "test" @@ -1662,7 +1665,10 @@ ;; check the first command was "bashed" (is (= #{{:id 0 :delete? true} {:id 1 :delete? nil}} - (set (map #(select-keys % [:id :delete?]) val)))))))))) + (set (map #(select-keys % [:id :delete?]) val)))) + + ;; check that all commands removed from stockpile + (is (= 0 (stock/reduce q (fn [acc _] (inc acc)) 0))))))))) (deftest command-service-stats (svc-utils/with-puppetdb-instance From a82e7aec3f7750b85e23ff43fd6006cac7dbb700 Mon Sep 17 00:00:00 2001 From: donoghuc Date: Fri, 5 Apr 2024 14:29:17 -0700 Subject: [PATCH 5/8] (PDB-5731) Prep 7.18.0 release --- project.clj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project.clj b/project.clj index f646cf5b99..ef9f8f058e 100644 --- a/project.clj +++ b/project.clj @@ -1,4 +1,4 @@ -(def pdb-version "7.17.2-SNAPSHOT") +(def pdb-version "7.18.0-SNAPSHOT") (def clj-parent-version "5.6.13") From 63bab0ba6aef389030bb3a12bff56a65a7c654c5 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Fri, 5 Apr 2024 22:01:11 +0000 Subject: [PATCH 6/8] Version 7.18.0 --- project.clj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project.clj b/project.clj index ef9f8f058e..88e34bbfc8 100644 --- a/project.clj +++ b/project.clj @@ -1,4 +1,4 @@ -(def pdb-version "7.18.0-SNAPSHOT") +(def pdb-version "7.18.0") (def clj-parent-version "5.6.13") From fd91e4a5961bdcc0fbc0726ca25b42d7bcddf38a Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Fri, 5 Apr 2024 22:01:12 +0000 Subject: [PATCH 7/8] Version 7.18.1-SNAPSHOT --- project.clj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project.clj b/project.clj index 88e34bbfc8..daf35619a4 100644 --- a/project.clj +++ b/project.clj @@ -1,4 +1,4 @@ -(def pdb-version "7.18.0") +(def pdb-version "7.18.1-SNAPSHOT") (def clj-parent-version "5.6.13") From b97b6303d93988f94c249911b3314066b0e8da4a Mon Sep 17 00:00:00 2001 From: donoghuc Date: Tue, 9 Apr 2024 15:59:23 -0700 Subject: [PATCH 8/8] (PDB-5732) Prep release notes for 7.18.0 --- documentation/release_notes_7.markdown | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/documentation/release_notes_7.markdown b/documentation/release_notes_7.markdown index f03f4e0a7f..d2466158fb 100644 --- a/documentation/release_notes_7.markdown +++ b/documentation/release_notes_7.markdown @@ -15,6 +15,22 @@ canonical: "/puppetdb/latest/release_notes.html" # PuppetDB: Release notes +## PuppetDB 7.18.0 + +Released April 11 2024 + +### Improvements + +* Ship with updated dependencies (clojure, and pgjdbc) + +### Bug fixes + +* Ensure producer_timestamp is logged with legacy commands. + +### Contributors + +Austin Blatt and Rob Browning. + ## PuppetDB 7.17.1 Released February 27 2024