Commit b0865a3f authored by Bob Van Landuyt's avatar Bob Van Landuyt

Add FF disable setting last_used_at on SSH access

This allows circumventing setting the `last_used_at` flag when
accessing repositories through git-ssh.
parent 7d25a6e6
---
name: disable_ssh_key_used_tracking
introduced_by_url:
rollout_issue_url: https://gitlab.com/gitlab-com/gl-infra/scalability/-/issues/889
milestone: '13.9'
type: development
group: group::source code
default_enabled: false
...@@ -37,6 +37,8 @@ module API ...@@ -37,6 +37,8 @@ module API
end end
def update_last_used_at! def update_last_used_at!
return if Feature.enabled?(:disable_ssh_key_used_tracking)
key&.update_last_used_at key&.update_last_used_at
end end
......
...@@ -152,6 +152,10 @@ RSpec.describe API::Support::GitAccessActor do ...@@ -152,6 +152,10 @@ RSpec.describe API::Support::GitAccessActor do
end end
describe '#update_last_used_at!' do describe '#update_last_used_at!' do
before do
stub_feature_flags(disable_ssh_key_used_tracking: false)
end
context 'when initialized with a User' do context 'when initialized with a User' do
let(:user) { build(:user) } let(:user) { build(:user) }
...@@ -170,6 +174,14 @@ RSpec.describe API::Support::GitAccessActor do ...@@ -170,6 +174,14 @@ RSpec.describe API::Support::GitAccessActor do
subject.update_last_used_at! subject.update_last_used_at!
end end
it 'does not update `last_used_at` when the functionality is disabled' do
stub_feature_flags(disable_ssh_key_used_tracking: true)
expect(key).not_to receive(:update_last_used_at)
subject.update_last_used_at!
end
end end
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment