Skip to content

Commit 267c67c

Browse files
authored
Chef-18535- Updating configuration for a symantec version promote and publish and other fixes (#258)
* updating version to major version and few plan file fixes Signed-off-by: nikhil2611 <[email protected]> * added HAB_BLDR_CHANNEL env as the build pipeline still using old hab version and updated config for a symantec version promote and publish and reverting back version and release branch changes Signed-off-by: nikhil2611 <[email protected]> * fixing the quotes Signed-off-by: nikhil2611 <[email protected]> * chefstyle fix Signed-off-by: nikhil2611 <[email protected]> * fixing spec failure Signed-off-by: nikhil2611 <[email protected]> * fixing typo in gemspec Signed-off-by: nikhil2611 <[email protected]> * updated back to omnibus_env Signed-off-by: nikhil2611 <[email protected]> --------- Signed-off-by: nikhil2611 <[email protected]>
1 parent 87bc8ec commit 267c67c

File tree

11 files changed

+69
-44
lines changed

11 files changed

+69
-44
lines changed

.expeditor/buildkite/artifact.habitat.test.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
$PSDefaultParameterValues['*:ErrorAction']='Stop'
77
$ErrorActionPreference = 'Stop'
88
$env:HAB_BLDR_CHANNEL = "LTS-2024"
9+
$env:HAB_REFRESH_CHANNEL = "LTS-2024"
910
$env:HAB_ORIGIN = 'ci'
1011
$env:CHEF_LICENSE = 'accept-no-persist'
1112
$env:HAB_LICENSE = 'accept-no-persist'

.expeditor/buildkite/artifact.habitat.test.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export PLAN='chef-cli'
77
export CHEF_LICENSE="accept-no-persist"
88
export HAB_LICENSE="accept-no-persist"
99
export HAB_BLDR_CHANNEL="LTS-2024"
10+
export HAB_REFRESH_CHANNEL="LTS-2024"
1011

1112
echo "--- checking if git is installed"
1213
if ! command -v git &> /dev/null; then

.expeditor/config.yml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,9 @@ rubygems:
1010
- chef-cli
1111

1212
release_branches:
13-
- workstation-LTS:
14-
version_constraint: 0.*
1513
- main:
1614
version_constraint: 5.*
15+
1716
github:
1817
# This deletes the GitHub PR branch after successfully merged into the release branch
1918
delete_branch_on_merge: true
@@ -28,10 +27,10 @@ github:
2827

2928
changelog:
3029
rollup_header: Changes not yet released to rubygems.org
30+
3131
artifact_channels:
32-
- dev
33-
- workstation-build
34-
- LTS-2024
32+
- unstable
33+
- chef-dke-lts2024
3534

3635
pipelines:
3736
- verify:
@@ -61,20 +60,21 @@ subscriptions:
6160
- "Expeditor: Skip All"
6261
- bash:.expeditor/update_version.sh:
6362
only_if: built_in:bump_version
63+
- built_in:update_changelog:
64+
ignore_labels:
65+
- "Expeditor: Skip Changelog"
66+
- "Expeditor: Skip All"
67+
- built_in:build_gem:
68+
only_if: built_in:bump_version
6469
- trigger_pipeline:habitat/build:
6570
only_if: built_in:bump_version
6671
ignore_labels:
6772
- "Expeditor: Skip Habitat"
6873
- "Expeditor: Skip All"
6974

70-
- workload: buildkite_hab_build_group_published:{{agent_id}}:*
71-
actions:
72-
# when all of the hab package publish to the unstable channel, test and promote them
73-
- built_in:promote_habitat_packages
74-
# Subscribe to the promotion of the dev channel to acceptance
75-
- workload: project_promoted:{{agent_id}}:dev:*
76-
actions:
77-
- built_in:promote_habitat_packages
78-
- workload: project_promoted:{{agent_id}}:workstation-build:*
75+
# this works for symantec version promote
76+
- workload: project_promoted:{{agent_id}}:*
7977
actions:
78+
- built_in:rollover_changelog
8079
- built_in:promote_habitat_packages
80+
- built_in:publish_rubygems

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.1.3
1+
5.6.16

chef-cli.gemspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,5 @@ Gem::Specification.new do |gem|
5050
gem.add_dependency "diff-lcs", ">= 1.0", "< 1.4" # 1.4 changes the output
5151
gem.add_dependency "pastel", "~> 0.7" # used for policyfile differ
5252
gem.add_dependency "license-acceptance", ">= 1.0.11", "< 3"
53+
gem.add_dependency "chef-licensing", ">= 1.0.2"
5354
end

habitat/plan.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ $ErrorActionPreference = "Stop"
22
$PSDefaultParameterValues['*:ErrorAction']='Stop'
33

44
$env:HAB_BLDR_CHANNEL = "LTS-2024"
5+
$env:HAB_REFRESH_CHANNEL = "LTS-2024"
56
$pkg_name="chef-cli"
67
$pkg_origin="chef"
78
$pkg_version=$(Get-Content "$PLAN_CONTEXT/../VERSION")

habitat/plan.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
export HAB_BLDR_CHANNEL="LTS-2024"
2+
export HAB_REFRESH_CHANNEL="LTS-2024"
23
pkg_name=chef-cli
34
pkg_origin=chef
45
ruby_pkg="core/ruby3_1"
@@ -10,6 +11,7 @@ pkg_build_deps=(
1011
core/libarchive
1112
)
1213
pkg_bin_dirs=(bin)
14+
1315
do_setup_environment() {
1416
build_line 'Setting GEM_HOME="$pkg_prefix/vendor"'
1517
export GEM_HOME="$pkg_prefix/vendor"

lib/chef-cli/command/env.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,19 +73,19 @@ def ruby_info
7373

7474
def gem_environment
7575
h = {}
76-
# h["GEM ROOT"] = omnibus_env["GEM_ROOT"]
77-
# h["GEM HOME"] = omnibus_env["GEM_HOME"]
78-
# h["GEM PATHS"] = omnibus_env["GEM_PATH"].split(File::PATH_SEPARATOR)
79-
# rescue OmnibusInstallNotFound
76+
h["GEM ROOT"] = omnibus_env["GEM_ROOT"]
77+
h["GEM HOME"] = omnibus_env["GEM_HOME"]
78+
h["GEM PATHS"] = omnibus_env["GEM_PATH"].split(File::PATH_SEPARATOR)
79+
rescue OmnibusInstallNotFound
8080
h["GEM_ROOT"] = ENV["GEM_ROOT"] if ENV.key?("GEM_ROOT")
8181
h["GEM_HOME"] = ENV["GEM_HOME"] if ENV.key?("GEM_HOME")
8282
h["GEM PATHS"] = ENV["GEM_PATH"].split(File::PATH_SEPARATOR) if ENV.key?("GEM_PATH") && !ENV.key?("GEM_PATH").nil?
83-
# ensure
84-
# h
83+
ensure
84+
h
8585
end
8686

8787
def paths
88-
habitat_env["PATH"].split(File::PATH_SEPARATOR)
88+
omnibus_env["PATH"].split(File::PATH_SEPARATOR)
8989
rescue OmnibusInstallNotFound
9090
ENV["PATH"].split(File::PATH_SEPARATOR)
9191
end

lib/chef-cli/command/exec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class Exec < ChefCLI::Command::Base
3030
def run(params)
3131
# Set ENV directly on the "parent" process (us) before running #exec to
3232
# ensure the custom PATH is honored when finding the command to exec
33-
habitat_env.each { |var, value| ENV[var] = value }
33+
omnibus_env.each { |var, value| ENV[var] = value }
3434
exec(*params)
3535
raise "Exec failed without an exception, your ruby is buggy" # should never get here
3636
end

lib/chef-cli/helpers.rb

Lines changed: 39 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -110,28 +110,47 @@ def git_windows_bin_dir
110110
@git_windows_bin_dir ||= File.expand_path(File.join(omnibus_root, "embedded", "git", "usr", "bin"))
111111
end
112112

113+
# #
114+
# # environment vars for habitat
115+
# #
116+
# def habitat_env
117+
# @habitat_env ||=
118+
# begin
119+
# # Define the necessary paths for the Habitat environment
120+
# # Custom GEM_HOME within Habitat
121+
# pkg_prefix = get_pkg_prefix
122+
# vendor_dir = File.join(pkg_prefix, "vendor")
123+
# path = [
124+
# File.join(pkg_prefix, "bin"),
125+
# ENV["PATH"].split(File::PATH_SEPARATOR), # Preserve existing PATH
126+
# ].flatten.uniq
127+
128+
# {
129+
# "PATH" => path.join(File::PATH_SEPARATOR),
130+
# "GEM_ROOT" => Gem.default_dir, # Default directory for gems
131+
# "GEM_HOME" => vendor_dir, # GEM_HOME pointing to the vendor directory
132+
# "GEM_PATH" => vendor_dir, # GEM_PATH also pointing to the vendor directory
133+
# }
134+
# end
135+
# end
136+
113137
#
114-
# environment vars for habitat
138+
# environment vars for omnibus
115139
#
116-
def habitat_env
117-
@habitat_env ||=
118-
begin
119-
# Define the necessary paths for the Habitat environment
120-
# Custom GEM_HOME within Habitat
121-
pkg_prefix = get_pkg_prefix
122-
vendor_dir = File.join(pkg_prefix, "vendor")
123-
path = [
124-
File.join(pkg_prefix, "bin"),
125-
ENV["PATH"].split(File::PATH_SEPARATOR) # Preserve existing PATH
126-
].flatten.uniq
127-
128-
{
129-
"PATH" => path.join(File::PATH_SEPARATOR),
130-
"GEM_ROOT" => Gem.default_dir, # Default directory for gems
131-
"GEM_HOME" => vendor_dir, # GEM_HOME pointing to the vendor directory
132-
"GEM_PATH" => vendor_dir, # GEM_PATH also pointing to the vendor directory
133-
}
134-
end
140+
def omnibus_env
141+
@omnibus_env ||=
142+
begin
143+
user_bin_dir = File.expand_path(File.join(Gem.user_dir, "bin"))
144+
path = [ omnibus_bin_dir, user_bin_dir, omnibus_embedded_bin_dir, ENV["PATH"].split(File::PATH_SEPARATOR) ]
145+
path << git_bin_dir if Dir.exist?(git_bin_dir)
146+
path << git_windows_bin_dir if Dir.exist?(git_windows_bin_dir)
147+
{
148+
"PATH" => path.flatten.uniq.join(File::PATH_SEPARATOR),
149+
"GEM_ROOT" => Gem.default_dir,
150+
"GEM_HOME" => Gem.user_dir,
151+
"GEM_PATH" => Gem.path.join(File::PATH_SEPARATOR),
152+
}
153+
end
135154
end
136155

137156
def get_pkg_prefix

0 commit comments

Comments
 (0)