As we reevaluate how to best support and maintain Staging Ref in the future, we encourage development teams using this environment to highlight their use cases in the following issue: https://gitlab.com/gitlab-com/gl-infra/software-delivery/framework/software-delivery-framework-issue-tracker/-/issues/36.

Skip to content
Snippets Groups Projects
Commit 6c8c9ff5 authored by Jacob Vosmaer's avatar Jacob Vosmaer
Browse files

Bypass shell and use stdlib JSON for GitlabUpdate

parent e6802540
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -48,12 +48,12 @@ class GitlabConfig
if redis.empty?
# Default to old method of connecting to redis
# for users that haven't updated their configuration
"env -i redis-cli"
%W(env -i redis-cli)
else
if redis.has_key?("socket")
"#{redis['bin']} -s #{redis['socket']}"
%W(#{redis['bin']} -s #{redis['socket']})
else
"#{redis['bin']} -h #{redis['host']} -p #{redis['port']}"
%W(#{redis['bin']} -h #{redis['host']} -p #{redis['port']})
end
end
end
Loading
Loading
require_relative 'gitlab_init'
require_relative 'gitlab_net'
require 'json'
class GitlabUpdate
attr_reader :config
Loading
Loading
@@ -53,7 +54,8 @@ class GitlabUpdate
end
def update_redis
command = "#{config.redis_command} rpush '#{config.redis_namespace}:queue:post_receive' '{\"class\":\"PostReceive\",\"args\":[\"#{@repo_path}\",\"#{@oldrev}\",\"#{@newrev}\",\"#{@refname}\",\"#{@key_id}\"]}' > /dev/null 2>&1"
system(command)
queue = "#{config.redis_namespace}:queue:post_receive"
msg = JSON.dump({'class' => 'PostReceive', 'args' => [@repo_path, @oldrev, @newrev, @refname, @key_id]})
system(*config.redis_command, 'rpush', queue, msg, err: '/dev/null', out: '/dev/null')
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment