Skip to content

Commit

Permalink
Merge pull request #2967 from zendesk/grosser/env-kub
Browse files Browse the repository at this point in the history
remove commit_range env var since it is expensive and unused
  • Loading branch information
grosser authored Oct 1, 2018
2 parents 121fa78 + bc0ac47 commit b1a10ad
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
19 changes: 8 additions & 11 deletions app/models/job_execution.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,7 @@ def descriptor
def base_commands(dir, env = {})
artifact_cache_dir = File.join(@job.project.repository.repo_cache_dir, "artifacts")
FileUtils.mkdir_p(artifact_cache_dir)

env = {
PROJECT_NAME: @job.project.name,
PROJECT_PERMALINK: @job.project.permalink,
PROJECT_REPOSITORY: @job.project.repository_url,
CACHE_DIR: artifact_cache_dir
}.merge(env)
env[:CACHE_DIR] = artifact_cache_dir

commands = env.map do |key, value|
"export #{key}=#{value.to_s.shellescape}"
Expand Down Expand Up @@ -214,13 +208,16 @@ def commands(dir)
REFERENCE: @reference,
REVISION: @job.commit,
TAG: (@job.tag || @job.commit)
}.merge(@env)
}.merge!(@env)

env.merge!(make_builds_available) if stage&.builds_in_environment

if deploy = @job.deploy
env[:COMMIT_RANGE] = deploy.changeset.commit_range
end
# for shared notification scripts
env.merge!(
PROJECT_NAME: @job.project.name,
PROJECT_PERMALINK: @job.project.permalink,
PROJECT_REPOSITORY: @job.project.repository_url
)

env.merge!(Hash[*Samson::Hooks.fire(:job_additional_vars, @job).compact])

Expand Down
1 change: 0 additions & 1 deletion test/models/job_execution_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ def last_line_of_output
lines.must_include "[04:05:06] DEPLOYER_NAME=John Doe"
lines.must_include "[04:05:06] REFERENCE=master"
lines.must_include "[04:05:06] REVISION=#{job.commit}"
lines.must_include "[04:05:06] COMMIT_RANGE=#{job.commit}...#{job.commit}"
lines.must_include "[04:05:06] TAG=v1"
lines.must_include "[04:05:06] FOO=bar"
end
Expand Down

0 comments on commit b1a10ad

Please sign in to comment.