Feature/gitlab deploykey updkey (#1661)

* feat(gitlab-deploy-key): automatically update ...

... the public key

* add integrity test

* fix sanity issues

* added changelog fragment

Co-authored-by: Mirko Wilhelmi <Mirko.Wilhelmi@sma.de>
This commit is contained in:
morco 2021-02-05 07:30:05 +01:00 committed by GitHub
parent f509f2c896
commit dd0b54b9b5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 45 additions and 0 deletions

View file

@ -145,6 +145,13 @@ class GitLabDeployKey(object):
def createOrUpdateDeployKey(self, project, key_title, key_key, options):
changed = False
# note: unfortunately public key cannot be updated directly by
# GitLab REST API, so for that case we need to delete and
# than recreate the key
if self.deployKeyObject and self.deployKeyObject.key != key_key:
self.deployKeyObject.delete()
self.deployKeyObject = None
# Because we have already call existsDeployKey in main()
if self.deployKeyObject is None:
deployKey = self.createDeployKey(project, {