Skip to content

Commit a42d5c9

Browse files
authored
buildkite_pipeline_upload: use . for sourcing env files for POSIX compliance (#681)
2 parents e2075da + 5a2864d commit a42d5c9

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ _None_
1414

1515
### Bug Fixes
1616

17-
_None_
17+
- `buildkite_pipeline_upload`: Fix compatibility issues by using POSIX-compliant `.` instead of bash-specific `source` command. [#681]
1818

1919
### Internal Changes
2020

lib/fastlane/plugin/wpmreleasetoolkit/actions/common/buildkite_pipeline_upload_action.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ def self.run(params)
2121
if env_file && File.exist?(env_file)
2222
UI.message(" - Sourcing environment file beforehand: #{env_file}")
2323

24-
sh(environment, "source #{env_file.shellescape} && buildkite-agent pipeline upload #{pipeline_file.shellescape}")
24+
# Use `.` instead of `source` for POSIX compliance - works across all shells (sh/dash/bash/zsh)
25+
# while `source` isn't always present
26+
sh(environment, ". #{env_file.shellescape} && buildkite-agent pipeline upload #{pipeline_file.shellescape}")
2527
else
2628
sh(environment, 'buildkite-agent', 'pipeline', 'upload', pipeline_file)
2729
end

spec/buildkite_pipeline_upload_action_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
allow(File).to receive(:exist?).with(env_file).and_return(true)
6161
expect(Fastlane::Action).to receive(:sh).with(
6262
environment,
63-
"source #{env_file.shellescape} && buildkite-agent pipeline upload #{loaded_pipeline_file.shellescape}"
63+
". #{env_file.shellescape} && buildkite-agent pipeline upload #{loaded_pipeline_file.shellescape}"
6464
)
6565
expect_upload_pipeline_message
6666
expect_sourcing_env_file_message(env_file)
@@ -92,7 +92,7 @@
9292
allow(File).to receive(:exist?).with(env_file).and_return(true)
9393
expect(Fastlane::Action).to receive(:sh).with(
9494
environment_default,
95-
"source #{env_file.shellescape} && buildkite-agent pipeline upload #{loaded_pipeline_file.shellescape}"
95+
". #{env_file.shellescape} && buildkite-agent pipeline upload #{loaded_pipeline_file.shellescape}"
9696
)
9797
expect_upload_pipeline_message
9898
expect_sourcing_env_file_message(env_file)
@@ -122,7 +122,7 @@
122122
allow(File).to receive(:exist?).with(env_file_default).and_return(true)
123123
expect(Fastlane::Action).to receive(:sh).with(
124124
environment_default,
125-
"source #{env_file_default} && buildkite-agent pipeline upload #{loaded_pipeline_file.shellescape}"
125+
". #{env_file_default} && buildkite-agent pipeline upload #{loaded_pipeline_file.shellescape}"
126126
)
127127
expect_upload_pipeline_message
128128
expect_sourcing_env_file_message(env_file_default)

0 commit comments

Comments
 (0)