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

Update env variable and remove unwanted code #1

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions bin/docker-execute
Original file line number Diff line number Diff line change
Expand Up @@ -259,10 +259,10 @@ for c in $(ssh -p 29418 -o "StrictHostKeyChecking no" jenkins@gerrit.helpshift.c
do ssh -p 29418 -o "StrictHostKeyChecking no" jenkins@gerrit.helpshift.com gerrit review $c --abandon; \
done;

bin/dry-run.rb --provider gerrit $PACKAGE_NAME $REPO_NAME;
rm -rf /home/dependabot/dependabot-core/tmp/$REPO_NAME'
bin/dry-run.rb --provider gerrit $PACKAGE_NAME $REPO_NAME;'
# rm -rf /home/dependabot/dependabot-core/tmp/$REPO_NAME'

#echo "Running dependabot for $1"
rm -f $(pwd)/id_rsa
docker rm -f $CONTAINER_NAME
# rm -f $(pwd)/id_rsa
# docker rm -f $CONTAINER_NAME
#docker exec "$CONTAINER_NAME"/bin/sh -c "sshpass -p $2 ssh -o StrictHostKeyChecking=no gerrit; bin/dry-run.rb lein $1"
23 changes: 6 additions & 17 deletions bin/dry-run.rb
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,7 @@ def security_fix?(dependency)
updater = file_updater_for(deps_to_update)
updated_files = updater.updated_dependency_files

puts $updated_files
puts $updated_files

updated_deps = updated_deps.reject do |d|
next false if d.name == checker.dependency.name
Expand All @@ -774,7 +774,7 @@ def security_fix?(dependency)
puts " <=> #{msg.pr_name.downcase}"

if $options[:write]

updated_files.each do |updated_file|
#path = File.join(dependency_files_cache_dir, updated_file.name)
path = File.join($repo_contents_path, updated_file.name)
Expand Down Expand Up @@ -804,12 +804,13 @@ def security_fix?(dependency)


if $options[:pull_request]
git_user = ENV.fetch("GIT_USER", "Jenkins")
git_email = ENV.fetch("GIT_EMAIL", "jenkins@helpshift.com")
puts "Pull Request Title: #{msg.pr_name}"
puts "--description--\n#{msg.pr_message}\n--/description--"
puts "--commit--\n#{msg.commit_message}\n--/commit--"
system("git config --global user.email \"shivam.sharma@helpshift.com\"")
system("git config --global user.name \"shivam sharma\"")
system("cp -rf hk.sh tmp/voyager/")
system("git config --global user.email '#{git_email}' ")
system("git config --global user.name '#{git_user}' ")
Dir.chdir($repo_contents_path) do
Dependabot::SharedHelpers.run_shell_command(
<<~CMD
Expand All @@ -818,15 +819,8 @@ def security_fix?(dependency)
)
system("git commit -m '#{msg.commit_message}'")
Dependabot::SharedHelpers.run_shell_command(

# "git rebase -f HEAD~1 feature/dependabot --exec 'git commit --amend --no-edit'"
"git commit --amend --no-edit"
)
# Dependabot::SharedHelpers.run_shell_command(
# <<~CMD
# bash hk.sh
# CMD
# )
$files.map!{ |x| x.name == "project.clj" ? updated_files.first : x}
end
end
Expand All @@ -847,9 +841,6 @@ def security_fix?(dependency)
puts "pushing the changes"
#push the commits to gerrit via rfc
Dir.chdir($repo_contents_path) do

# system 'git', 'rebase', '-f', 'HEAD~1', 'feature/dependabot', '--exec', 'git commit --amend --no-edit'
# system("/home/dependabot/rfc feature/dependabot")
system("git push origin HEAD:refs/for/feature/dependabot")
end

Expand All @@ -860,5 +851,3 @@ def security_fix?(dependency)

# rubocop:enable Metrics/BlockLength
# rubocop:enable Style/GlobalVars


2 changes: 1 addition & 1 deletion bundler/spec/dependabot/bundler/metadata_finder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
[{
"type" => "git_source",
"host" => "github.com",
"username" => ENV.fetch("LOCAL_GITHUB", "x-access-token"),
"username" => ENV.fetch("LOCAL_GITHUB_USER", "x-access-token"),
"password" => ENV.fetch("LOCAL_GITHUB_ACCESS_TOKEN", nil)
}]
end
Expand Down
33 changes: 16 additions & 17 deletions common/lib/dependabot/file_fetchers/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -792,28 +792,27 @@ def _clone_repo_contents(target_directory:)

submodule_cloning_failed = false
retries = 0
puts "papp #{path}"
begin
SharedHelpers.run_shell_command(
<<~CMD
git clone #{clone_options.string} ssh://shivam.sharma@gerrit.helpshift.com:29418/#{source.repo}.git #{path}
git clone #{clone_options.string} ssh://jenkins@gerrit.helpshift.com:29418/#{source.repo}.git #{path}
CMD
)
SharedHelpers.run_shell_command(
<<~CMD
mkdir -p #{path}/.git/hooks/
CMD
)
SharedHelpers.run_shell_command(
<<~CMD
curl -Lo #{path}/.git/hooks/commit-msg https://errit.helpshift.com/tools/hooks/commit-msg
CMD
)
SharedHelpers.run_shell_command(
<<~CMD
chmod +x #{path}/.git/hooks/commit-msg
CMD
)
# SharedHelpers.run_shell_command(
# <<~CMD
# mkdir -p #{path}/.git/hooks/
# CMD
# )
# SharedHelpers.run_shell_command(
# <<~CMD
# curl -Lo #{path}/.git/hooks/commit-msg https://errit.helpshift.com/tools/hooks/commit-msg
# CMD
# )
# SharedHelpers.run_shell_command(
# <<~CMD
# chmod +x #{path}/.git/hooks/commit-msg
# CMD
# )
SharedHelpers.run_shell_command(
<<~CMD
cp -rf /home/dependabot/commit-msg #{path}/.git/hooks/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
[{
"type" => "git_source",
"host" => "github.com",
"username" => "iathmika",
"password" => "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"
"username" => ENV.fetch("LOCAL_GITHUB_USER", "x-access-token"),
"password" => ENV.fetch("LOCAL_GITHUB_ACCESS_TOKEN", nil)
}]
end

Expand Down
Loading