Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Tbt 285] keep_netrc from env #329

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
2 changes: 1 addition & 1 deletion lib/travis/scheduler/record/organization.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def preferences
end

def keep_netrc?
preferences.key?('keep_netrc') ? preferences['keep_netrc'] : true
preferences.key?('keep_netrc') ? preferences['keep_netrc'] : !(ENV['DELETE_NETRC'] == "true")
end

def uid
Expand Down
2 changes: 1 addition & 1 deletion lib/travis/scheduler/record/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def preferences
end

def keep_netrc?
preferences.key?('keep_netrc') ? preferences['keep_netrc'] : true
preferences.key?('keep_netrc') ? preferences['keep_netrc'] : !(ENV['DELETE_NETRC'] == "true")
end

def uid
Expand Down
2 changes: 1 addition & 1 deletion lib/travis/scheduler/serialize/worker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def data
workspace:,
enterprise: !!config[:enterprise],
prefer_https: !!config[:prefer_https],
keep_netrc: repo.keep_netrc?,
keep_netrc: job.keep_netrc?,
secrets: job.secrets,
allowed_repositories:
}
Expand Down
8 changes: 8 additions & 0 deletions lib/travis/scheduler/serialize/worker/job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ def vm_size
job.config.dig(:vm, :size)
end

def keep_netrc?
job.config.include?(:keep_netrc) ? !!job.config[:keep_netrc] : repo.keep_netrc?
end

def trace?
Rollout.matches?(:trace, uid: SecureRandom.hex, owner: repository.owner.login, repo: repository.slug, redis: Scheduler.redis)
end
Expand Down Expand Up @@ -135,6 +139,10 @@ def job_repository
def repository_key
job_repository&.key || ::SslKey.new(private_key: 'test')
end

def repo
@repo ||= Repo.new(repository, config)
end
end
end
end
Expand Down