Skip to content

Commit

Permalink
Merge pull request #1275 from e-gris/debug_postgres_ship
Browse files Browse the repository at this point in the history
(maint) Add PACKAGING_GITREF_REPLACEMENT envvar
  • Loading branch information
e-gris authored Nov 4, 2024
2 parents abeebbe + e02a103 commit 15da180
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 21 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
This changelog adheres to [Keep a CHANGELOG](http://keepachangelog.com).

## [Unreleased]
### Added
- (maint) Provide a mechanism, by way of a new environment variable `PACKAGING_GITREF_REPLACEMENT`,
which allows us to not require a release tag before building product.

## [0.122.3] - 2024-11-28
### Changed
Expand Down
43 changes: 23 additions & 20 deletions lib/packaging/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -290,18 +290,20 @@ def load_default_configs
# really belongs in the Rpm object.

def load_versioning
if @project_root and Pkg::Util::Git.describe
@ref = Pkg::Util::Git.sha_or_tag
@short_ref = Pkg::Util::Git.sha_or_tag(7)
@version = Pkg::Util::Version.dash_version
@gemversion = Pkg::Util::Version.dot_version
@debversion = Pkg::Util::Version.debversion
@origversion = Pkg::Util::Version.origversion
@rpmversion = Pkg::Util::Version.rpmversion
@rpmrelease = Pkg::Util::Version.rpmrelease
else
puts "Skipping determination of version via git describe, Pkg::Config.project_root is not set to the path of a tagged git repo."
unless @project_root && Pkg::Util::Git.describe
puts 'Skipping determination of version via git describe, Pkg::Config.project_root ' \
'is not set to the path of a tagged git repo.'
return
end

@ref = Pkg::Util::Git.sha_or_tag
@short_ref = Pkg::Util::Git.sha_or_tag(7)
@version = Pkg::Util::Version.dash_version
@gemversion = Pkg::Util::Version.dot_version
@debversion = Pkg::Util::Version.debversion
@origversion = Pkg::Util::Version.origversion
@rpmversion = Pkg::Util::Version.rpmversion
@rpmrelease = Pkg::Util::Version.rpmrelease
end

##
Expand All @@ -312,15 +314,16 @@ def load_versioning
#
def load_envvars
Pkg::Params::ENV_VARS.each do |v|
if var = ENV[v[:envvar].to_s]
case v[:type]
when :bool
self.instance_variable_set("@#{v[:var]}", Pkg::Util.boolean_value(var))
when :array
self.instance_variable_set("@#{v[:var]}", string_to_array(var))
else
self.instance_variable_set("@#{v[:var]}", var)
end
var = ENV[v[:envvar].to_s]
next unless var

case v[:type]
when :bool
self.instance_variable_set("@#{v[:var]}", Pkg::Util.boolean_value(var))
when :array
self.instance_variable_set("@#{v[:var]}", string_to_array(var))
else
self.instance_variable_set("@#{v[:var]}", var)
end
end
end
Expand Down
1 change: 1 addition & 0 deletions lib/packaging/config/params.rb
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ module Pkg::Params
{ :var => :project_root, :envvar => :PROJECT_ROOT },
{ :var => :random_mockroot, :envvar => :RANDOM_MOCKROOT, :type => :bool },
{ :var => :rc_mocks, :envvar => :MOCK },
{ :var => :ref, :envvar => :PACKAGING_GITREF_REPLACEMENT },
{ :var => :release, :envvar => :RELEASE },
{ :var => :repo_name, :envvar => :REPO_NAME },
{ :var => :repo_link_target, :envvar => :REPO_LINK_TARGET },
Expand Down
6 changes: 5 additions & 1 deletion lib/packaging/util/windows.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ def add_msi_links(local_source_directory)
packages = Dir["#{local_source_directory}/#{platform}/*"]

archs.each do |arch|
package_version = Pkg::Util::Git.describe.tr('-', '.')
package_version = if ENV.key?('PACKAGING_GITREF_REPLACEMENT')
ENV['PACKAGING_GITREF_REPLACEMENT']
else
Pkg::Util::Git.describe.tr('-', '.')
end
package_filename = File.join(
local_source_directory, platform,
"#{Pkg::Config.project}-#{package_version}-#{arch}.msi"
Expand Down
5 changes: 5 additions & 0 deletions tasks/ship.rake
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,11 @@ namespace :pl do

target = args.target || 'artifacts'
local_dir = args.local_dir || 'pkg'

warn "jenkins_repo_path: #{Pkg::Config.jenkins_repo_path}"
warn "project: #{Pkg::Config.project}"
warn "ref: #{Pkg::Config.ref}"

project_basedir = File.join(
Pkg::Config.jenkins_repo_path, Pkg::Config.project, Pkg::Config.ref
)
Expand Down

0 comments on commit 15da180

Please sign in to comment.